-
Notifications
You must be signed in to change notification settings - Fork 7
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-36358: "broken" amplifiers trigger a failure in setting the threshold for defects #155
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,7 @@ | |
from lsst.geom import Box2I, Point2I | ||
from lsst.meas.algorithms import SourceDetectionTask | ||
from lsst.ip.isr import Defects, countMaskedPixels | ||
from lsst.pex.exceptions import InvalidParameterError | ||
|
||
from ._lookupStaticCalibration import lookupStaticCalibration | ||
|
||
|
@@ -246,7 +247,15 @@ def findHotAndColdPixels(self, exp, nSigma): | |
|
||
threshold = afwDetection.createThreshold(nSig, 'stdev', polarity=polarity) | ||
|
||
footprintSet = afwDetection.FootprintSet(ampImg, threshold) | ||
try: | ||
footprintSet = afwDetection.FootprintSet(ampImg, threshold) | ||
except InvalidParameterError: | ||
# This occurs if the image sigma value is 0.0. | ||
# Let's mask the whole area. | ||
minValue = np.nanmin(ampImg.image.array) - 1.0 | ||
threshold = afwDetection.createThreshold(minValue, 'value', polarity=True) | ||
footprintSet = afwDetection.FootprintSet(ampImg, threshold) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems like a pretty complicated (and expensive) way to create a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think I got lost in the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. After coding this and sending to Jenkins, I'm now discovering that the box definition only sets the region, and does not create a footprint set containing footprints that can be used to mask the image. |
||
|
||
footprintSet.setMask(maskedIm.mask, ("DETECTED" if polarity else "DETECTED_NEGATIVE")) | ||
|
||
if mergedSet 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.
Is there any other way this could happen? Testing exceptions should be the last resort. Can't the
threshold
value be checked?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.
The
threshold
itself is fine. It's the image sigma value coming out as zero that causes theInvalidParameterError
. Manually calculating the image statistics seemed to be less efficient than doing the try/except, as most amplifiers should work fine.