diff --git a/notebooks/ePix100/Correction_ePix100_NBC.ipynb b/notebooks/ePix100/Correction_ePix100_NBC.ipynb index baa4bc08c982e90ef187d5ae802cc34a6af0762c..f71f2ee4b78145656ea66d44911db4243c018b58 100644 --- a/notebooks/ePix100/Correction_ePix100_NBC.ipynb +++ b/notebooks/ePix100/Correction_ePix100_NBC.ipynb @@ -280,6 +280,12 @@ ")\n", "const_metadata = epix_cal.metadata(calibrations=constant_names)\n", "\n", + "mod_to_pdu = epix_cal.mod_to_pdu\n", + "for mod, mod_md in const_metadata.items():\n", + " print(f\"{mod}({mod_to_pdu[mod]}):\")\n", + " for cname, c_mdata in mod_md.items():\n", + " print(f\"{cname}: {c_mdata['begin_validity_at']}\")\n", + "\n", "# Load the constant data from files\n", "const_data = epix_cal.ndarray_map(metadata=const_metadata)[karabo_da]\n", "\n", diff --git a/notebooks/pnCCD/Correct_pnCCD_NBC.ipynb b/notebooks/pnCCD/Correct_pnCCD_NBC.ipynb index fe6db973a6b7004a4fa5cb953391f392cbe7e965..4b18fd8e32b944851dec865c00ed607cbed042cf 100644 --- a/notebooks/pnCCD/Correct_pnCCD_NBC.ipynb +++ b/notebooks/pnCCD/Correct_pnCCD_NBC.ipynb @@ -323,6 +323,13 @@ ")\n", "\n", "pnccd_metadata = pnccd_cal.metadata(calibrations=constant_names)\n", + "\n", + "mod_to_pdu = pnccd_cal.mod_to_pdu\n", + "for mod, mod_md in pnccd_metadata.items():\n", + " print(f\"{mod}({mod_to_pdu[mod]}):\")\n", + " for cname, c_mdata in mod_md.items():\n", + " print(f\"{cname}: {c_mdata['begin_validity_at']}\")\n", + "\n", "constants = pnccd_cal.ndarray_map(metadata=pnccd_metadata)[karabo_da]\n", "\n", "# Validate the constants availability and raise/warn correspondingly. \n", diff --git a/src/cal_tools/calcat_interface.py b/src/cal_tools/calcat_interface.py index a7c8cf158007f8a1e097ee928276dfd92bba22e4..500f089e6f406748396ea7bf461df4ba51ca4965 100644 --- a/src/cal_tools/calcat_interface.py +++ b/src/cal_tools/calcat_interface.py @@ -524,6 +524,18 @@ class CalibrationData: self.detector["id"], self.pdu_snapshot_at, self.module_naming ) + @property + def mod_to_pdu(self): + """Get the physical detector units and create a dictionary + mapping each module name to physical name (physical detector unit). + + Returns: + DICT: mapping module to physical detector unit name. + """ + return {mod: pdu_md["physical_name"] for mod, pdu_md in self._api.physical_detector_units( + self.detector["id"], self.pdu_snapshot_at, self.module_naming + ).items()} + @property def condition(self): return self._build_condition(self.parameters)