From 224f8ec9f268be59df2e1dd0b1918fd5a1231600 Mon Sep 17 00:00:00 2001
From: ahmedk <karim.ahmed@xfel.eu>
Date: Thu, 22 Jun 2023 18:14:39 +0200
Subject: [PATCH] Avoid converting nans for uint32 badpixels

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

diff --git a/notebooks/LPD/LPD_Correct_Fast.ipynb b/notebooks/LPD/LPD_Correct_Fast.ipynb
index bed0e0d22..f702ac274 100644
--- a/notebooks/LPD/LPD_Correct_Fast.ipynb
+++ b/notebooks/LPD/LPD_Correct_Fast.ipynb
@@ -348,7 +348,7 @@
     "        # Some old BadPixels constants have <f8 dtype.\n",
     "        # Convert nan to float 0 to avoid having 2147483648 after\n",
     "        # converting float64 to uint32.\n",
-    "        if \"BadPixels\" in calibration_name:\n",
+    "        if \"BadPixels\" in calibration_name and consts[calibration_name].dtype != np.uint32:\n",
     "            consts[calibration_name] = np.nan_to_num(\n",
     "                consts[calibration_name], nan=0.0)\n",
     "        return consts[calibration_name] \\\n",
-- 
GitLab