[Numpy-discussion] numpy histogram normed=True (bug / confusing behavior)

David Huard david.huard@gmail....
Tue Aug 31 09:13:13 CDT 2010

On Tue, Aug 31, 2010 at 7:02 AM, Ralf Gommers

> On Tue, Aug 31, 2010 at 3:44 AM, David Huard <david.huard@gmail.com>wrote:
>> I just added a warning alerting concerned users (r8674), so this takes
>> care of the bug fix and Nils wish to avoid a silent change in behavior.
>> These two changes could be included in 1.5 if Ralf feels this is
>> worthwhile.
>> That looks like a reasonable solution. I haven't got a strong opinion on
> whether or not to change the 'normed' keyword to 'density'.
> Looking at the changes, I don't think that is the right way to do the
> filtering in the tests. resetwarnings() removes all filters including the
> ones previously set by users, and should therefore not be used. Better to
> either raise a specific warning and filter on that, or to filter on the
> message content with:
>     warnings.filterwarnings('ignore' , message="This release of NumPy fixes
> a normalization bug in histogram").
> I found one more place where resetwarnings() is used, in
> test_arraysetops.py, I'll change that in trunk. Related problem there is
> that the warning in warnings.warn is not a DeprecationWarning.
> The above problem is easy to fix, but in any case it's too late to go into
> 1.5.0 - I'll tag the final release tonight.

test_function_base and test_arraysetops now do not use resetwarnings. What I
did is added a warning filter and popped it out of the filters list
afterwards. Is this OK ?

In other tests, what is done is rather

  warnings.simplefilter('ignore', DeprecationWarning)
  warnings.simplefilter('default', DeprecationWarning)

but that will also override any user-defined setup, no ?


> Ralf
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20100831/8c91ab02/attachment.html 

More information about the NumPy-Discussion mailing list