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
Conversation
7aaa884
to
029b214
Compare
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.
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) |
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.
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) |
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.
Would self.Mask().removeAndClearMaskPlane(name, removeFromDefault)
work?
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.
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
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.
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.
029b214
to
e9b0058
Compare
No description provided.