On Fri, Jul 8, 2011 at 4:17 PM, Derek Homeier <
[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
_______________________________________________
NumPy-Discussion mailing list
[email protected]
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to