Skip to content

Commit

Permalink
Merge pull request #297 from lsst/tickets/DM-48945
Browse files Browse the repository at this point in the history
DM-48945: Remove postLinearFit intercept from linearity residual computation.
  • Loading branch information
erykoff authored Feb 14, 2025
2 parents e51c0c8 + 00b95d7 commit 6cb8c26
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 5 additions & 1 deletion python/lsst/cp/pipe/cpLinearitySolve.py
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,11 @@ def run(self, inputPtc, dummy, camera, inputDims,
linearizeModel[mask],
funcPolynomial,
)
residuals = linearizeModel - (postLinearFit[0] + postLinearFit[1] * inputAbscissa)
# When computing residuals, we only care about the slope of
# the postLinearFit and not the intercept. The intercept
# itself depends on a possibly unknown zero in the abscissa
# (often photodiode) which may have an arbitrary value.
residuals = linearizeModel - (postLinearFit[1] * inputAbscissa)
# We set masked residuals to nan.
residuals[~mask] = np.nan

Expand Down
7 changes: 2 additions & 5 deletions tests/test_linearity.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,12 +465,9 @@ def _check_linearity_spline(
np.testing.assert_array_equal(lin_mask[outlier_indices], False)

# Check the turnoff and max values.

# The first point at very low flux is noisier and so we exclude
# it from the test here.
resid_atol = 1.1e-3
resid_atol = 4e-4
self.assertFloatsAlmostEqual(
(linearizer.fitResiduals[amp_name][lin_mask] / mu_linear[lin_mask])[1:],
linearizer.fitResiduals[amp_name][lin_mask] / mu_linear[lin_mask],
0.0,
atol=resid_atol,
)
Expand Down

0 comments on commit 6cb8c26

Please sign in to comment.