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
tickets/DM-32079: Dilate child footprints using PSF footprint #44
Merged
Conversation
This file contains 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
fred3m
force-pushed
the
tickets/DM-32079
branch
from
October 13, 2021 18:35
096060d
to
31635c3
Compare
natelust
approved these changes
Oct 27, 2021
mHeavy = afwDet.MultibandFootprint.fromArrays(filters, model, xy0=xy0) | ||
peakCat = afwDet.PeakCatalog(source.detectedPeak.table) | ||
# Get the SpanSet that contains all of the model pixels | ||
model = np.array(source.get_model()).astype(np.float32) |
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.
dont do seperate astype
here
fred3m
force-pushed
the
tickets/DM-32079
branch
from
November 10, 2021 21:17
a3c8c32
to
9cb58b2
Compare
The test_scarlet.py module is for testing that the stack version of scarlet can initialize sources with no errors. Any tests for stack objects should be in test_deblend.py, so the test that heavy footprints are made corectly was removed.
`modelToHeavy` was modified to remove an incorrect thresholding algorithm used to truncate convolved scarlet models and replace it with an algorithm that grows the deconvolved footprint with the rectangular PSF.
Deblended children near the edge of an image can have their footprints dilated outside of the exposure by the PSF width. This commit ensures that the dilated model is always contained fully in the exposure. This is valid, as later in pipe_tasks the science pipelines flag edge sources so it isn't expected that all of their flux is contained in the image.
The newer version of the code was creating the spans from the scarlet model, dilating those spans, and using those spans for the final footprints. The old version of the code simply thresholded at zero to create the HeavyFootprints. This commit reverts to the old code, with the change that it performs the convolution and uses all pixels that are not zero (including negative pixel values) in the footprint. There is also a minor change to ensure that the MultibandFootprint has all of the peaks, not just the single pand footprints.
The original version of this code used the bounding box of the spanset, not the mask that was used to create the spanset. When the mask contains empty rows the two will differ, which caused some sources to be placed incorrectly in the footprint.
fred3m
force-pushed
the
tickets/DM-32079
branch
from
November 11, 2021 00:51
9cb58b2
to
48b50db
Compare
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.
Replace an incorrect thresholding algorithm with a more robust dilation algorithm to convolve scarlet models with the seeing in each band and properly truncate the resulting footprint.