<div dir="ltr">Hello,<div><br></div><div>numpy.divide(0.0,0.0) raises a warning which doesn't appear to get caught by numpy.seterr(divide='ignore')</div><div><br></div><div>This example:</div><div><br></div><div>
<div>import numpy</div><div>numpy.divide(0.0,0.0)</div><div>numpy.divide(1.0,0.0)</div><div>numpy.seterr(divide='ignore')</div><div>numpy.divide(1.0,0.0)</div><div>numpy.divide(0.0,0.0)</div><div><br></div><div>produces this output:</div>
<div><br></div><div><div>Warning (from warnings module):</div><div> File "C:\Users\ldigrego\Desktop\tst.py", line 2</div><div> numpy.divide(0.0,0.0)</div><div>RuntimeWarning: invalid value encountered in divide</div>
<div><br></div><div>Warning (from warnings module):</div><div> File "C:\Users\ldigrego\Desktop\tst.py", line 3</div><div> numpy.divide(1.0,0.0)</div><div>RuntimeWarning: divide by zero encountered in divide</div>
<div><br></div><div>Warning (from warnings module):</div><div> File "C:\Users\ldigrego\Desktop\tst.py", line 6</div><div> numpy.divide(0.0,0.0)</div><div>RuntimeWarning: invalid value encountered in divide</div>
</div><div><br></div><div>Strangely, on Ipython the numpy.seterr(divide='ignore') seems to catch the warning:</div><div><br></div><div><div>import numpy</div><div>numpy.divide(0.0,0.0)</div><div>Out[1]: nan</div><div>
C:\eclipse\plugins\org.python.pydev_2.8.1.2013072611\pysrc\pydevconsole.py:1: RuntimeWarning: invalid value encountered in divide</div><div> from __future__ import nested_scopes #Jython 2.1 support</div><div>numpy.divide(1.0,0.0)</div>
<div>Out[1]: inf</div><div>C:\eclipse\plugins\org.python.pydev_2.8.1.2013072611\pysrc\pydevconsole.py:1: RuntimeWarning: divide by zero encountered in divide</div><div> from __future__ import nested_scopes #Jython 2.1 support</div>
<div>numpy.seterr(divide='ignore')</div><div>Out[1]: {'divide': 'warn', 'invalid': 'warn', 'over': 'warn', 'under': 'ignore'}</div><div>numpy.divide(1.0,0.0)</div>
<div>Out[1]: inf</div><div>numpy.divide(0.0,0.0)</div><div>Out[1]: nan</div></div><div><br></div><div>I could not find information on Google: is this a known problem? Is there a way to suppress this warning?</div><div><br>
</div><div>I'm working on a 64b Win7 machine employing numpy-MKL-1.7.0.win-amd64-py2.7.exe.</div></div><div><br></div><div>Best Regards,</div><div>Lorenzo</div></div>