[Numpy-discussion] Bug in numpy.histogram?

Tommy Grav tgrav at mac.com
Mon Jun 9 11:38:07 EDT 2008


I understand this and agree, but it still means that the API for  
histogram is
broken since normed can only be used with the new=True parameter. I  
though
the whole point of the future warning was to avoid this. It is not a  
big deal,
just means that one is forced to use the new API somewhat quicker :)

Cheers
   Tommy



On Jun 9, 2008, at 11:17 AM, Pauli Virtanen wrote:

> 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
>
>
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion at scipy.org
> http://projects.scipy.org/mailman/listinfo/numpy-discussion




More information about the NumPy-Discussion mailing list