From 0e65e4f86053efbe2695ed70ee767fed673aa29d Mon Sep 17 00:00:00 2001 From: ahmedk <karim.ahmed@xfel.eu> Date: Tue, 30 Jul 2024 08:56:40 +0200 Subject: [PATCH] fix: da_to_pdu dict modified --- .../Characterize_Darks_Gotthard2_NBC.ipynb | 21 +++++++++---------- .../Summary_Darks_Gotthard2_NBC.ipynb | 7 +++++-- tests/test_reference_runs/callab_tests.py | 2 +- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/notebooks/Gotthard2/Characterize_Darks_Gotthard2_NBC.ipynb b/notebooks/Gotthard2/Characterize_Darks_Gotthard2_NBC.ipynb index 6b6466f3d..34d5ccee9 100644 --- a/notebooks/Gotthard2/Characterize_Darks_Gotthard2_NBC.ipynb +++ b/notebooks/Gotthard2/Characterize_Darks_Gotthard2_NBC.ipynb @@ -225,22 +225,21 @@ "# when we start storing in the CALCAT.\n", "da_to_pdu = dict()\n", "for i, (da, p) in enumerate(sorted(pdus_by_da.items())):\n", - " da_to_pdu[da] = {\n", - " \"pdu\": p['physical_name'],\n", - " \"idx\": i,\n", - " }\n", + " da_to_pdu[da] = p['physical_name']\n", + "\n", + "calcat_das = list(da_to_pdu.keys())\n", "\n", "if karabo_da != [\"\"]:\n", " # Filter DA connected to detector in CALCAT\n", - " karabo_da = [da for da in karabo_da if da in da_to_pdu]\n", + " karabo_da = [da for da in karabo_da if da in calcat_das]\n", "else:\n", - " karabo_da = list(da_to_pdu.keys())\n", + " karabo_da = calcat_das\n", "\n", "print(f\"Processing {karabo_da}\")\n", "\n", "da_to_source = gotthard2lib.map_da_to_source(\n", " run_dc,\n", - " karabo_da,\n", + " calcat_das,\n", " input_source_template,\n", " karabo_id,\n", " input_source_affixes,\n", @@ -466,7 +465,7 @@ "g_name = [\"G0\", \"G1\", \"G2\"]\n", "\n", "for mod in karabo_da:\n", - " pdu = da_to_pdu[mod][\"pdu\"]\n", + " pdu = da_to_pdu[mod]\n", " display(Markdown(f\"### Badpixels for module {mod}:\"))\n", "\n", " badpixels_map[mod][\n", @@ -504,7 +503,7 @@ "if not local_output:\n", " for cons, cname in zip([offset_map, noise_map], [\"Offset\", \"Noise\"]):\n", " for mod in karabo_da:\n", - " pdu = da_to_pdu[mod][\"pdu\"]\n", + " pdu = da_to_pdu[mod]\n", " display(Markdown(f\"### {cname} for module {mod}:\"))\n", "\n", " for cell in [0, 1]:\n", @@ -528,7 +527,7 @@ "source": [ "step_timer.start()\n", "for mod in karabo_da:\n", - " db_mod = da_to_pdu[mod][\"pdu\"]\n", + " db_mod = da_to_pdu[mod]\n", " constants = {\n", " \"Offset\": offset_map[mod],\n", " \"Noise\": noise_map[mod],\n", @@ -594,7 +593,7 @@ " yaml.safe_dump(\n", " {\n", " \"module\": mod,\n", - " \"pdu\": da_to_pdu[mod][\"pdu\"],\n", + " \"pdu\": da_to_pdu[mod],\n", " },\n", " fd,\n", " )" diff --git a/notebooks/Gotthard2/Summary_Darks_Gotthard2_NBC.ipynb b/notebooks/Gotthard2/Summary_Darks_Gotthard2_NBC.ipynb index 756097845..411aeeca4 100644 --- a/notebooks/Gotthard2/Summary_Darks_Gotthard2_NBC.ipynb +++ b/notebooks/Gotthard2/Summary_Darks_Gotthard2_NBC.ipynb @@ -28,7 +28,7 @@ "karabo_id = \"DETLAB_25UM_GH2\" # detector identifier.\n", "karabo_da = [\"DA01/1\", \"DA01/2\"] # list of data aggregators, which corresponds to different JF modules. This is only needed for the detectors of one module.\n", "control_template = \"CONTROL\" # control template used to read CONTROL keys.\n", - "ctrl_source_template = '{}/DET/{}' # template for control source name (filled with karabo_id_control)\n", + "ctrl_source_template = '{karabo_id}/DET/{control_template}' # template for control source name (filled with karabo_id_control)\n", "karabo_id_control = \"\" # Control karabo ID. Set to empty string to use the karabo-id\n", "\n", "# Parameters to be used for injecting dark calibration constants.\n", @@ -88,7 +88,10 @@ " karabo_id_control = karabo_id\n", "g2ctrl = gotthard2lib.Gotthard2Ctrl(\n", " run_dc=RunDirectory(Path(in_folder) / f\"r{run_high:04d}\"),\n", - " ctrl_src=ctrl_source_template.format(karabo_id_control, control_template))\n", + " ctrl_src=ctrl_source_template.format(\n", + " karabo_id_control=karabo_id_control,\n", + " control_template=control_template\n", + " ))\n", "gh2_detector = g2ctrl.get_det_type()\n", "print(f\"Processing {gh2_detector} Gotthard2.\")" ] diff --git a/tests/test_reference_runs/callab_tests.py b/tests/test_reference_runs/callab_tests.py index 08d6f26e2..ffc2cdf31 100644 --- a/tests/test_reference_runs/callab_tests.py +++ b/tests/test_reference_runs/callab_tests.py @@ -889,7 +889,7 @@ automated_test_config = { "control-template": "GOTTHARD2_CTRL", "input-source-affixes": ["MASTER", "SLAVE"], "input-source-template": "{karabo_id}/DET/GOTTHARD2_{input_source_affixes}:daqOutput", - "output-source-template": "{karabo_id}/CORR/GH200:daqOutput", + "output-source-template": "{karabo_id}/CORR/GOTTHARD_RECEIVER:daqOutput", "run": "31", "karabo-id": "SA1_XTD9_HIREX", "no-offset-correction": True, -- GitLab