From a255612855c897ff69f3f5e19db8f1a9aef92350 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 a2fbb3466..a3752efc9 100644 --- a/draco/analysis/flagging.py +++ b/draco/analysis/flagging.py @@ -1748,10 +1748,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 isinstance(data, containers.SiderealStreamRebin): + raise TypeError( + "Blending uncorrected rebinned data not supported. " + "Please apply a correction such as `sidereal.BinCentreGradientCorrection." + ) + + 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