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?

import numpy
a = [0,1,2,3,4,5,6,7,8]
numpy.histogram(a)
/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site- 
packages/numpy/lib/function_base.py:166: FutureWarning:
         The semantics of histogram will be modified in
         release 1.2 to improve outlier handling. The new behavior can  
be
         obtained using new=True. Note that the new version accepts/ 
returns
         the bin edges instead of the left bin edges.
         Please read the docstring for more information.
   Please read the docstring for more information.""", FutureWarning)
(array([1, 1, 1, 1, 0, 1, 1, 1, 1, 1]), array([ 0. ,  0.8,  1.6,   
2.4,  3.2,  4. ,  4.8,  5.6,  6.4,  7.2]))
data, bins = numpy.histogram(a)
len(data)
10
len(bins)
10
b = [1,3,5,6,9]
data, bins = numpy.histogram(a,b)
/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site- 
packages/numpy/lib/function_base.py:193: FutureWarning:
             The semantic for bins will change in version 1.2.
             The bins will become the bin edges, instead of the left  
bin edges.

   """, FutureWarning)
data
array([2, 2, 1, 3, 0])
bins
array([1, 3, 5, 6, 9])
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.


_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to