Skip to content
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-32470: Dark verification in OCPS calibration script from DM-31897 fails because NOISe is too low with respect nominal readnoise #9

Merged
merged 3 commits into from Nov 18, 2021

Conversation

czwa
Copy link
Collaborator

@czwa czwa commented Nov 15, 2021

This change adds the possibility of pulling values from the task metadata. This code path is then used to pull the measured scatter in the overscan as an estimate the read noise. This should resolve the issue of the camera read noise not matching the quoted camera value.

@czwa czwa requested a review from plazas November 15, 2021 20:33
@@ -37,6 +37,7 @@ def setDefaults(self):
'NOISE': 'STDEVCLIP', }

self.crImageStatKeywords = {'CR_NOISE': 'STDEV', } # noqa F841
self.metadataStatKeywords = {'RESIDUAL STDEV': 'AMP', } # noqa F841
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other keys, such as CR_NOISE, have _ in between words. Would it be better to also add an underscore here to be consistent?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comes from a choice in ip_isr. I wanted to keep changes out of that. I had thought about moving this from the task metadata to the exposure metadata, and then making the metadata stats code look there instead of the task metadata (removing that connection). However, this wouldn't be available for previously processed data, and so there'd always be two versions.

This was a design decision, and I'm still not sure I made the right one.

amp = detector[ampName]
verify['NOISE'] = bool(np.abs(stats['NOISE'] - amp.getReadNoise())/amp.getReadNoise() <= 0.05)
readNoise = detector[ampName].getReadNoise()
if 'RESIDUAL STDEV' in metadataStats and ampName in metadataStats['RESIDUAL STDEV']:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add a comment here, or above, explaining RESIDUAL STDEV more? For example, saying that it is the standard deviation of the overscan region after the overscan has been removed., and that this should be identical to the true read noise (according to an explanation I got from you once). This given that the name doesn't seem to be that descriptive.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Explanation added here and in verifyDark. Minor differences also removed in that check (dark checked that overscanReadNoise was found, bias did not).

verify['NOISE'] = bool(np.abs(stats['NOISE'] - amp.getReadNoise())/amp.getReadNoise() <= 0.05)
readNoise = detector[ampName].getReadNoise()
if 'RESIDUAL STDEV' in metadataStats and ampName in metadataStats['RESIDUAL STDEV']:
overscanReadNoise = metadataStats['RESIDUAL STDEV'][ampName]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, here you assign the per amp RESIDUAL STDEV to a variable with a more descriptive name, but maybe a comment would still be good.

if verify['SUCCESS'] is False:
success = False
# This isn't something to fail on yet.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So should this actually be a TODO with an associated ticket, or should we provide more information? I'm trying to think of our future selves when we come back to this part of the code and wonder about this (i.e., when/if should we fail on this?)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've updated the comment. I think we would only want to fail on this if we implement versioned cameras.

amp = detector[ampName]
verify['NOISE'] = bool(np.abs(stats['NOISE'] - amp.getReadNoise())/amp.getReadNoise() <= 0.05)
readNoise = detector[ampName].getReadNoise()
if 'RESIDUAL STDEV' in metadataStats and ampName in metadataStats['RESIDUAL STDEV']:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comments in this "Dark" file as in the "Bias" one

"""Calculate quality statistics and verify they meet the requirements
for a calibration.

Parameters
----------
inputExp : `lsst.afw.image.Exposure`
The ISR processed exposure to be measured.
taskMetadata : `lsst.daf.base.PropertySet`, optional
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is RESIDUAL STDEV the only statistic from the metadata that we currently use? Are there any other statistics in the metadata that could be useful? Where would we need to look if we wanted to see all the contents of this metadata object to see if there's something else that might be useful?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's produced by IsrTask, and contains a variety of per-amp measurements at different stages of processing. It also holds some statistics about the overscan. It's stored there because when I reworked the task, I wanted to save some of the information that we were measuring that wasn't being saved anywhere. This gets back to the design decision comment above; it's probably worth thinking about if this information should be written to the exposure metadata as well.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can discuss this more in one of our meetings, especially if we decide that we want to use these statistics as stability metrics or something like that. In the end, I'm just concerned about 1) are we saving potentially useful information in this metadata, 2) if so, how can we easily access it for plotting/use/further analysis?

Copy link
Contributor

@plazas plazas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look good, thank you for working on this fix. Some clarifications requested

@czwa czwa merged commit 2204bfb into master Nov 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants