From a0b7bcaa569400c0e30068748a600cd0b2a90021 Mon Sep 17 00:00:00 2001 From: Eli Rykoff Date: Wed, 23 Oct 2024 13:26:37 -0700 Subject: [PATCH] Add high flux linearity constraint to avoid craziness. --- python/lsst/cp/pipe/utils.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/python/lsst/cp/pipe/utils.py b/python/lsst/cp/pipe/utils.py index ce4bf4cb..b541f7d8 100644 --- a/python/lsst/cp/pipe/utils.py +++ b/python/lsst/cp/pipe/utils.py @@ -1339,7 +1339,14 @@ def __call__(self, pars): log_w = np.sqrt(-2.*np.log(fact*self._w[self._w > 0])) constraint = np.hstack([constraint, log_w]) - return np.hstack([resid, constraint]) + # Don't let it get to >5% correction. + values = pars[self.par_indices["values"]] + if np.abs(values[-1])/self._nodes[-1] > 0.25: + extra_constraint = 1e10 + else: + extra_constraint = 0 + + return np.hstack([resid, constraint, extra_constraint]) def getReadNoise(exposure, ampName, taskMetadata=None, log=None):