From 9cd9fa03d59aed9a6e6b997a92d992a28f645117 Mon Sep 17 00:00:00 2001 From: Ian Sullivan Date: Thu, 5 Dec 2024 19:22:52 -0800 Subject: [PATCH] Add configurable limit on the number of streak fitting iterations --- python/lsst/meas/algorithms/maskStreaks.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/python/lsst/meas/algorithms/maskStreaks.py b/python/lsst/meas/algorithms/maskStreaks.py index ab92892b..f7684a22 100644 --- a/python/lsst/meas/algorithms/maskStreaks.py +++ b/python/lsst/meas/algorithms/maskStreaks.py @@ -473,6 +473,12 @@ class MaskStreaksConfig(pexConfig.Config): dtype=float, default=0.1 ) + maxFitIter = pexConfig.Field( + doc="Maximum number of line profile fitting iterations that is " + "acceptable for convergence", + dtype=int, + default=100 + ) detectedMaskPlane = pexConfig.Field( doc="Name of mask with pixels above detection threshold, used for first" "estimate of streak locations", @@ -758,7 +764,8 @@ def _fitProfile(self, lines, maskedImage): if lineModel.lineMaskSize == 0: continue - fit, fitFailure = lineModel.fit(dChi2Tol=self.config.dChi2Tolerance, log=self.log) + fit, fitFailure = lineModel.fit(dChi2Tol=self.config.dChi2Tolerance, log=self.log, + maxIter=self.config.maxFitIter) # Initial estimate should be quite close: fit is deemed unsuccessful if rho or theta # change more than the allowed bin in rho or theta: