[Numpy-discussion] numpy.test(): invalid value encountered in {isinf, divide, power, ...}

Pierre GM pgmdevlist@gmail....
Thu Jan 21 17:07:35 CST 2010


On Jan 21, 2010, at 5:27 PM, David Cournapeau wrote:
> On Fri, Jan 22, 2010 at 7:14 AM, David Cournapeau <cournape@gmail.com> wrote:
>> On Fri, Jan 22, 2010 at 12:06 AM, Charles R Harris
>> <charlesr.harris@gmail.com> wrote:
>>> 
>>> 
>>> On Thu, Jan 21, 2010 at 3:03 AM, David Cournapeau <cournape@gmail.com>
>>> wrote:
>>>> 
>>>> On Thu, Jan 21, 2010 at 6:23 PM, Pauli Virtanen <pav+sp@iki.fi> wrote:
>>>>> Wed, 20 Jan 2010 16:57:01 -0500, Darren Dale wrote:
>>>>> [clip]
>>>>>> Warning: invalid value encountered in isinf Warning: invalid value
>>>>>> encountered in isfinite
>>>>> [clip]
>>>>> 
>>>>> This is because of changed seterr() default values.
>>>>> 
>>>>> IMHO, the 'print' default is slightly worse than the previous 'ignore'.
>>>>> Personally, I don't see great value in the "invalid value encountered"
>>>>> reports that are appear every time a nan is generated...
>>>> 
>>>> I thought it was agreed that the default would be changed to warnings
>>>> for 1.5.0 ?
>>>> 
>>> 
>>> It was. Well, it was agreed that the change shouldn't be made in 1.4 anyway.
>>> I'm starting to have second thoughts also. Not so much because of the
>>> messages emitted by the tests, but because I suspect a lot of users will be
>>> shocked, shocked, when their old applications fill the screen with messages.
>> 
>> Hence changing to warning: it would appear only once per location, and
>> can be filtered. And filling was what happened before it was changed
>> by accident so that long ago anyway.
> 
> sorry, I mean it was the default not that long ago before it was
> changed by accident,


At the same time, having a seterr module-wise in numpy.ma wasn't the best idea either. 
So, we could put the seterr(invalid:ignore) back in numpy.ma.core, that should take care of the warning when using np functions on masked arrays.
Nevertheless, I'll still keep the current mechanism in the ma functions (viz, catch the settings, change them locally before an operation, reset them afterwards), that's cleaner.
Unless you guys come with a better idea.


More information about the NumPy-Discussion mailing list