From 88b6139cb2c79da5a98cd35af2de120b379c9025 Mon Sep 17 00:00:00 2001
From: ahmedk <karim.ahmed@xfel.eu>
Date: Wed, 5 Jun 2024 16:55:57 +0200
Subject: [PATCH] fix: Raise warning for skipping das not mapped to detector in
 CALCAT

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

diff --git a/notebooks/AGIPD/AGIPD_Correct_and_Verify.ipynb b/notebooks/AGIPD/AGIPD_Correct_and_Verify.ipynb
index 8172dcbd0..41e4073e3 100644
--- a/notebooks/AGIPD/AGIPD_Correct_and_Verify.ipynb
+++ b/notebooks/AGIPD/AGIPD_Correct_and_Verify.ipynb
@@ -743,6 +743,12 @@
    "metadata": {},
    "outputs": [],
    "source": [
+    "# Skip das not available in CALCAT\n",
+    "agipd_das = [da for da in karabo_da if da in agipd_metadata.keys()]\n",
+    "missing_das = set(karabo_da) - set(agipd_das)\n",
+    "warning(f\"Skipping correcting {missing_das} as they are not mapped to this detector in CALCAT.\")\n",
+    "karabo_da = agipd_das\n",
+    "\n",
     "# Validate constants availability and exclude modules with no offsets.\n",
     "for da, calibrations in agipd_metadata.items():\n",
     "    mod = modules[karabo_da.index(da)]\n",
@@ -764,8 +770,6 @@
     "    if warn_missing_constants:\n",
     "        warning(f\"Constants {warn_missing_constants} were not retrieved for {da}.\")\n",
     "\n",
-    "# Skip das not available in CALCAT and with no constants.\n",
-    "karabo_da = [da for da in karabo_da if da in agipd_metadata.keys()]\n",
     "if not da:  # Offsets are missing for all modules.\n",
     "    raise Exception(\"Could not find offset constants for any modules, will not correct data.\")"
    ]
-- 
GitLab