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

tickets/DM-32079: Dilate child footprints using PSF footprint #44

Merged
merged 9 commits into from Nov 11, 2021

Conversation

fred3m
Copy link
Contributor

@fred3m fred3m commented Oct 13, 2021

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.

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)
Copy link
Contributor

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 added 7 commits November 10, 2021 18:50
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 fred3m merged commit 4825d88 into master Nov 11, 2021
@fred3m fred3m deleted the tickets/DM-32079 branch November 11, 2021 01:39
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