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

isr: mark amp as bad if entirely saturated #58

Merged
merged 1 commit into from Feb 27, 2017
Merged

Conversation

PaulPrice
Copy link
Contributor

If the amp is completely saturated, overscan subtraction may fail.

afwImage.PARENT)
maskVal = ampMask.getPlaneBitMask([self.config.saturatedMaskName, self.config.suspectMaskName])
if numpy.all(ampMask.getArray() & maskVal > 0):
badAmp = True
if self.config.doOverscan and not badAmp:
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure I understand the logic here. maskVal evaluates to 130 (2 for SAT and 128 for SUSPECT), but why are you checking that this evaluates to > 0 (and within the numpy.all() call)?

What is the nature of the "failure" in the overscan subtraction? You are testing for an entirely saturated amp. Is it true that it is guaranteed not to fail if, say, a single pixel is not saturated (but the rest are)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The > 0 converts the ampMask.getArray() & maskVal to a boolean array, which allows use of numpy.all to see if all the values are True.

I think the overscan subtraction fails because the array it's trying to fit with a spline is empty.

I haven't seen the case of a single unsaturated pixel, but I have seen failures when the amp is entirely saturated. I suggest we can whack that mole if it pops up.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks to @RobertLuptonTheGood for a detailed explanation of the bitwise operator...I now understand what's going on! He also suggests it may be safer to put parentheses around this operation: numpy.all((ampMask.getArray() & maskVal) > 0)

Copy link
Contributor

Choose a reason for hiding this comment

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

And my example of a single unsaturated pixel was an extreme, but I was wondering if it would be better to put a threshold of some sort on calling it a badAmp (e.g. if > threshold% of all pixels are saturated and/or suspect, throw in the towel and call it bad). No need to address that here, but could be something to keep in mind if it ever pops up in practice.

If the amp is completely saturated, overscan subtraction may fail.
@PaulPrice PaulPrice merged commit 2677234 into master Feb 27, 2017
@ktlim ktlim deleted the tickets/DM-9476 branch August 25, 2018 06:45
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