Skip to content

Commit

Permalink
Do not raise in updateVariance if all pixels are bad.
Browse files Browse the repository at this point in the history
  • Loading branch information
czwa committed Sep 9, 2022
1 parent 078d980 commit d16831d
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion python/lsst/ip/isr/isrTask.py
Original file line number Diff line number Diff line change
Expand Up @@ -1839,7 +1839,17 @@ def updateVariance(self, ampExposure, amp, overscanImage=None, ptcDataset=None):
gain = patchedGain

if self.config.doEmpiricalReadNoise and overscanImage is None:
raise RuntimeError("Overscan is none for EmpiricalReadNoise.")
badPixels = isrFunctions.countMaskedPixels(ampExposure.getMaskedImage(),
[self.config.saturatedMaskName,
self.config.suspectMaskName,
"BAD", "NO_DATA"])
allPixels = ampExposure.getWidth() * ampExposure.getHeight()
if allPixels == badPixels:
# If the image is bad, do not raise.
self.log.info("Skipping empirical read noise for amp %s. No good pixels.",
amp.getName())
else:
raise RuntimeError("Overscan is none for EmpiricalReadNoise.")

if self.config.doEmpiricalReadNoise and overscanImage is not None:
stats = afwMath.StatisticsControl()
Expand Down

0 comments on commit d16831d

Please sign in to comment.