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-44363: clear the NOT_DEBLENDED mask plane for the difference image #315

Merged
merged 1 commit into from
May 21, 2024

Conversation

isullivan
Copy link
Contributor

No description provided.

Copy link
Contributor

@parejkoj parejkoj left a comment

Choose a reason for hiding this comment

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

I'm still not sure I understand what the tests are supposed to be doing (e.g. self.assertTrue(diffimSum >= scienceSum) is checking that there are more of that mask bit set in one image than the other? What is that informative of?).

Otherwise, I think this is ok, and there's not obviously other bits we should clear from the list you posted.

Comment on lines 834 to 835
# Erase existing detection mask planes.
# We don't want the detection mask from the science image
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for removing this: it was always going to be misleading compared with the docstring of updateMasks.

Comment on lines 475 to 478
# Clear existing deblender mask planes, if present
if "NOT_DEBLENDED" in difference.mask.getMaskPlaneDict().keys():
mask = difference.mask
mask &= ~(mask.getPlaneBitMask("NOT_DEBLENDED"))
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this should happen at the same place the clearing of the detected planes happens, at line 337. You can just add it to the ORed bits being cleared there.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We aren't guaranteed to have NOT_DEBLENDED present, so we still need to have this check. I can consolidate this with clearing the DETECTED mask.

@@ -143,10 +140,7 @@ def test_clear_template_mask(self):
diffimMask = output.difference.mask
for maskPlane, scienceSum in scienceMaskCheck.items():
diffimSum = np.sum(diffimMask.array & mask.getPlaneBitMask(maskPlane) > 0)
Copy link
Contributor

Choose a reason for hiding this comment

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

Highlighting here, but the line above about "Except the "DETECTED" planes should have been cleared" should be deleted. Please check for other places in the tests that make that claim about the mask, since it's now false.

Comment on lines 849 to 852
The DETECTED and DETECTED_NEGATIVE mask planes of the science image
will be erased.
"""
self._clearMask(science.mask, clearMaskPlanes=["DETECTED", "DETECTED_NEGATIVE"])
Copy link
Contributor

Choose a reason for hiding this comment

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

Thinking about this more: I think we do want to clear these mask planes on the difference image before we write it, even though it is the temporary one that gets superseded by the one in detectAndMeasure. Having any detection planes on a diffim before we've measured on it is just misleading. I think it doesn't matter whether or not we clear them on the science image, because we don't write it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, so would you prefer I remove the second commit that modified subtractImages?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, I think so. I think it is more misleading to have a detection mask set before we've done detection than whatever benefit we might gain in debugging, but I'm not 100% sure.

@isullivan isullivan force-pushed the tickets/DM-44363 branch 2 times, most recently from eae755d to ee26088 Compare May 17, 2024 18:20
Copy link
Contributor

@parejkoj parejkoj left a comment

Choose a reason for hiding this comment

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

One more comment.

Comment on lines +338 to +340
for mp in clearMaskPlanes:
if mp not in mask.getMaskPlaneDict():
mask.addMaskPlane(mp)
Copy link
Contributor

Choose a reason for hiding this comment

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

I understand why you're doing this, but it makes me a bit uncomfortable. We should be getting a coherent mask plane dict from earlier in the pipeline, if we're not that's a problem.

At the very least a comment above these lines saying why you're adding them would be good.

@isullivan isullivan merged commit e35fded into main May 21, 2024
2 checks passed
@isullivan isullivan deleted the tickets/DM-44363 branch May 21, 2024 23:22
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