From 5787596b6ebe171013339479b1b895d253d7e44d Mon Sep 17 00:00:00 2001 From: Ismael Mendoza Date: Wed, 17 Apr 2024 10:27:40 -0400 Subject: [PATCH] more error catching --- btk/deblend.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/btk/deblend.py b/btk/deblend.py index d85098f6..0951b21a 100644 --- a/btk/deblend.py +++ b/btk/deblend.py @@ -396,6 +396,12 @@ def deblend(self, ii: int, blend_batch: BlendBatch) -> DeblendExample: band_image, self.thresh, err=bkg.globalrms, segmentation_map=False ) + if len(catalog) > self.max_n_sources: + raise ValueError( + "SEP predicted more sources than `max_n_sources`. Consider increasing `thresh`" + " or `max_n_sources`." + ) + # convert predictions to arcseconds ra_detections, dec_detections = wcs.pixel_to_world_values(catalog["x"], catalog["y"]) ra_detections *= 3600