From f0aa838589060f3f100eae3939c66aceb7fdde58 Mon Sep 17 00:00:00 2001
From: ahmedk <karim.ahmed@xfel.eu>
Date: Thu, 13 Jul 2023 12:21:32 +0200
Subject: [PATCH] return for modules with 0 trains

---
 notebooks/LPD/LPDChar_Darks_NBC.ipynb | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/notebooks/LPD/LPDChar_Darks_NBC.ipynb b/notebooks/LPD/LPDChar_Darks_NBC.ipynb
index f7924cdb2..de76f651d 100644
--- a/notebooks/LPD/LPDChar_Darks_NBC.ipynb
+++ b/notebooks/LPD/LPDChar_Darks_NBC.ipynb
@@ -189,8 +189,12 @@
     "    data = data[skip_first_ntrains : skip_first_ntrains + ntrains]\n",
     "    cell_ids = run[det_source, 'image.cellId'].drop_empty_trains()\n",
     "    cell_ids = cell_ids[skip_first_ntrains : skip_first_ntrains + ntrains]\n",
-    "    \n",
-    "    if len(data.train_ids) < min_trains:\n",
+    "\n",
+    "    # If there is no data available, return and expect this\n",
+    "    # module to be skipped later.\n",
+    "    if len(data.train_ids) == 0:\n",
+    "        return None, None, None, None, None, None, None, None\n",
+    "    elif len(data.train_ids) < min_trains:\n",
     "        raise Exception(f\"Run {run_path} only contains {len(data.train_ids)} trains, but {min_trains} required\")\n",
     "\n",
     "    im = data.ndarray()\n",
-- 
GitLab