From 89b128d7bb2015f824774138a36f7aaaa77d9872 Mon Sep 17 00:00:00 2001 From: Meredith Rawls Date: Mon, 30 Jun 2025 23:01:57 -0700 Subject: [PATCH] Catch another flavor of PSF fail in maglim calculation --- python/lsst/ip/diffim/subtractImages.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/python/lsst/ip/diffim/subtractImages.py b/python/lsst/ip/diffim/subtractImages.py index d01b53eda..b8160d6ff 100644 --- a/python/lsst/ip/diffim/subtractImages.py +++ b/python/lsst/ip/diffim/subtractImages.py @@ -668,10 +668,14 @@ def _calculateMagLim(self, exposure, nsigma=5.0, fallbackPsfSize=None): """ if exposure.photoCalib is None: return np.nan + # Set maglim to nan upfront in case on an unexpected RuntimeError + maglim = np.nan try: psf = exposure.getPsf() psf_shape = psf.computeShape(psf.getAveragePosition()) - except (lsst.pex.exceptions.InvalidParameterError, afwDetection.InvalidPsfError): + except (lsst.pex.exceptions.InvalidParameterError, + afwDetection.InvalidPsfError, + lsst.pex.exceptions.RangeError): if fallbackPsfSize is not None: self.log.info("Unable to evaluate PSF, using fallback FWHM %f", fallbackPsfSize) psf_area = np.pi*(fallbackPsfSize/2)**2