[NumPy-Tickets] [NumPy] #1788: histogramdd doesn't like bins with infinite edges

NumPy Trac numpy-tickets@scipy....
Wed Mar 30 11:33:44 CDT 2011

#1788: histogramdd doesn't like bins with infinite edges
 Reporter:  eschlafly  |       Owner:  somebody   
     Type:  defect     |      Status:  new        
 Priority:  normal     |   Milestone:  Unscheduled
Component:  numpy.lib  |     Version:  1.5.1      
 Keywords:             |  
 The following code causes an Overflow Error and doesn't need to:

 h,e = histogramdd(randn(100,2), bins=(100,[-inf,0,inf]))

 The problem is the section of code which looks for points on the right
 edge of the rightmost edge.  Specifically, it looks for the amount that is
 "close enough" to the edge via line 314 (in lib/function_base.py, v1.5.1):

 decimal = int(-log10(dedges[i].min())) +6

 but in this case dedges[i].min() == inf, triggering the overflow.
 I would propose looking for the case dedges[i].min() == inf explicitly and
 not trying to find such points in that case.

 Of course, I can get around this, but it's really convenient when the
 library is robust against such situations.

 Thanks a lot.

Ticket URL: <http://projects.scipy.org/numpy/ticket/1788>
NumPy <http://projects.scipy.org/numpy>
My example project

More information about the NumPy-Tickets mailing list