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-35175: Fix the variance plane calculation when the science image is convolved #222
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.
Looks OK; just a couple of minor comments/questions.
tests/test_subtractTask.py
Outdated
|
||
# Verify that the variance plane of the difference image is correct | ||
# when the template and science variance planes are incorrect | ||
science.variance.array[...] = scienceVarianceOrig/scaleFactor | ||
# science.variance.array[...] = scienceVarianceOrig/scaleFactor |
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 checking this is intentionally commented out.
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.
I was able to fix the test, so that this commented-out code could be put back in.
@@ -326,22 +345,29 @@ def runConvolveScience(self, template, science, sources): | |||
# We must invert the background model if the matching kernel is solved for the science image. | |||
kernelResult.backgroundModel.setParameters([-p for p in modelParams]) | |||
|
|||
kernelImage = lsst.afw.image.ImageD(kernelResult.psfMatchingKernel.getDimensions()) | |||
norm = kernelResult.psfMatchingKernel.computeImage(kernelImage, doNormalize=False) |
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.
Is there any reason one might want to allow doNormalize to be configurable here, as opposed to hard-coded false? I think not but doesn't hurt to think about it a bit.
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.
It's actually important that it be hard-coded as False here, so that we get the flux scale right.
Set convolutionControl to copy edge pixels instead of producing NaNs Increase accuracy of model variance plane for tests Add test coverage of variance plane when science image is convolved Put normalization factor on its own line Set the photometric scale and photoCalib when convolving the science image. Return the matchedScience image. Add a warning when running in compatibility mode Scale the science and template variance first instead of the diffim later. This makes the ratio between the science and template variances correct when the images are subtracted. SubtractTask tests must assume the inputs can be modified. This is because ScaleVariance now operates on the science and template images. Use afw.math statistics to compute image and variance means Simplify import Add test of ScaleVariance metadata fix flake8 errors Clean up scaleVariance unit test from review
9ce76d5
to
aa08fde
Compare
No description provided.