From e9cb12fbdb1d351a268fb1eafd157270f03be139 Mon Sep 17 00:00:00 2001 From: Liam Gray Date: Wed, 15 May 2024 12:15:54 -0700 Subject: [PATCH] feat(flagging): restrict uncorrected rebinned data from blending --- draco/analysis/flagging.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/draco/analysis/flagging.py b/draco/analysis/flagging.py index 87939921c..00e64896c 100644 --- a/draco/analysis/flagging.py +++ b/draco/analysis/flagging.py @@ -2298,10 +2298,16 @@ def process(self, data): The modified data. This is the same object as the input, and it has been modified in place. """ - if type(self.data_stack) != type(data): + if "effective_ra" in data.datasets: + raise TypeError( + "Blending uncorrected rebinned data not supported. " + "Please apply a correction such as `sidereal.RebinGradientCorrection." + ) + + if not isinstance(data, type(self.data_stack)): raise TypeError( f"type(data) (={type(data)}) must match" - f"type(data_stack) (={type(self.type)}" + f"type(data_stack) (={type(self.data_stack)}" ) # Try and get both the stack and the incoming data to have the same