From 3863892a45a7a41e9cbeade7e25c14c19cae9177 Mon Sep 17 00:00:00 2001 From: Bryan Hilbert Date: Mon, 1 Jul 2024 09:40:43 -0400 Subject: [PATCH] Add kw to allow flagging of pix below median --- src/snowblind/rc_selfcal.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/snowblind/rc_selfcal.py b/src/snowblind/rc_selfcal.py index 2b8f171..8fac25f 100644 --- a/src/snowblind/rc_selfcal.py +++ b/src/snowblind/rc_selfcal.py @@ -31,6 +31,7 @@ class RcSelfCalStep(Step): save_mask = boolean(default=False) # write out per-detector bad-pixel masks output_use_model = boolean(default=True) output_use_index = boolean(default=False) + flag_low_signal_pix = boolean(default=False) """ class_alias = "rc_selfcal" @@ -93,7 +94,10 @@ def create_hotpixel_mask(self, image_stack): warnings.filterwarnings(action="ignore", message="Input data contains invalid values") _, med, std = sigma_clipped_stats(median2d, mask_value=np.nan) + mask = median2d > med + self.threshold * std - # mask |= median2d < med - self.threshold * std + if self.flag_low_signal_pix: + self.log.info(f"Flagging pixels {self.threshold}-sigma below median as well as those above.") + mask |= median2d < med - self.threshold * std return mask, median2d