[Numpy-discussion] Bug in numpy.histogram?

Pauli Virtanen pav@iki...
Mon Jun 9 10:17:16 CDT 2008


ma, 2008-06-09 kello 11:11 -0400, Tommy Grav kirjoitti:
> With the most recent change in numpy 1.1 it seems that numpy.histogram
> was broken when wanting a normalized histogram. I thought the idea was
> to leave the functionality of histogram as it was in 1.1 and then
> break the api in 1.2?
[clip]
> data, bins = numpy.histogram(a,b,normed=True)
> Traceback (most recent call last):
>    File "<console>", line 0, in <module>
>    File "/Library/Frameworks/Python.framework/Versions/2.5/lib/ 
> python2.5/site-packages/numpy/lib/function_base.py", line 189, in  
> histogram
>      raise ValueError, 'Use new=True to pass bin edges explicitly.'
> ValueError: Use new=True to pass bin edges explicitly.

I think the point in this specific change was that numpy.histogram
previously returned invalid results when normed=True and explicit bins
were given; the previous code always normalized the results assuming the
bins were of equal size.

Moreover, I think it was not obvious what "normalized" results should
mean when one of the bins is of infinite size.

	Pauli




More information about the Numpy-discussion mailing list