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
Reenable shading tests for numpy 1.9.1 and later #3755
Conversation
This is somewhat urgent since on of the tests is failing on master with a knowfailure test did not fail using numpy 1.9.1 which Travis might soon pickup. |
Not sure what to make of the failing test passing on 2.6/np 1.6 |
I reenabled the test on 1.6 and that is fine. numpy 1.6 z before
[[-10.0 -6.0 -1.0 1.0 1.0 -1.0 -6.0 -10.0]
[-6.0 1.0 5.0 7.0 7.0 5.0 1.0 -6.0]
[-1.0 5.0 9.0 10.0 10.0 9.0 5.0 -1.0]
[1.0 7.0 10.0 -- -- 10.0 7.0 1.0]
[1.0 7.0 10.0 -- -- 10.0 7.0 1.0]
[-1.0 5.0 9.0 10.0 10.0 9.0 5.0 -1.0]
[-6.0 1.0 5.0 7.0 7.0 5.0 1.0 -6.0]
[-10.0 -6.0 -1.0 1.0 1.0 -1.0 -6.0 -10.0]]
z after
[[-10.0 -6.0 -1.0 1.0 1.0 -1.0 -6.0 -10.0]
[-6.0 1.0 5.0 7.0 7.0 5.0 1.0 -6.0]
[-1.0 5.0 9.0 10.0 10.0 9.0 5.0 -1.0]
[1.0 7.0 10.0 -- -- 10.0 7.0 1.0]
[1.0 7.0 10.0 -- -- 10.0 7.0 1.0]
[-1.0 5.0 9.0 10.0 10.0 9.0 5.0 -1.0]
[-6.0 1.0 5.0 7.0 7.0 5.0 1.0 -6.0]
[-10.0 -6.0 -1.0 1.0 1.0 -1.0 -6.0 -10.0]]
dx
[[4.0 4.0 3.0 1.0 -1.0 -3.0 -4.0 -4.0]
[7.0 6.0 3.0 1.0 -1.0 -3.0 -6.0 -7.0]
[7.0 5.0 2.0 0.0 -0.0 -2.0 -5.0 -7.0]
[6.0 4.0 -- -- -- -- -4.0 -6.0]
[6.0 4.0 -- -- -- -- -4.0 -6.0]
[7.0 5.0 2.0 0.0 -0.0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 10.0 7.0 1.0]
[1.0 7.0 10.0 -- -- 10.0 7.0 1.0]
[-1.0 5.0 9.0 10.0 10.0 9.0 5.0 -1.0]
[-6.0 1.0 5.0 7.0 7.0 5.0 1.0 -6.0]
[-10.0 -6.0 -1.0 1.0 1.0 -1.0 -6.0 -10.0]]
dx
[[4.0 4.0 3.0 1.0 -1.0 -3.0 -4.0 -4.0]
[7.0 6.0 3.0 1.0 -1.0 -3.0 -6.0 -7.0]
[7.0 5.0 2.0 0.0 -0.0 -2.0 -5.0 -7.0]
[6.0 4.0 -- -- -- -- -4.0 -6.0]
[6.0 4.0 -- -- -- -- -4.0 -6.0]
[7.0 5.0 2.0 0.0 -0.0 -2.0 -5.0 -7.0]
[7.0 6.0 3.0 1.0 -1.0 -3.0 -6.0 -7.0]
[4.0 4.0 3.0 1.0 -1.0 -3.0 -4.0 -4.0]]
dy
[[4.0 7.0 7.0 6.0 6.0 7.0 7.0 4.0]
[4.0 6.0 5.0 4.0 4.0 5.0 6.0 4.0]
[3.0 3.0 2.0 -- -- 2.0 3.0 3.0]
[1.0 1.0 0.0 -- -- 0.0 1.0 1.0]
[-1.0 -1.0 -0.0 -- -- -0.0 -1.0 -1.0]
[-3.0 -3.0 -2.0 -- -- -2.0 -3.0 -3.0]
[-4.0 -6.0 -5.0 -4.0 -4.0 -5.0 -6.0 -4.0]
[-4.0 -7.0 -7.0 -6.0 -6.0 -7.0 -7.0 -4.0]] as a result of running import numpy as np
y, x = np.mgrid[-1.2:1.2:8j, -1.2:1.2:8j]
z = 10 * np.cos(x**2 + y**2)
z_mask = np.ma.masked_greater(z, 9.9)
print('z before\n')
print(np.round(z_mask))
print('\nz after\n')
dy, dx = np.gradient(z_mask)
print(np.round(z_mask))
print('\ndx\n')
print(np.round(dx))
print('\ndy\n')
print(np.round(dy)) |
TST : Reenable shading tests for numpy 1.9.1 and later
Thanks for being on top of these numpy issues. |
This fixes #3598 now the numpy 1.9.1 is released which changes the default gradient on the edge back to first order and fixes an issue with sharing of masks for masked arrays calculated from other masked arrays.
The non masked test passed for all versions of numpy different from 1.9.0. To get the tests passing with 1.9.0 the arrays are modified to cut out the edges which is the only differences.
The masked test is different for all versions due to the long standing mask bug. The numpy 1.9.1 version is the most correct so I chose to raise a knowfailure for all older versions.
See attached illustration (the corners where previously masked but are now calculated correctly) :