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-12979: add y-band stray light removal #103

Merged
merged 1 commit into from Dec 19, 2017
Merged

Conversation

PaulPrice
Copy link
Contributor

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.

Copy link
Member

@TallJimbo TallJimbo left a 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)
Copy link
Member

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]}
Copy link
Member

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")
Copy link
Member

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
Copy link
Member

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.

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.
@PaulPrice PaulPrice merged commit 84dde38 into master Dec 19, 2017
@ktlim ktlim deleted the tickets/DM-12979 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