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-8982: Incorrect binning in overscan spline interpolation #25

Merged
merged 2 commits into from Jan 13, 2017

Conversation

PaulPrice
Copy link
Contributor

No description provided.

The binning was incorrect in the presence of masked rows, which
could cause the ordinate to be non-monotonic increasing, resulting
in an exception. The problem was that the masking wasn't being
applied in the binning, but it was in the scaling (the 'numBins'
vector).
This helps us identify what was clipped.
@@ -345,6 +345,8 @@ def overscanCorrection(ampMaskedImage, overscanImage, fitType='MEDIAN', order=1,
diff = numpy.abs(biasArray - medianBiasArr[:, numpy.newaxis])
biasMaskedArr = numpy.ma.masked_where(diff > collapseRej*stdevBiasArr[:, numpy.newaxis], biasArray)
collapsed = numpy.mean(biasMaskedArr, axis=1)
if collapsed.mask.sum() > 0:
collapsed.data[collapsed.mask] = numpy.mean(biasArray.data[collapsed.mask], axis=1)
Copy link
Contributor

Choose a reason for hiding this comment

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

I realize you are adding the original values back into the masked pixels in order to plot them below, but might this be a gotcha for anyone later using collapsed.data and expecting the non-modified values? I'm not familiar with the object here, so am not sure what the masked pixels would've been assigned in collapsed.data, so forgive my naïveté if this is a non-issue!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Without this change, the masked pixels have a value of zero and are therefore useless.

Copy link
Contributor

Choose a reason for hiding this comment

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

That's sort of my point, i.e. someone expecting a value of zero in collapsed.data for masked pixels (I don't imagine a use case here...but you never know!)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't know why someone would want a zero value for masked pixels, except for my particular use of this below! I use collapsed.data*~collapsedMask, which provides exactly that (collapsedMask is True for bad pixels). So the possibility is still there just in case.

@PaulPrice PaulPrice merged commit 4e287d2 into master Jan 13, 2017
@ktlim ktlim deleted the tickets/DM-8982 branch August 25, 2018 06:44
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