From 84b5d223f740ea6639f934d64377cd57e46c4771 Mon Sep 17 00:00:00 2001 From: Thomas Kluyver <thomas@kluyver.me.uk> Date: Mon, 22 Jan 2024 11:13:12 +0000 Subject: [PATCH] Ensure module info from report has module_number field --- src/cal_tools/calcat_interface2.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/cal_tools/calcat_interface2.py b/src/cal_tools/calcat_interface2.py index 5207f5e72..363d4dd6e 100644 --- a/src/cal_tools/calcat_interface2.py +++ b/src/cal_tools/calcat_interface2.py @@ -550,6 +550,10 @@ class CalibrationData(Mapping): kda = pdu["karabo_da"] = pdu.pop("karabo_da_at_ccv_begin_at") det_id = pdu["detector_id"] = pdu.pop("detector_id_at_ccv_begin_at") pdu["virtual_device_name"] = pdu.pop("virtual_device_name_at_ccv_begin_at") + if pdu.get("module_number_at_ccv_begin_at") is not None: + pdu["module_number"] = pdu.pop("module_number_at_ccv_begin_at") + else: + pdu["module_number"] = int(re.findall(r"\d+", kda)[-1]) det_ids.add(det_id) if kda in pdus: -- GitLab