Skip to content

Commit

Permalink
Merge pull request #313 from lsst/tickets/DM-42982
Browse files Browse the repository at this point in the history
DM-42982: IsrTask.defineEffectivePtc warns in all(?) cases
  • Loading branch information
plazas committed Mar 6, 2024
2 parents 5923ed5 + b1c999f commit 8c67aea
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion python/lsst/ip/isr/isrTask.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

import math
import numpy
import numbers

import lsst.geom
import lsst.afw.image as afwImage
Expand Down Expand Up @@ -1860,7 +1861,7 @@ def defineEffectivePtc(self, ptcDataset, detector, bfGains, overScans, metadata)
noise = overscanResults.residualSigma[0]
elif self.config.usePtcReadNoise:
# Try then with the PTC noise.
noise = ptcDataset.noise[amp.getName()]
noise = ptcDataset.noise[ampName]
noiseProvenanceString = "ptc"
self.log.debug("Using noise from Photon Transfer Curve.")
else:
Expand All @@ -1881,6 +1882,19 @@ def defineEffectivePtc(self, ptcDataset, detector, bfGains, overScans, metadata)
ampName, gain, patchedGain)
gain = patchedGain

# PTC Turnoff:
# Copy it over from the input PTC if it's positive. If it's a nan
# set it to a high value.
if ptcDataset is not None:
ptcTurnoff = ptcDataset.ptcTurnoff[ampName]
else:
ptcTurnoff = 2e19

if (isinstance(ptcTurnoff, numbers.Real) and ptcTurnoff > 0):
effectivePtc.ptcTurnoff[ampName] = ptcTurnoff
elif math.isnan(ptcTurnoff):
effectivePtc.ptcTurnoff[ampName] = 2e19

effectivePtc.gain[ampName] = gain
effectivePtc.noise[ampName] = noise
# Make sure noise,turnoff, and gain make sense
Expand Down

0 comments on commit 8c67aea

Please sign in to comment.