From df2671d362b15fa70ca114600a0c245f38791ddc Mon Sep 17 00:00:00 2001 From: David Hammer <dhammer@mailbox.org> Date: Thu, 11 Mar 2021 14:40:51 +0100 Subject: [PATCH] Adding specific threshold parameters for fixed gain mode Currently, there is no way to specify most parameters when requesting darks via MyMDC - values are just loaded from the calibration configurations repository. To allow for using different offset thresholds in fixed gain mode versus adaptive gain mode, adding these extra parameters is a pragmatic if not elegant solution for now. --- .../Characterize_AGIPD_Gain_Darks_NBC.ipynb | 43 ++++++++++++++----- 1 file changed, 32 insertions(+), 11 deletions(-) diff --git a/notebooks/AGIPD/Characterize_AGIPD_Gain_Darks_NBC.ipynb b/notebooks/AGIPD/Characterize_AGIPD_Gain_Darks_NBC.ipynb index db3fee539..eae874835 100644 --- a/notebooks/AGIPD/Characterize_AGIPD_Gain_Darks_NBC.ipynb +++ b/notebooks/AGIPD/Characterize_AGIPD_Gain_Darks_NBC.ipynb @@ -52,10 +52,13 @@ "rawversion = 2 # RAW file format version\n", "\n", "thresholds_offset_sigma = 3. # offset sigma thresholds for offset deduced bad pixels\n", - "thresholds_offset_hard = [0, 0] # For setting the same threshold offset for the 3 gains. Left for backcompatability. Default [0, 0] to take the following parameters.\n", - "thresholds_offset_hard_hg = [3000, 7000] # High-gain thresholds in absolute ADU terms for offset deduced bad pixels\n", - "thresholds_offset_hard_mg = [6000, 10000] # Medium-gain thresholds in absolute ADU terms for offset deduced bad pixels\n", - "thresholds_offset_hard_lg = [6000, 10000] # Low-gain thresholds in absolute ADU terms for offset deduced bad pixels\n", + "thresholds_offset_hard = [0, 0] # For setting the same threshold offset for the 3 gains. Left for backcompatability. Default [0, 0] to take the following parameters.\n", + "thresholds_offset_hard_hg = [3000, 7000] # High-gain thresholds in absolute ADU terms for offset deduced bad pixels\n", + "thresholds_offset_hard_mg = [6000, 10000] # Medium-gain thresholds in absolute ADU terms for offset deduced bad pixels\n", + "thresholds_offset_hard_lg = [6000, 10000] # Low-gain thresholds in absolute ADU terms for offset deduced bad pixels\n", + "thresholds_offset_hard_hg_fixed = [3500, 6500] # Same as thresholds_offset_hard_hg, but for fixed gain operation\n", + "thresholds_offset_hard_mg_fixed = [3500, 6500] # Same as thresholds_offset_hard_mg, but for fixed gain operation\n", + "thresholds_offset_hard_lg_fixed = [3500, 6500] # Same as thresholds_offset_hard_lg, but for fixed gain operation\n", "\n", "thresholds_noise_sigma = 5. # noise sigma thresholds for offset deduced bad pixels\n", "thresholds_noise_hard = [0, 0] # For setting the same threshold noise for the 3 gains. Left for backcompatability. Default [0, 0] to take the following parameters.\n", @@ -273,15 +276,33 @@ "metadata": {}, "outputs": [], "source": [ - "if thresholds_offset_hard == [0, 0]:\n", - " thresholds_offset_hard = [thresholds_offset_hard_hg, thresholds_offset_hard_mg, thresholds_offset_hard_lg]\n", - "else:\n", + "if thresholds_offset_hard != [0, 0]:\n", + " # if set, this will override the individual parameters\n", " thresholds_offset_hard = [thresholds_offset_hard] * 3\n", - "\n", - "if thresholds_noise_hard == [0, 0]:\n", - " thresholds_noise_hard = [thresholds_noise_hard_hg, thresholds_noise_hard_mg, thresholds_noise_hard_lg]\n", + "elif fixed_gain_mode:\n", + " thresholds_offset_hard = [\n", + " thresholds_offset_hard_hg_fixed,\n", + " thresholds_offset_hard_mg_fixed,\n", + " thresholds_offset_hard_lg_fixed,\n", + " ]\n", + "else:\n", + " thresholds_offset_hard = [\n", + " thresholds_offset_hard_hg,\n", + " thresholds_offset_hard_mg,\n", + " thresholds_offset_hard_lg,\n", + " ]\n", + "print(f\"Will use the following hard offset thresholds\")\n", + "for name, value in zip((\"High\", \"Medium\", \"Low\"), thresholds_offset_hard):\n", + " print(f\"- {name} gain: {value}\")\n", + "\n", + "if thresholds_noise_hard != [0, 0]:\n", + " thresholds_noise_hard = [thresholds_noise_hard] * 3\n", "else:\n", - " thresholds_noise_hard = [thresholds_noise_hard] * 3" + " thresholds_noise_hard = [\n", + " thresholds_noise_hard_hg,\n", + " thresholds_noise_hard_mg,\n", + " thresholds_noise_hard_lg,\n", + " ]" ] }, { -- GitLab