From 6c76e571fcdca864b856c1217341a637946cec52 Mon Sep 17 00:00:00 2001
From: ahmedk <karim.ahmed@xfel.eu>
Date: Mon, 2 Sep 2024 09:29:29 +0200
Subject: [PATCH] feat: use drop_trains for faster number of trains check

---
 notebooks/AGIPD/AGIPD_Correct_and_Verify.ipynb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/notebooks/AGIPD/AGIPD_Correct_and_Verify.ipynb b/notebooks/AGIPD/AGIPD_Correct_and_Verify.ipynb
index 2208d4ddb..9a2da6a73 100644
--- a/notebooks/AGIPD/AGIPD_Correct_and_Verify.ipynb
+++ b/notebooks/AGIPD/AGIPD_Correct_and_Verify.ipynb
@@ -339,7 +339,7 @@
     "for m in modules:\n",
     "    try:\n",
     "        # Attempt to select the module. If no trains are available, ValueError might be raised\n",
-    "        if len(dc.select(instrument_src.format(m), require_all=True).train_ids) > 0:\n",
+    "        if len(dc[instrument_src.format(m), 'image.data'].drop_empty_trains().train_ids) > 0:\n",
     "            train_available = True\n",
     "            break  # Found a module with available trains.\n",
     "    except ValueError as e:\n",
-- 
GitLab