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

Ralf Gommers ralf.gommers@googlemail....
Tue Aug 31 06:02:03 CDT 2010

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.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20100831/c85f431a/attachment.html 

More information about the NumPy-Discussion mailing list