From 17a780c5021482c35f32d10653051723a1a1a6e3 Mon Sep 17 00:00:00 2001
From: ahmedk <karim.ahmed@xfel.eu>
Date: Mon, 14 Feb 2022 15:00:18 +0100
Subject: [PATCH] process all trains, correct offset dtype, and save raw image
 like before

---
 notebooks/pnCCD/Characterize_pnCCD_Dark_NBC.ipynb | 4 ++--
 notebooks/pnCCD/Correct_pnCCD_NBC.ipynb           | 3 +--
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/notebooks/pnCCD/Characterize_pnCCD_Dark_NBC.ipynb b/notebooks/pnCCD/Characterize_pnCCD_Dark_NBC.ipynb
index a8d232b4f..13e9c89e6 100644
--- a/notebooks/pnCCD/Characterize_pnCCD_Dark_NBC.ipynb
+++ b/notebooks/pnCCD/Characterize_pnCCD_Dark_NBC.ipynb
@@ -58,7 +58,7 @@
     "sigmaNoise = 10.  # pixels whose signal value exceeds sigmaNoise*noise will be considered as cosmics and are masked\n",
     "bad_pixel_offset_sigma = 4.  # any pixel whose offset beyond this standard deviations is a bad pixel\n",
     "bad_pixel_noise_sigma = 4.  # any pixel whose noise beyond this standard deviations is a bad pixel\n",
-    "max_trains = 500  # Maximum number of trains to use for dark processing.\n",
+    "max_trains = 0  # Maximum number of trains to use for dark processing. Set to 0 to process all trains.\n",
     "min_trains = 1  # Minimum number of trains to proceed with dark processing.\n",
     "\n",
     "# Don't delete. myMDC sends this parameter by default.\n",
@@ -250,7 +250,7 @@
     "data = data.astype(np.float32)\n",
     "\n",
     "noiseMap = np.std(data, axis=0, dtype=np.float64)\n",
-    "offsetMap = np.mean(data, axis=0)\n",
+    "offsetMap = np.mean(data, axis=0, dtype=np.float64)\n",
     "step_timer.done_step(f'Initial maps are created from {n_trains} trains.')"
    ]
   },
diff --git a/notebooks/pnCCD/Correct_pnCCD_NBC.ipynb b/notebooks/pnCCD/Correct_pnCCD_NBC.ipynb
index e10a3f33a..f7bc8a917 100644
--- a/notebooks/pnCCD/Correct_pnCCD_NBC.ipynb
+++ b/notebooks/pnCCD/Correct_pnCCD_NBC.ipynb
@@ -786,8 +786,7 @@
     "        # Copy RAW non-calibrated sources.\n",
     "        with h5py.File(seq_f, 'r') as sfile:\n",
     "            h5_copy_except.h5_copy_except_paths(\n",
-    "                sfile, ofile,\n",
-    "                [\"INSTRUMENT/\"+instrument_src+\"/data/image\"],\n",
+    "                sfile, ofile, [],\n",
     "            )\n",
     "        # TODO: to clear this up: why save corrected data in data/pixels rather than data/image.\n",
     "        write_datasets(corr_arrays, ofile)\n",
-- 
GitLab