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-24371 Implement fixed correction fixed PSF support decorrelation afterburner #154
Conversation
155e5da
to
547ec60
Compare
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.
Looks good. Please address the individual comments below, but note that a few came up multiple times:
- You should make use of exposure attributes instead of
get
in many places. E.g. replace instances ofexposure.getMaskedImage().getVariance().getArray()
withexposure.variance.array
. - When you return a
Struct
with only one element, you should think about whether you really want theStruct
at all. - Watch out for reusing the same variable for different purposes within a method, that could easily lead to bugs or at least confusion later on.
result : `Struct` | ||
a `lsst.pipe.base.Struct` containing: | ||
|
||
result : `lsst.pipe.base.Struct` |
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.
Since you're now only returning correctedExposure
, do you still need to wrap it in a Struct
?
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.
This is a result of dropping the correction kernel from the return. I am not 100% sure that we don't want to return any additional information; I'll postpone the removal of the Struct for the spatially varying correction implementation DM-23857. Add TODO comment to the task description and to the return statement.
Considerations: It'd be logical to return something about the correction, but...
- returning the Fourier space correction needs the freqSpaceShape and may not suit for any outside operation.
- Returning the image space correction (full image size) needs one additional, otherwise unnecessary, IFT. Also where the origin is placed would need detailed description or additional, otherwise unnecessary, copying (re-centering) of the array.
- If a matchingKernel size cropped version is returned then we throw away the main lesson from this whole change i.e. that the correction can be larger than the original matching kernel in general so should not be used.
return pipeBase.Struct(correctedExposure=outExposure, ) | ||
|
||
tOverSVar = tvar/svar | ||
if tOverSVar > 1e8: |
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.
Please add a comment describing why 1e8 was chosen. Also, since this is only a warning, you might want to consider lowering the threshold. Finally, I'm a bit surprised by this check: isn't the template variance usually smaller than the science image, rather than the other way around?
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.
As the matching kernel high frequency components go to zero, the correction factor converges to sqrt(tvar/svar) i.e. this is a warning when high frequency pixels of the difference image is multiplied by more than 4 orders of magnitude as correction. Yes, in the regular case, the template variance is the smaller one and this is no concern; tvar>svar can happen if we convolve the science image thus the arguments are swapped for this task.
I don't have a really good justification for the value itself at the moment, just wanted an indicator to watch for diverging solutions. We won't coadd ~1e8 images, so I don't expect that any coadd variance will be this small (i.e. this large when swapped in science exposure convolution mode) but this scaling is still acceptable at double precision.
5288283
to
f8ce90b
Compare
* Add padding methods for DFT. * Update docstrings, fix shape bug. * Disable ImageMapReduce testing. * Add direct correlation correction unit test. * Add sourceless test image generation modification to `makeFakeImages`. * Add direct correlation estimation function `estimatePixelCorrelation`. * Add new test case `testNoiseDiffimCorrection`. * Update docstrings, improve code readability.
f8ce90b
to
971986d
Compare
No description provided.