You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sometimes I am getting these errors when running tests:
======================================================================
ERROR: test_numeric.TestIsclose.test_ip_isclose_allclose([1e-08, 1, 1000020.0000000099], [0, nan, 1000000.0])
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/ondrej/repos/numpy/py27/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
self.test(*self.arg)
File "/home/ondrej/repos/numpy/py27/lib/python2.7/site-packages/numpy/core/tests/test_numeric.py", line 1245, in tst_isclose_allclose
assert_array_equal(isclose(x, y).all(), allclose(x, y), msg % (x, y))
File "/home/ondrej/repos/numpy/py27/lib/python2.7/site-packages/numpy/core/numeric.py", line 1986, in allclose
return all(less_equal(abs(x-y), atol + rtol * abs(y)))
RuntimeWarning: invalid value encountered in absolute
======================================================================
ERROR: test_numeric.TestIsclose.test_ip_isclose_allclose(nan, [nan, nan, nan])
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/ondrej/repos/numpy/py27/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
self.test(*self.arg)
File "/home/ondrej/repos/numpy/py27/lib/python2.7/site-packages/numpy/core/tests/test_numeric.py", line 1245, in tst_isclose_allclose
assert_array_equal(isclose(x, y).all(), allclose(x, y), msg % (x, y))
File "/home/ondrej/repos/numpy/py27/lib/python2.7/site-packages/numpy/core/numeric.py", line 1986, in allclose
return all(less_equal(abs(x-y), atol + rtol * abs(y)))
RuntimeWarning: invalid value encountered in absolute
These are caused by calling allclose(x, y) with for example x = array([1, nan, 2]) (the array contains nan). Then inside allclose, one calls abs on the array of nans, which produces the warning. It can be reproduced by simply doing:
>>> 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.])
The text was updated successfully, but these errors were encountered:
Sometimes I am getting these errors when running tests:
These are caused by calling
allclose(x, y)
with for examplex = array([1, nan, 2])
(the array containsnan
). Then insideallclose
, one callsabs
on the array ofnan
s, which produces the warning. It can be reproduced by simply doing:The text was updated successfully, but these errors were encountered: