[Numpy-discussion] Should abs([nan]) be supported?
Ondřej Čertík
ondrej.certik@gmail....
Tue Sep 4 18:24:14 CDT 2012
Hi,
When running the test suite, there are problems of this kind:
https://github.com/numpy/numpy/issues/394
which then causes for example the Debian buildbots tests to fail
(https://github.com/numpy/numpy/issues/406).
The problem is really simple:
>>> from numpy import array, abs, nan
>>> a = array([1, nan, 3])
>>> a
array([ 1., nan, 3.])
>>> abs(a)
__main__:1: RuntimeWarning: invalid value encountered in absolute
array([ 1., nan, 3.])
See the issue #394 for detailed explanation why "nan" is being passed
to abs(). Now the question is, what should the right fix be?
1) Should the runtime warning be disabled?
2) Should the tests be reworked, so that "nan" is not tested in allclose()?
3) Should abs() be fixed to not emit the warning?
4) Should the test suite be somehow fixed not to fail if there are
runtime warnings?
Let me know which direction we should go.
Thanks,
Ondrej
More information about the NumPy-Discussion
mailing list