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
Conversation
@@ -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: |
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.
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.
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.
The faster your Apple Silicon CPU is the slower this gets in a loop.
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.
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).
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.
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.
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.
Switched to check if its in getMaskPlaneDict
This looks good to me. Following @erykoff's suggestion is up to you. |
154dff0
to
ce899e7
Compare
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
ce899e7
to
a13ba01
Compare
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