-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Quantity behaviour for np.isclose, np.allclose; some others #9463
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
Conversation
|
Failures seem real. |
|
Now this needs a rebase. |
eb84aa1 to
61a661a
Compare
|
OK, rebased and (hopefully) fixed. |
bsipocz
left a comment
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 trust your tests a lot, and all looks reasonable, but I don't trust myself to know enough of the numpy internals to spot any serious issues.
So use my approval with a pinch of salt.
|
Thanks for catching that copy & paste error! |
|
I cancel CIs as there was a doctest issue in the previous run that still needs addressing: |
|
Thanks, @bsipocz, goes to show that skipping the overall test run for lack of time comes back to bite one... |
|
No worries, this is actually pretty good sign that you've got rid of yet another know issue :) |
Also explicitly not support np.any, np.all, etc. This changes exception from NotImplementedError to TypeError, arguably better.
Both failed on Quantity with units, so no risk of working code breaking.
Here, we cast ourselves as ndarray if no relevant formatter is given, since we are doomed otherwise (and this is most consistent with how other subclasses are treated). However, if a relevant formatter is given, we just use it.
2ea8ea4 to
b686adf
Compare
|
OK, rebased. Tests pass locally so keeping fingers crossed. |
astrofrog
left a comment
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.
This looks good to me!
Following on #9462, this changes the Quantity implementation for
iscloseandallcloseto assume a default unit of the first argument foratol(including for its default of 1e-8). It sticks with the docstring behaviour fornp.broadcast_*to avoid breaking existing code. It also explicitly disallowsnp.any,np.all(which is most logical but changes the error raised), and makesarray_repr,array_strandarray2stringwork (former two slightly hacky). All the latter failed for all but dimensionless arrays.fixes #9462