From 41418c55590d7c6ee1f878ef5d38178717384d9a Mon Sep 17 00:00:00 2001 From: Egor Sobolev <egor.sobolev@xfel.eu> Date: Wed, 10 Jul 2024 17:09:04 +0200 Subject: [PATCH] Suppress lit-pixel counter warnings if it is disabled --- .../AGIPD/AGIPD_Correct_and_Verify.ipynb | 43 +++++++++---------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/notebooks/AGIPD/AGIPD_Correct_and_Verify.ipynb b/notebooks/AGIPD/AGIPD_Correct_and_Verify.ipynb index 5ef0c5b28..e62e40745 100644 --- a/notebooks/AGIPD/AGIPD_Correct_and_Verify.ipynb +++ b/notebooks/AGIPD/AGIPD_Correct_and_Verify.ipynb @@ -574,32 +574,31 @@ "metadata": {}, "outputs": [], "source": [ - "if round_photons:\n", - " data_units = 'photon'\n", - " litpx_threshold = 1.\n", - " if not xray_gain:\n", - " litpx_threshold *= 7.\n", - "else:\n", - " data_units = 'keV'\n", - " if photon_energy_warn:\n", - " warning(photon_energy_warn, '. Use 12 keV for lit-pixel counter threshold')\n", - " litpx_threshold = 12.\n", + "if count_lit_pixels:\n", + " if round_photons:\n", + " data_units = 'photon'\n", + " litpx_threshold = 1.\n", " else:\n", - " litpx_threshold = photon_energy\n", - "\n", - " if rounding_threshold_warn:\n", - " warning(rounding_threshold_warn)\n", + " data_units = 'keV'\n", + " if photon_energy_warn:\n", + " warning(photon_energy_warn, '. Use 12 keV for lit-pixel counter threshold')\n", + " litpx_threshold = 12.\n", + " else:\n", + " litpx_threshold = photon_energy\n", "\n", - "if not xray_gain:\n", - " # convert photon energy to ADU (for AGIPD approx. 1 keV = 7 ADU)\n", - " # it looks that rounding to photons can be applied to data in ADU as well\n", - " litpx_threshold *= 7.\n", - " data_units = 'ADU'\n", + " if rounding_threshold_warn:\n", + " warning(rounding_threshold_warn)\n", "\n", - "litpx_threshold *= rounding_threshold\n", + " if not xray_gain:\n", + " # convert photon energy to ADU (for AGIPD approx. 1 keV = 7 ADU)\n", + " # it looks that rounding to photons can be applied to data in ADU as well\n", + " litpx_threshold *= 7.\n", + " data_units = 'ADU'\n", "\n", - "if count_lit_pixels:\n", - " print(f\"Count lit-pixels with signal above {litpx_threshold:.3g} {data_units}\")" + " litpx_threshold *= rounding_threshold\n", + " print(f\"Count lit-pixels with signal above {litpx_threshold:.3g} {data_units}\")\n", + "else:\n", + " litpx_threshold = 1e20" ] }, { -- GitLab