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-16558: removeMaskPlane function in multiband.py does not work #416

Merged
merged 3 commits into from Nov 26, 2018

Conversation

laurenam
Copy link
Contributor

No description provided.

Copy link
Contributor

@isullivan isullivan left a comment

Choose a reason for hiding this comment

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

Thank you for also fixing all the documentation. This looks good overall, I had two minor suggestions for making removeAndClearMaskPlane more clear.

"""
# Clear all masks in MultibandMask but leave in default dict for now
for single in self.singles:
single.removeAndClearMaskPlane(name, False)
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 single.removeAndClearMaskPlane(name, removeFromDefault=False) would be more clear.

for single in self.singles:
single.removeAndClearMaskPlane(name, False)
# Now remove from default dict according to removeFromDefault
self._refMask.removeAndClearMaskPlane(name, removeFromDefault)
Copy link
Contributor

Choose a reason for hiding this comment

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

Would self.Mask().removeAndClearMaskPlane(name, removeFromDefault) work?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I’m not entirely sure, but I think not as all the non-static methods this class do it this way (e.g. clearAllMaskPlanes, getMaskPlaneDict, getNumPlanesUsed, etc...), and removeAndClearMaskPlane is a non-static method:
https://github.com/lsst/afw/blob/master/include/lsst/afw/image/Mask.h#L477

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To be sure, I ran this by @TallJimbo and he concurred.

The removeMaskPlane was broken in two ways:

1) the removeMaskPlaneDict() function called is not an attribute of the
mask being updated, so any call to MultibandMask's removeMaskPlane()
results in an AttributeError.  The fix is to update the function name
from removeMaskPlaneDict() to removeMaskPlane().

2) the function ignores the variable "name", i.e. does not pass it to the
call to [sic!] removeMaskPlaneDict().  Having corrected the function name
to removeMaskPlane(), we then get a TypeError.  The fix here is to pass
name into removeMaskPlane(name).

These issues were not caught because removeMaskPlane() was not being
exercised in any unittest, so one is added here.
This function was missing in the MultibandMask class.  A unittest
was also added.
@laurenam laurenam merged commit e9b0058 into master Nov 26, 2018
@timj timj deleted the tickets/DM-16558 branch February 18, 2021 00: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.

None yet

2 participants