-
-
Notifications
You must be signed in to change notification settings - Fork 9.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
BUG: Fixed previous attempt to fix dimension mismatch in nanpercentile #7180
Conversation
@@ -727,6 +727,9 @@ def test_multiple_percentiles(self): | |||
keepdims=keepdim) | |||
assert_equal(nan_val, val) | |||
|
|||
megamat = np.ones((3, 4, 5, 6)) | |||
assert_equal(np.nanpercentile(megamat, perc, axis=(1, 2)).shape, (2, 3, 6)) |
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.
Result before change was (2, 6, 3)
.
Any status on this one? |
LGTM, but the commit message needs more explanation of what you are fixing and why. It is almost impossible to write a commit message that is too detailed... |
nanpercentile was conforming to dimension convention of percentile incorrectly. percentile outputs results for the different percentiles along the first dimension of the output. nanpercentile was moving the reduction axis to the front using swapaxes, which would move the first axis out of place if there were more than two in the array. Added a test with more than two axes to demonstrate and used rollaxis instead of swapaxes to do the interhange.
9364762
to
e30d802
Compare
Putting your theory to the test :) |
I hope I was clear as well as detailed. |
Better ;) I wonder if the documentation of |
I fixed that in #7181. New wording:
|
I don't think this break is my fault, unless it is because I need to rebase.
|
Yeah, that one's not your fault, and a rebase won't help because it's currently failing in master -- see #7197. |
Probably can |
Should be able to just restart the failing tests. I'll do that... |
I'm going to try a close and reopen. |
Yeah, AppVeyor doesn't have much love for the close open trick. |
I will rebase in a little bit. |
BUG: Fixed previous attempt to fix dimension mismatch in nanpercentile
@madphysicist The merge will get tested. |
PR #5981 did not not correctly fix Issue #5760. I have added a test to demonstrate this (which now passes).
Basically, the problem is that
np.swapaxes
only works if you have two dimensions. The correct function to use isnp.rollaxis
.