[NumPy-Tickets] [NumPy] #1905: numpy/core/numeric/allclose() fails to test for NaN inputs

NumPy Trac numpy-tickets@scipy....
Sun Sep 11 13:46:10 CDT 2011


#1905: numpy/core/numeric/allclose() fails to test for NaN inputs
-------------------------------------------+--------------------------------
 Reporter:  robertpyle                     |       Owner:  somebody
     Type:  defect                         |      Status:  new     
 Priority:  normal                         |   Milestone:  1.6.2   
Component:  numpy.core                     |     Version:  devel   
 Keywords:  RuntimeWarning, absolute, nan  |  
-------------------------------------------+--------------------------------

Comment(by samueljohn):

 Hope this can help. It's from one of these "parametric test factory"
 tests.


 {{{
 samuel@localhost:~/Projects/Python $ ipython
 Python 2.7.2 (default, Sep  5 2011, 10:50:07)
 Type "copyright", "credits" or "license" for more information.

 IPython 0.11 -- An enhanced Interactive Python.
 ?         -> Introduction and overview of IPython's features.
 %quickref -> Quick reference.
 help      -> Python's own help system.
 object?   -> Details about 'object', use 'object??' for extra details.

 In [1]: import numpy

 In [2]: numpy.test(verbose=2)
 Running unit tests for numpy
 NumPy version 2.0.0.dev-073bc39
 NumPy is installed in
 /usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/2.7/lib/python2.7
 /site-packages/numpy
 Python version 2.7.2 (default, Sep  5 2011, 10:50:07) [GCC 4.2.1 (Based on
 Apple Inc. build 5658) (LLVM build 2335.15.00)]
 nose version 1.1.2
 test_api.test_fastCopyAndTranspose ... ok
 [...]
 test_nditer.test_iter_maskna_default_use_maskna ... ok
 Parametric test factory. ... ok
 Parametric test factory. ... ok
 Parametric test factory. ... ok
 Parametric test factory. ... ok
 Parametric test factory. ... ok
 Parametric test factory. ... ok
 Parametric test factory. ... ok
 Parametric test factory. ... ok
 Parametric test factory. ... ok
 Parametric test factory. ... ok
 Parametric test factory. ... ok
 Parametric test factory. ... ok
 Parametric test factory. ... ok
 Parametric test factory. ...
 /usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/2.7/lib/python2.7
 /site-packages/numpy/core/numeric.py:2020: RuntimeWarning: invalid value
 encountered in absolute
   return all(less_equal(absolute(x-y), atol + rtol * absolute(y)))
 ok
 Parametric test factory. ... ok
 Parametric test factory. ... ok
 Parametric test factory. ... ok
 Parametric test factory. ... ok
 test_numeric.TestAllclose.test_no_parameter_modification ... ok


 }}}
 btw. no test fails.


 And also for both versions '1.6.2.dev-396dbb9' and 2.0.0.dev-073bc39 I get
 this warning for absolute(nan):
 {{{
 samuel@localhost:~/Projects/Python $ ipython
 Python 2.7.2 (default, Sep  5 2011, 10:50:07)
 Type "copyright", "credits" or "license" for more information.

 IPython 0.11 -- An enhanced Interactive Python.
 ?         -> Introduction and overview of IPython's features.
 %quickref -> Quick reference.
 help      -> Python's own help system.
 object?   -> Details about 'object', use 'object??' for extra details.

 In [1]: from numpy import *

 In [2]: absolute(nan)
 /usr/local/share/python/ipython:1: RuntimeWarning: invalid value
 encountered in absolute
 #!/usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
 Out[2]: nan
 }}}


 I don't know if this is relevant. Seems to pop up during numpy.test(),
 too.

-- 
Ticket URL: <http://projects.scipy.org/numpy/ticket/1905#comment:4>
NumPy <http://projects.scipy.org/numpy>
My example project


More information about the NumPy-Tickets mailing list