-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Add np.max and np.min to SUBCLASS_SAFE_FUNCTIONS #14484
Conversation
Thank you for your contribution to Astropy! 🌌 This checklist is meant to remind the package maintainers who will review this pull request of some common things to look for.
|
Thanks! Any chance you can add your minimal example as a test? 😸 |
@pllim I did add some tests, but I think everything in the |
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, except we also need round_
and a similar update for Masked
. Since I was rather confused about what is and what is not deprecated, it seemed easier to just do it, so I'll push 2 extra commits to your branch in a minute.
@@ -579,6 +579,12 @@ def check(self, function, *args, method=None, **kwargs): | |||
x = getattr(self.ma, method)(*args, **kwargs) | |||
assert_masked_equal(o, x) | |||
|
|||
def test_max(self): |
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.
Just in case you're curious, for Masked
all functions in fromnumeric.py
are included automatically as subclass safe functions, hence unlike for Quantity
, there was no need to add them explicitly.
OK, pushed my additions. Hopefully the -dev test will now pass (and I didn't break anything else...) |
I guess I shouldn't approve anymore since I contributed, though should all be OK. @pllim?? |
Thanks, @mhvk! |
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.
LGTM as long as CI passes. Thanks!
This comment was marked as resolved.
This comment was marked as resolved.
@larrybradley , do you want to do the manual backport? |
Yay for the tests passing, but sad that the backport is a problem... We may have to do something similar soon -- numpy/numpy#23314 -- but thankfully it is not too hard (and I do agree with deprecatinging aliases). |
I've manually backported: #14488 |
…484-on-v5.2.x Backport PR #14484 on branch v5.2.x (Add np.max and np.min to SUBCLASS_SAFE_FUNCTIONS)
…-on-v5.0.x Backport PR #14484 on branch v5.0.x (Add np.max and np.min to SUBCLASS_SAFE_FUNCTIONS)
In numpy/numpy#23302,
numpy
deprecatednp.amax
andnp.amin
in favor ofnp.max
andnp.min
. This PR addsnp.max
andnp.min
to theQuantity
SUBCLASS_SAFE_FUNCTIONS
list.Fixes #14483
CC: @mhvk, @pllim