From 4c9c70f2a69f9fd4c5b383f1703dd8bef4ce094e Mon Sep 17 00:00:00 2001
From: Thomas Kluyver <thomas.kluyver@xfel.eu>
Date: Wed, 21 Oct 2020 13:03:09 +0200
Subject: [PATCH] Chunks for corrected JUNGFRAU data should contain entire
 images

---
 .../Jungfrau/Jungfrau_Gain_Correct_and_Verify_NBC.ipynb     | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/notebooks/Jungfrau/Jungfrau_Gain_Correct_and_Verify_NBC.ipynb b/notebooks/Jungfrau/Jungfrau_Gain_Correct_and_Verify_NBC.ipynb
index ca2c87b32..80ee34861 100644
--- a/notebooks/Jungfrau/Jungfrau_Gain_Correct_and_Verify_NBC.ipynb
+++ b/notebooks/Jungfrau/Jungfrau_Gain_Correct_and_Verify_NBC.ipynb
@@ -435,14 +435,16 @@
     "                    print(f'Data shape: {oshape}')\n",
     "                    if not oshape[0]:\n",
     "                        raise ValueError(f\"No image data: shape {oshape}\")\n",
+    "                    # Chunk always contains >= 1 complete image\n",
+    "                    chunk_shape = (chunk_size_idim, 1) + oshape[-2:]\n",
     "                    ddset = ofile.create_dataset(h5path_f+\"/adc\",\n",
     "                                                 oshape,\n",
-    "                                                 chunks=(chunk_size_idim, 1, oshape[1], oshape[2]),\n",
+    "                                                 chunks=chunk_shape,\n",
     "                                                 dtype=np.float32)\n",
     "\n",
     "                    mskset = ofile.create_dataset(h5path_f+\"/mask\",\n",
     "                                                  oshape,\n",
-    "                                                  chunks=(chunk_size_idim, 1, oshape[1], oshape[2]),\n",
+    "                                                  chunks=chunk_shape,\n",
     "                                                  dtype=np.uint32,\n",
     "                                                  compression=\"gzip\", compression_opts=1, shuffle=True)\n",
     "\n",
-- 
GitLab