3 test failling
See original GitHub issue🐛Bug
After un update of my python package I now get error on the following test
FAIL: test_with_zero_intensity (tests.transforms.augmentation.test_random_spike.TestRandomSpike) FAIL: test_with_zero_spike (tests.transforms.augmentation.test_random_spike.TestRandomSpike) FAIL: test_no_movement (tests.transforms.augmentation.test_random_motion.TestRandomMotion)
To reproduce
numpy 1.19.1 pypi_0 pypi
numpy-base 1.17.2 py37hde5b4d6_0
numpydoc 1.1.0 py_0
# Your code here
array=np.random.uniform(0,40,100)
transformed = np.fft.fftn(array)
fshift = np.fft.fftshift(transformed)
f_ishift = np.fft.ifftshift(fshift)
img_back = np.fft.ifftn(f_ishift)
np.max(array-np.abs(img_back))
# Your errors here
1.4210854715202004e-14
Expected behavior
it is related to fft and fft inverse that now to not get the exact same number
Solution will be to replace assert_array_equal with des np.all_close
but may be it is due to something wrong in my python package …
TorchIO version 0.17.34
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (5 by maintainers)
Top GitHub Comments
I think you are right. What’s the point of using 0 intensity or 0 spikes anyway? I will just switch to
assert_array_almost_equal
in the tests.Actually I’m not sure about that. In one hand, it’s more effective and output will truly equal input if we leave the input untouched when transforms are supposed to have no effect. On the other hand, it shows that the transform somehow behaves properly by not altering the input (or almost) when it is supposed to have no effect. What do you think?