On 07/15/2011 03:13 AM, Ralf Gommers wrote:


On Fri, Jul 8, 2011 at 4:17 PM, Derek Homeier <[email protected] <mailto:[email protected]>> wrote:

    On 07.07.2011, at 7:16PM, Robert Pyle wrote:

    >
    
.............../Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/numeric.py:1922:
    RuntimeWarning: invalid value encountered in absolute
    >  return all(less_equal(absolute(x-y), atol + rtol * absolute(y)))
    >
    >
    > Everything else completes with 3 KNOWNFAILs and 1 SKIP.  This
    warning is not new to this release; I've seen it before but
    haven't  tried tracking it down until today.
    >
    > It arises in allclose().  The comments state "If either array
    contains NaN, then False is returned." but no test for NaN is
    done, and NaNs are indeed what cause the warning.
    >
    > Inserting
    >
    >    if any(isnan(x)) or any(isnan(y)):
    >        return False
    >
    > before current line number 1916 in numeric.py seems to  fix it.

    The same warning is still present in the current master, I just
    never paid attention to it because the tests still pass (it does
    correctly identify NaNs because they are not less_equal the
    tolerance), but of course this should be properly fixed as you
    suggest.

Under Python 2.6 I used to see this but it has disappeared. What's going on here?

$ python2.7
>>> from numpy import *
>>> absolute(nan)
__main__:1: RuntimeWarning: invalid value encountered in absolute
nan

$ python2.6
>>> from numpy import *
>>> absolute(nan)
nan

Ralf
I do not see this with 64-bit Python2.7 on my Linux system. So perhaps Mac specific?

By the way, all tests pass with Python 2.7 and 3.2 for rc3.

Bruce

$ python
Python 2.7 (r27:82500, Sep 16 2010, 18:02:00)
[GCC 4.5.1 20100907 (Red Hat 4.5.1-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy as np
>>> np.__version__
'1.6.1rc3'
>>> np.absolute(np.nan)
nan

$ python
Python 2.7 (r27:82500, Sep 16 2010, 18:02:00)
[GCC 4.5.1 20100907 (Red Hat 4.5.1-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from numpy import *
>>> absolute(nan)
nan
>>>

_______________________________________________
NumPy-Discussion mailing list
[email protected]
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to