From 34463e5dc7ebb8a3144949e2c8cf5823b74001df Mon Sep 17 00:00:00 2001 From: ahmedk <karim.ahmed@xfel.eu> Date: Thu, 12 Oct 2023 22:09:50 +0200 Subject: [PATCH] Update docstrings and update input argument for AgipdCtrlRuns --- .../Characterize_AGIPD_Gain_Darks_NBC.ipynb | 2 +- src/cal_tools/agipdlib.py | 26 ++++++++++++------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/notebooks/AGIPD/Characterize_AGIPD_Gain_Darks_NBC.ipynb b/notebooks/AGIPD/Characterize_AGIPD_Gain_Darks_NBC.ipynb index f7d895b82..2bd52013e 100644 --- a/notebooks/AGIPD/Characterize_AGIPD_Gain_Darks_NBC.ipynb +++ b/notebooks/AGIPD/Characterize_AGIPD_Gain_Darks_NBC.ipynb @@ -109,7 +109,7 @@ "\n", "import iCalibrationDB\n", "import matplotlib.pyplot as plt\n", - "from cal_tools.agipdlib import AgipdCtrl, AgipdCtrlRuns\n", + "from cal_tools.agipdlib import AgipdCtrlRuns\n", "from cal_tools.enums import BadPixels\n", "from cal_tools.plotting import (\n", " create_constant_overview,\n", diff --git a/src/cal_tools/agipdlib.py b/src/cal_tools/agipdlib.py index 078a6c4ad..d743044f1 100644 --- a/src/cal_tools/agipdlib.py +++ b/src/cal_tools/agipdlib.py @@ -31,7 +31,7 @@ from cal_tools.h5_copy_except import h5_copy_except_paths @dataclass class AgipdCtrl: - """Initialize AgipdCondition class to read all required AGIPD parameters. + """Access AGIPD control parameters from a single run. Args: run_dc (DataCollection): Run data collection with expected sources @@ -295,18 +295,26 @@ class AgipdCtrl: @dataclass class AgipdCtrlRuns: + """Get AGIPD control parameters across several runs, + e.g. 3 runs for darks. + + Args: + raw_folder (str): The RAW folder path. + runs (list): The list of runs to read the operating conditions. + image_src (str): H5 source for image data. + ctrl_src (str): H5 source for control (slow) data. + """ raw_folder: str runs: List[int] image_src: str ctrl_src: str - adaptive_gain_modes: List[AgipdGainMode] = field( - default_factory=lambda: [AgipdGainMode.ADAPTIVE_GAIN] * 3) - fixed_gain_modes: List[AgipdGainMode] = field( - default_factory=lambda: [ - AgipdGainMode.FIXED_HIGH_GAIN, - AgipdGainMode.FIXED_MEDIUM_GAIN, - AgipdGainMode.FIXED_LOW_GAIN, - ]) + + adaptive_gain_modes = [AgipdGainMode.ADAPTIVE_GAIN] * 3 + fixed_gain_modes = [ + AgipdGainMode.FIXED_HIGH_GAIN, + AgipdGainMode.FIXED_MEDIUM_GAIN, + AgipdGainMode.FIXED_LOW_GAIN, + ] def __post_init__(self): # validate that all runs belong to the same -- GitLab