[Numpy-discussion] histogram2d bug?

Emanuele Olivetti emanuele@relativita....
Thu Apr 19 08:53:18 CDT 2007


An even simpler example generating the same error:

import numpy
x = numpy.array([0,0])
numpy.histogram2d(x,x)


HTH,

Emanuele

Emanuele Olivetti wrote:
> While using histogram2d on simple examples I got these errors:
>
> import numpy
> x = numpy.array([0,0])
> y = numpy.array([0,1])
> numpy.histogram2d(x,y,bins=[2,2])
> -----------------------------------------------------------------
> Warning: divide by zero encountered in log10
> ---------------------------------------------------------------------------
> exceptions.OverflowError                             Traceback (most
> recent call last)
>
> /home/ele/<ipython console>
>
> /usr/lib/python2.4/site-packages/numpy/lib/twodim_base.py in
> histogram2d(x, y, bins, range, normed, weights)
>     180     if N != 1 and N != 2:
>     181         xedges = yedges = asarray(bins, float)
>     182         bins = [xedges, yedges]
> --> 183     hist, edges = histogramdd([x,y], bins, range, normed, weights)
>     184     return hist, edges[0], edges[1]
>
> /usr/lib/python2.4/site-packages/numpy/lib/function_base.py in
> histogramdd(sample, bins, range, normed, weights)
>     206         decimal = int(-log10(dedges[i].min())) +6
>     207         # Find which points are on the rightmost edge.
> --> 208         on_edge = where(around(sample[:,i], decimal) ==
> around(edges[i][-1], decimal))[0]
>     209         # Shift these points one bin to the left.
>     210         Ncount[i][on_edge] -= 1
>
> /usr/lib/python2.4/site-packages/numpy/core/fromnumeric.py in round_(a,
> decimals, out)
>     687     except AttributeError:
>     688         return _wrapit(a, 'round', decimals, out)
> --> 689     return round(decimals, out)
>     690
>     691 around = round_
>
> OverflowError: long int too large to convert to int
> -----------------
>
> numpy.__version__
> '1.0.3.dev3719'
>
> Hope this report helps,
>
> Emanuele
>
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion@scipy.org
> http://projects.scipy.org/mailman/listinfo/numpy-discussion
>
>   



More information about the Numpy-discussion mailing list