Repository navigation
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@aguinot reported a bug when using a Sum with OpticalPSF and photon shooting. The flux normalization was coming out wrong.
The underlying bug was a line in
Sum._shootthat implicitly assumed the photons all had positive flux, which is not normally true for profiles that uses an InterpolatedImage (which is part of the implementation of OpticalPSF). Some photons need to be negative flux, so the line that applied a normalization needs to preserve the sign of the photon's flux.When writing the tests for this, I uncovered a different, unrelated bug in InterpolatedImage. This was more subtle, but basically the flux normalization in the C++ layer used the wrong value for the totalAbsFlux. It used the sum of the positive and negative absolute fluxes after applying the interpolation kernel, which is wrong. Then we had a line in the python layer that corrected for this, but in a way that only worked if the pixel values used for the InterpolatedImage are all positive. Usually that's true, but it's not required (e.g. if using a noisy image for the base image).
If some pixel values are negative, then the flux normalization came out wrong. Very badly so for the test I wrote for the sum test where I had one component be all negative pixels. So this PR includes a fix for that bug too.