From 9f21c736cc88d0d3aa8417edea89152ca86d49e2 Mon Sep 17 00:00:00 2001 From: John Parejko Date: Mon, 16 Jun 2025 16:15:34 -0700 Subject: [PATCH 1/2] Add error handling for missing errorbars --- python/lsst/ip/diffim/dipoleFitTask.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/python/lsst/ip/diffim/dipoleFitTask.py b/python/lsst/ip/diffim/dipoleFitTask.py index 45444a606..b7a63b5ac 100644 --- a/python/lsst/ip/diffim/dipoleFitTask.py +++ b/python/lsst/ip/diffim/dipoleFitTask.py @@ -862,6 +862,9 @@ def fitDipole(self, source, tol=1e-7, rel_weight=0.1, # usually around 0.1 -- the minimum flux allowed -- i.e. bad fit. if fitResult.params['flux'].value <= 1.: + if not fitResult.result.errorbars: + self.log.debug("Could not estimate error bars for id=%d; ModelResult.message='%s'", + source["id"], fitResult.message) return None, fitResult # TODO: We could include covariances, which could be derived from From 0113708d59cbca1359104b333bda5575bf4848c6 Mon Sep 17 00:00:00 2001 From: John Parejko Date: Mon, 16 Jun 2025 16:15:49 -0700 Subject: [PATCH 2/2] Improve logging for unphysical flux failures --- python/lsst/ip/diffim/dipoleFitTask.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/python/lsst/ip/diffim/dipoleFitTask.py b/python/lsst/ip/diffim/dipoleFitTask.py index b7a63b5ac..a8f1b28b4 100644 --- a/python/lsst/ip/diffim/dipoleFitTask.py +++ b/python/lsst/ip/diffim/dipoleFitTask.py @@ -862,6 +862,9 @@ def fitDipole(self, source, tol=1e-7, rel_weight=0.1, # usually around 0.1 -- the minimum flux allowed -- i.e. bad fit. if fitResult.params['flux'].value <= 1.: + self.log.debug("Fitted flux too small for id=%d; ModelResult.message='%s'", + source["id"], fitResult.message) + return None, fitResult if not fitResult.result.errorbars: self.log.debug("Could not estimate error bars for id=%d; ModelResult.message='%s'", source["id"], fitResult.message)