From 0d696e74e8bb47186f3a95c7aba8b6e8be456c25 Mon Sep 17 00:00:00 2001 From: Philipp Schmidt <philipp.schmidt@xfel.eu> Date: Tue, 6 Jul 2021 14:17:24 +0200 Subject: [PATCH] Minor fixes in AGIPD dark notebook and agipblib --- notebooks/AGIPD/Characterize_AGIPD_Gain_Darks_NBC.ipynb | 6 +++++- src/cal_tools/agipdlib.py | 6 +++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/notebooks/AGIPD/Characterize_AGIPD_Gain_Darks_NBC.ipynb b/notebooks/AGIPD/Characterize_AGIPD_Gain_Darks_NBC.ipynb index 595657407..565947c2d 100644 --- a/notebooks/AGIPD/Characterize_AGIPD_Gain_Darks_NBC.ipynb +++ b/notebooks/AGIPD/Characterize_AGIPD_Gain_Darks_NBC.ipynb @@ -186,7 +186,11 @@ "else:\n", " print(f'Something is clearly wrong; slow data indicates gain modes {run_gain_modes}')\n", "\n", - "integration_time = get_integration_time(fn, h5path_ctrl)\n", + "integration_times = [get_integration_time(fn, h5path_ctrl) for fn in control_names]\n", + "if len(set(integration_times)) > 1:\n", + " print(f'WARNING: integration time is not constant across the specified dark runs')\n", + "\n", + "integration_time = integration_times[0]\n", "\n", "print(f\"Detector in use is {karabo_id}\")\n", "print(f\"Instrument {instrument}\")\n", diff --git a/src/cal_tools/agipdlib.py b/src/cal_tools/agipdlib.py index 94a908fe5..c5a51c2ec 100644 --- a/src/cal_tools/agipdlib.py +++ b/src/cal_tools/agipdlib.py @@ -176,10 +176,10 @@ def get_integration_time(fname: str, h5path_ctrl: str) -> int: :return: integration time """ h5path_run = h5path_ctrl.replace('CONTROL/', 'RUN/', 1) - h5path_gainmode = f'{h5path_run}/integrationTime/value' + h5path_time = f'{h5path_run}/integrationTime/value' with h5py.File(fname, 'r') as fd: - if h5path_gainmode in fd: - return int(fd[h5path_gainmode][0]) + if h5path_time in fd: + return int(fd[h5path_time][0]) return 12 -- GitLab