From 6ccdf587a7e059b1333115ea394800787e3bebbf Mon Sep 17 00:00:00 2001 From: Philipp Schmidt <philipp.schmidt@xfel.eu> Date: Wed, 6 Oct 2021 13:12:17 +0200 Subject: [PATCH] Only use bad pixels from darks in agipdutils.baseline_correct_via_stripes --- src/cal_tools/agipdutils.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/cal_tools/agipdutils.py b/src/cal_tools/agipdutils.py index 280f07324..a5d7cb628 100644 --- a/src/cal_tools/agipdutils.py +++ b/src/cal_tools/agipdutils.py @@ -135,6 +135,16 @@ def baseline_correct_via_stripe(d, g, m, frac_high_med): :param m: bad pixel mask """ + # Restrict the mask to those bad pixels obtained from darks. + # This has ben introduced since the BadPixelsFF constants can add + # additional masking that causes the baseline correction to fail due + # to the abort conditions len(idx) < 3 below. + # (see calibration/planning#96) + m = m & (BadPixels.OFFSET_OUT_OF_THRESHOLD | + BadPixels.NOISE_OUT_OF_THRESHOLD | + BadPixels.OFFSET_NOISE_EVAL_ERROR | + BadPixels.NO_DARK_DATA) + dd = copy.copy(d) dd[g != 0] = np.nan # only high gain data dd[m != 0] = np.nan # only good pixels -- GitLab