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-12979: add y-band stray light removal #103
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.
Broadly looks fine.
I am somewhat nervous about having so much low-level algorithmic code without tests; while that shouldn't block this merge (especially since it's all HSC-specific), we should try to get Mineo-san to write some unit tests for at least the lowest-level code, even if they just compare to persisted results from a reference implementation.
Multi-dimensional forward wavelet transformation | ||
with the Cohen-Daubechies-Feauveau wavelet 9/7 | ||
|
||
@param data (numpy.array) |
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 type is actually numpy.ndarray
(numpy.array
is just a factory function). Also applies to @return
.
|
||
# Some regions don't have useful model values because the amplifier is dead when the darks were taken | ||
# | ||
badAmps = {9: [0, 1, 2, 3], 33: [0, 1], 43: [0]} # Known bad amplifiers in the data: {ccdId: [ampId]} |
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.
Maybe not for this ticket, but this seems like something we should be looking up from some other source of truth.
isBad[box.getMinY():box.getMaxY(), box.getMinX():box.getMaxX()] = True | ||
model[isBad] = numpy.median(model[~isBad]) | ||
mask = exposure.getMaskedImage().getMask() | ||
mask.getArray()[isBad] |= mask.getPlaneBitMask("BAD") |
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.
Just aesthetic, but you can now do mask.array[isBad] |= ...
|
||
model *= exposure.getInfo().getVisitInfo().getExposureTime() | ||
array = exposure.getMaskedImage().getImage().getArray() | ||
array -= model |
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 above two lines can also now be written as exposure.image.array -= model
.
689fea0
to
1ad4b79
Compare
LEDs in an encoder in HSC are producing stray light on the detectors, producing the 'Eye of Y-band' feature. It can be removed by subtracting open-shutter darks. However, because the pattern of stray light varies with rotator angle, many dark exposures are required. To reduce the data volume for the darks, the images have been compressed using wavelets. The code here (provided by Sogo Mineo of NAOJ and only cleaned up a bit) retrieves the appropriate dark, uncompresses it and uses it to remove the stray light from an exposure. Some code here (provided by Satoshi Kawanomoto) may not meet coding standards, but we are accepting it as legacy code. Unfortunately, no tests are available for this code yet.
1ad4b79
to
84dde38
Compare
LEDs in an encoder in HSC are producing stray light on the detectors,
producing the 'Eye of Y-band' feature. It can be removed by
subtracting open-shutter darks. However, because the pattern of stray
light varies with rotator angle, many dark exposures are required.
To reduce the data volume for the darks, the images have been
compressed using wavelets.
The code here (provided by Sogo Mineo of NAOJ and only cleaned up
a bit) retrieves the appropriate dark, uncompresses it and uses it
to remove the stray light from an exposure.
Some code here (provided by Satoshi Kawanomoto) may not meet coding
standards, but we are accepting it as legacy code. Unfortunately, no
tests are available for this code yet.