From a072b387bb19340ffb6e8426f76b8a9faeca6d74 Mon Sep 17 00:00:00 2001
From: ahmedk <karim.ahmed@xfel.eu>
Date: Tue, 26 Nov 2024 11:42:06 +0100
Subject: [PATCH] Error for no cell ID pattern found

---
 notebooks/LPD/LPDChar_Darks_NBC.ipynb | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/notebooks/LPD/LPDChar_Darks_NBC.ipynb b/notebooks/LPD/LPDChar_Darks_NBC.ipynb
index 7bf5ab874..035a34435 100644
--- a/notebooks/LPD/LPDChar_Darks_NBC.ipynb
+++ b/notebooks/LPD/LPDChar_Darks_NBC.ipynb
@@ -248,7 +248,10 @@
     "                cid_arr = cid_arr[:-drop_last_frames_parallelgain]\n",
     "    \n",
     "        tids_by_cell_pattern.setdefault(tuple(cid_arr), []).append(tid)\n",
-    "    \n",
+    "\n",
+    "    if not tids_by_cell_pattern:\n",
+    "        raise ValueError(\"No cell ID patterns were found.\")\n",
+    "\n",
     "    most_common, sel_tids = max(tids_by_cell_pattern.items(), key=lambda p: len(p[1]))\n",
     "    \n",
     "    if len(sel_tids) <= (0.5 * len(cell_ids.train_ids)):\n",
-- 
GitLab