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

DM-42086: Clear single-frame streak mask if it exists already #39

Merged
merged 1 commit into from Dec 9, 2023

Conversation

yalsayyad
Copy link
Contributor

Before detecting streaks on the difference warps, clear the existing mask if it is already there. The streaks detected on the warp differences should be better. They are straight, cross multiple detectors, and are not competing against the background of static sources

@@ -1649,6 +1649,12 @@ def findArtifacts(self, templateCoadd, tempExpRefList, imageScalerList):

if self.config.doFilterMorphological:
maskName = self.config.streakMaskName
# clear single frame streak mask if it exists already
try:
Copy link
Contributor

Choose a reason for hiding this comment

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

Because of inefficiency in pybind11, it's actually much faster to check if the plane exists rather than try and catch the exception. This speed probably doesn't matter for something like this that is per image and not per source, but I wanted to point it out.

Copy link
Member

Choose a reason for hiding this comment

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

The faster your Apple Silicon CPU is the slower this gets in a loop.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure. What's your favorite way to check that a mask plane exists?

I saw something about zero-cost exceptions in the 3.11 release notes (in the no exception case of course).

Copy link
Contributor

Choose a reason for hiding this comment

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

The problem is not the python exceptions, it's the c++ exceptions. But now that I look at the afw code I don't know if we have an easy way of doing this without doing getMaskPlaneDict(). I actually think this will be fine because it (a) is rare and (b) isn't per-source.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Switched to check if its in getMaskPlaneDict

@cmsaunders
Copy link
Collaborator

This looks good to me. Following @erykoff's suggestion is up to you.

Before detecting streaks on the difference warps, clear any existing
mask using the same name. Any existing mask has been PSF-matched,
is not a replacement for detecting streaks on the differences, and
should not be used in the artifact rejection loop.

To clip pixels based on the single-frame streak masks, add that mask
name to the badMaskPlanes config parameter.

Streaks detected on the warp differences are expected to be better
in that they are straight, cross multiple detectors, and are not competing
against the background of static sources
@yalsayyad yalsayyad merged commit cc1f95e into main Dec 9, 2023
3 checks passed
@yalsayyad yalsayyad deleted the tickets/DM-42086 branch December 9, 2023 05:17
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

4 participants