New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DM-37554: Check that ISR usage of gains is consistent #282
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few minor rearrangement suggestions. I'm happy to take a second look afterwards if you think it's needed.
python/lsst/ip/isr/isrTask.py
Outdated
Parameters | ||
------ | ||
ptcDataset : `lsst.ip.isr.PhotonTransferCurveDataset` | ||
Inout Photon Transfer Curve dataset. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo.
python/lsst/ip/isr/isrTask.py
Outdated
# Try first with the PTC gains. | ||
gainProvenanceString = "amp" | ||
if self.config.usePtcGains: | ||
if ptcDataset is None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you move this check to ~L1348, with the other checks for if doX and X is None
? If the config doesn't match what was supplied, it's better to raise early.
python/lsst/ip/isr/isrTask.py
Outdated
else: | ||
# Try then with the amplifier gain. | ||
# We already have a detector at this point. If there was no | ||
# detector to beging with, one would have been created with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo.
python/lsst/ip/isr/isrTask.py
Outdated
noise = overscanResults.residualSigma[0] | ||
elif self.config.usePtcReadNoise: | ||
# Try then with the PTC noise. | ||
if ptcDataset is None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With my suggestion above, I think this just goes away.
python/lsst/ip/isr/isrTask.py
Outdated
else: | ||
# Finally, try with the amplifier noise. | ||
# We already have a detector at this point. If there | ||
# was no detector to beging with, one would have |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same typo.
python/lsst/ip/isr/isrTask.py
Outdated
# self.config.noise. | ||
noise = amp.getReadNoise() | ||
|
||
self.log.info("%s - Noise provenance: %s, Gain provenance: %s", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this (and the metadata entries) can be pulled out of the loop. All amps should follow the same logic, so all amps should have the same provenance, right?
python/lsst/ip/isr/isrTask.py
Outdated
|
||
# At this point, the effective PTC should have | ||
# gain and noise values. | ||
gain = ptcDataset.gain[ampName] | ||
if math.isnan(gain): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this be moved to the effectivePtc method? It's here because this was historically the first use, but keeping all of the logic in one place is simpler.
python/lsst/ip/isr/isrTask.py
Outdated
|
||
metadata = ampExposure.getMetadata() | ||
metadata[f'LSST GAIN {amp.getName()}'] = gain | ||
metadata[f'LSST READNOISE {amp.getName()}'] = readNoise | ||
metadata[f"LSST GAIN {amp.getName()}"] = gain |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same with these metadata updates. It's only here for historical reasons.
python/lsst/ip/isr/isrTask.py
Outdated
|
||
isrFunctions.updateVariance( | ||
maskedImage=ampExposure.getMaskedImage(), | ||
gain=gain, | ||
readNoise=readNoise, | ||
) | ||
|
||
# isrFunctions.updateVariance applied the gain. | ||
# Update the units. | ||
metadata["LSST ISR UNITS"] = 'electrons' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is true. The image units didn't change.
79eb980
to
3d10c46
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this does the right thing now. I'm happy if Jenkins is happy.
@@ -774,3 +775,33 @@ def getGoodPoints(self, ampName): | |||
Boolean array of good points used in PTC. | |||
""" | |||
return self.expIdMask[ampName] | |||
|
|||
def validateGainNoiseTurnoffValues(self, ampName): | |||
"""Ensure the gain, read noise, and PTC turnoff have |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docstring, even though it's trivial.
No description provided.