-
Notifications
You must be signed in to change notification settings - Fork 44
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
Allow integer or boolean mask to be passed to Masker #1532
Conversation
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.
Looks good!
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 we may want accept any array and convert it to bool.
mask_boolean = as_array(mask_input, dtype=bool)
This will convert 0s to False and any other value to True
, which could catch people out but I think as long as it's documented that:
"masks will be interpreted as boolean with non-zero values set as True
"
If the input mask is already boolean then mask_boolean
will just be a reference to mask_input
Signed-off-by: Laura Murgatroyd <60604372+lauramurgatroyd@users.noreply.github.com>
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.
As per comments.
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.
Add Return
to the doc strings, otherwise I'm happy.
I have added docstrings on the Returns and a unit test to check that the user's mask is not modified |
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 suggesting some minor changes to the docstrings
Co-authored-by: Edoardo Pasca <14138589+paskino@users.noreply.github.com> Signed-off-by: Laura Murgatroyd <60604372+lauramurgatroyd@users.noreply.github.com>
Signed-off-by: Laura Murgatroyd <60604372+lauramurgatroyd@users.noreply.github.com>
Co-authored-by: Edoardo Pasca <14138589+paskino@users.noreply.github.com> Signed-off-by: Laura Murgatroyd <60604372+lauramurgatroyd@users.noreply.github.com>
Signed-off-by: Laura Murgatroyd <60604372+lauramurgatroyd@users.noreply.github.com>
Describe your changes
Allows Masker to accept an integer array, in which case it is converted to boolean
Describe any testing you have performed
Please add any demo scripts to CIL-Demos/misc/
Added unit test to make sure error is thrown if mask is integer.
Link relevant issues
Closes #1531
Checklist when you are ready to request a review
Contribution Notes
Please read and adhere to the developer guide and local patterns and conventions.