Skip to content

Commit

Permalink
Merge branch 'tickets/DM-38044'
Browse files Browse the repository at this point in the history
  • Loading branch information
czwa committed Feb 20, 2023
2 parents 9496bed + 37ac033 commit 925ef49
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
29 changes: 20 additions & 9 deletions python/lsst/ip/isr/isrTask.py
Original file line number Diff line number Diff line change
Expand Up @@ -1341,18 +1341,29 @@ def run(self, ccdExposure, *, camera=None, bias=None, linearizer=None,
self.log.debug("Corrected overscan for amplifier %s.", amp.getName())
if overscanResults is not None and \
self.config.qa is not None and self.config.qa.saveStats is True:

self.metadata[f"FIT MEDIAN {amp.getName()}"] = overscanResults.overscanMean
self.metadata[f"FIT STDEV {amp.getName()}"] = overscanResults.overscanSigma
if isinstance(overscanResults.overscanMean, float):
# Only serial overscan was run
mean = overscanResults.overscanMean
sigma = overscanResults.overscanSigma
residMean = overscanResults.residualMean
residSigma = overscanResults.residualSigma
else:
# Both serial and parallel overscan were
# run. Only report serial here.
mean = overscanResults.overscanMean[0]
sigma = overscanResults.overscanSigma[0]
residMean = overscanResults.residualMean[0]
residSigma = overscanResults.residualSigma[0]

self.metadata[f"FIT MEDIAN {amp.getName()}"] = mean
self.metadata[f"FIT STDEV {amp.getName()}"] = sigma
self.log.debug(" Overscan stats for amplifer %s: %f +/- %f",
amp.getName(), overscanResults.overscanMean,
overscanResults.overscanSigma)
amp.getName(), mean, sigma)

self.metadata[f"RESIDUAL MEDIAN {amp.getName()}"] = overscanResults.residualMean
self.metadata[f"RESIDUAL STDEV {amp.getName()}"] = overscanResults.residualSigma
self.metadata[f"RESIDUAL MEDIAN {amp.getName()}"] = residMean
self.metadata[f"RESIDUAL STDEV {amp.getName()}"] = residSigma
self.log.debug(" Overscan stats for amplifer %s after correction: %f +/- %f",
amp.getName(), overscanResults.residualMean,
overscanResults.residualSigma)
amp.getName(), residMean, residSigma)

ccdExposure.getMetadata().set('OVERSCAN', "Overscan corrected")
else:
Expand Down
3 changes: 3 additions & 0 deletions tests/test_isrTask.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ class IsrTaskTestCases(lsst.utils.tests.TestCase):
"""
def setUp(self):
self.config = IsrTaskConfig()
self.config.overscan.doParallelOverscan = True
self.config.qa = IsrQaConfig()
self.task = IsrTask(config=self.config)
self.camera = isrMock.IsrMock().getCamera()
Expand Down Expand Up @@ -216,6 +217,7 @@ class IsrTaskUnTrimmedTestCases(lsst.utils.tests.TestCase):
"""
def setUp(self):
self.config = IsrTaskConfig()
self.config.overscan.doParallelOverscan = True
self.config.qa = IsrQaConfig()
self.task = IsrTask(config=self.config)

Expand Down Expand Up @@ -342,6 +344,7 @@ def test_maskingCase_negativeVariance(self):
"""Test masking cases of configuration parameters.
"""
self.batchSetConfiguration(True)
self.config.overscan.doParallelOverscan = False
self.config.overscan.fitType = "POLY"
self.config.overscan.order = 1

Expand Down

0 comments on commit 925ef49

Please sign in to comment.