From 6c35fe6585889ea31f92ba7b618aa6431bf9844a Mon Sep 17 00:00:00 2001
From: ahmedk <karim.ahmed@xfel.eu>
Date: Thu, 23 Nov 2023 09:38:00 +0100
Subject: [PATCH] Account for dark runs not taken by the MDL device

---
 .../Jungfrau_dark_analysis_all_gains_burst_mode_NBC.ipynb  | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/notebooks/Jungfrau/Jungfrau_dark_analysis_all_gains_burst_mode_NBC.ipynb b/notebooks/Jungfrau/Jungfrau_dark_analysis_all_gains_burst_mode_NBC.ipynb
index 93a402ca0..5b4a46400 100644
--- a/notebooks/Jungfrau/Jungfrau_dark_analysis_all_gains_burst_mode_NBC.ipynb
+++ b/notebooks/Jungfrau/Jungfrau_dark_analysis_all_gains_burst_mode_NBC.ipynb
@@ -433,7 +433,12 @@
     "            acelltable -= sc_start\n",
     "        # Only for dynamic medium and low gain runs [forceswitchg1, forceswitchg2] in burst mode.\n",
     "\n",
-    "        if gain_mode == 0 and gain > 0 and memory_cells == 16:\n",
+    "        if (\n",
+    "            gain_mode == 0 and  # dynamic gain mode\n",
+    "            gain > 0 and  # Medium and low runs\n",
+    "            memory_cells == 16 and  # Burst mode\n",
+    "            acelltable.shape[0] == 2  # forceswitchg1 and forceswitchg2 acquired with the MDL device.\n",
+    "        ):\n",
     "            # 255 similar to the receiver which uses the 255\n",
     "            # value to indicate a cell without an image.\n",
     "            # image shape for forceswitchg1 and forceswitchg2 = (1024, 512, 2, trains)\n",
-- 
GitLab