Re: [Numpy-discussion] np.histogram on arrays.

2011-03-31 Thread eat
Hi, On Wed, Mar 30, 2011 at 1:44 PM, Éric Depagne wrote: > > > > Well I guess, for a slight performance improvement, you could create your > > own streamlined histogrammer. > > > > But, in order to better grasp your situation it would be beneficial to > know > > how the counts and bounds are use

Re: [Numpy-discussion] np.histogram on arrays.

2011-03-30 Thread Éric Depagne
> > Well I guess, for a slight performance improvement, you could create your > own streamlined histogrammer. > > But, in order to better grasp your situation it would be beneficial to know > how the counts and bounds are used later on. Just wondering if this kind > massive histogramming could be

Re: [Numpy-discussion] np.histogram on arrays.

2011-03-30 Thread eat
Hi, On Wed, Mar 30, 2011 at 10:04 AM, Éric Depagne wrote: > Hi. > > Sorry for not having been clearer. I'll explain a little bit. > > I have 4k x 4k images that I want to analyse. I turn them into numpy arrays > so > I have 4k x 4k np.array. > > My analysis starts with determining the bias level

Re: [Numpy-discussion] np.histogram on arrays.

2011-03-30 Thread Thouis (Ray) Jones
How about something like this: # numpy 1.6 def rowhist(A, bins=100): assert (bins > 0) assert isinstance(bins, int) rownum = np.arange(A.shape[0]).reshape((-1, 1)).astype(int) * bins intA = (bins * (A - A.min()) / float(A.max() - A.min())).astype(int) intA[intA == bins] = bins

Re: [Numpy-discussion] np.histogram on arrays.

2011-03-30 Thread Éric Depagne
Hi. Sorry for not having been clearer. I'll explain a little bit. I have 4k x 4k images that I want to analyse. I turn them into numpy arrays so I have 4k x 4k np.array. My analysis starts with determining the bias level. To do that, I compute for each line, and then for each row, an histogram

Re: [Numpy-discussion] np.histogram on arrays.

2011-03-29 Thread eat
Hi, On Tue, Mar 29, 2011 at 5:13 PM, Éric Depagne wrote: > > FWIW, have you considered to use > > > http://docs.scipy.org/doc/numpy/reference/generated/numpy.histogramdd.html# > > numpy.histogramdd > > > > Regards, > > eat > > > I tried, but I get a > /usr/lib/pymodules/python2.6/numpy/lib/funct

Re: [Numpy-discussion] np.histogram on arrays.

2011-03-29 Thread Éric Depagne
> FWIW, have you considered to use > http://docs.scipy.org/doc/numpy/reference/generated/numpy.histogramdd.html# > numpy.histogramdd > > Regards, > eat > I tried, but I get a /usr/lib/pymodules/python2.6/numpy/lib/function_base.pyc in histogramdd(sample, bins, range, normed, weights) 370

Re: [Numpy-discussion] np.histogram on arrays.

2011-03-29 Thread eat
Hi, On Tue, Mar 29, 2011 at 4:29 PM, Éric Depagne wrote: > Hi all. > > Sorry if this question has already been asked. I've searched the archive, > but > could not find anything related, so here is my question. > > I'm using np.histogram on a 4000x4000 array, each with 200 bins. I do that > on >

[Numpy-discussion] np.histogram on arrays.

2011-03-29 Thread Éric Depagne
Hi all. Sorry if this question has already been asked. I've searched the archive, but could not find anything related, so here is my question. I'm using np.histogram on a 4000x4000 array, each with 200 bins. I do that on both dimensions, meaning I compute 8000 histograms. It takes around 5 seco