Skip to content

DM-55204: Raise an error if the template PSF is discontinuous - #484

Merged
isullivan merged 6 commits into
mainfrom
tickets/DM-55204
Dec 3, 2026
Merged

isullivan merged 6 commits into
mainfrom
tickets/DM-55204

Conversation

@isullivan

@isullivan isullivan commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Test the template PSF, and drop detected footprints where the PSF shape is significantly different from neighboring patches. These can't be fit with the spatially-varying PSF matching kernel, and will generate junk diaSources. Do not drop entire patches or the empty regions between footprints, since these regions will not create junk diaSources and a transient can still be detected on the difference image there.

@isullivan
isullivan force-pushed the tickets/DM-55204 branch 2 times, most recently from d7482d3 to 48c11cd Compare November 26, 2026 01:53
PSF matching fits a matching kernel that varies smoothly across the
image, so it cannot follow a step in the template PSF where coadd
inputs begin or end. Fit a low-order polynomial to the template PSF
second moments, leaving out outlier blocks, and set REJECTED_TEMPLATE
on compact subregions of DETECTED regions whose PSF width differs from
the fit by more than psfDiscontinuityMaxDeviation.

The new unit tests were written by Claude.
The new unit tests were written by Claude.
This should take less than a second on LSSTCam images, and allows us to re-configure source detection.
Since we now run source detection to set the DETECTED mask plane for the template
we can use the detected peaks as the points where the PSF is evaluated.
These only need to be accurate to about a pixel for determining
the correct PSF model to use, and a deep coadd can be slow to evaluate.

@BrunoSanchez BrunoSanchez left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good to me. The PSF difference is clever, and the fit seems a bit tedious but it is clearly explained in the comments why it needs to happen like this.

return templateCoverageFraction


def sampleCoaddPsfMoments(psf, ra, dec, targetWcs):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is really useful!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I understood the comparison function. I haven't checked myself the maths of known cases though.

@isullivan
isullivan merged commit d5f7fea into main Dec 3, 2026
2 checks passed
@isullivan
isullivan deleted the tickets/DM-55204 branch December 3, 2026 03:01
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.

2 participants