Re: [Numpy-discussion] efficient 3d histogram creation

2009-05-08 Thread Dag Sverre Seljebotn
Charles R Harris wrote: > Hi Dag, > > Numpy can now do separate compilations with controlled export of symbols > when the object files are linked together to make a module. Does Cython > have > anyway of controlling the visibility of symbols or should we just include > the right files in Numpy to g

Re: [Numpy-discussion] efficient 3d histogram creation

2009-05-07 Thread Chris Colbert
after looking at it for a while, I don't see a way to easily speed it up using pure numpy. As a matter of fact, the behavior shown below is a little confusing. Using fancy indexing, multiples of the same index are interpreted as a single call to that index, probably this a for a reason that I dont

Re: [Numpy-discussion] efficient 3d histogram creation

2009-05-07 Thread Charles R Harris
2009/5/7 Dag Sverre Seljebotn > Stéfan van der Walt wrote: > > 2009/5/7 Chris Colbert : > >> This was really my first attempt at doing anything constructive with > Cython. > >> It was actually unbelievably easy to work with. I think i spent less > time > >> working on this, than I did trying to f

Re: [Numpy-discussion] efficient 3d histogram creation

2009-05-07 Thread Dag Sverre Seljebotn
Dag Sverre Seljebotn wrote: > Stéfan van der Walt wrote: >> 2009/5/7 Chris Colbert : >>> This was really my first attempt at doing anything constructive with Cython. >>> It was actually unbelievably easy to work with. I think i spent less time >>> working on this, than I did trying to find an optim

Re: [Numpy-discussion] efficient 3d histogram creation

2009-05-07 Thread Dag Sverre Seljebotn
Stéfan van der Walt wrote: > 2009/5/7 Chris Colbert : >> This was really my first attempt at doing anything constructive with Cython. >> It was actually unbelievably easy to work with. I think i spent less time >> working on this, than I did trying to find an optimized solution using pure >> numpy

Re: [Numpy-discussion] efficient 3d histogram creation

2009-05-07 Thread Stéfan van der Walt
2009/5/7 Chris Colbert : > This was really my first attempt at doing anything constructive with Cython. > It was actually unbelievably easy to work with. I think i spent less time > working on this, than I did trying to find an optimized solution using pure > numpy and python. One aspect we often

Re: [Numpy-discussion] efficient 3d histogram creation

2009-05-06 Thread Chris Colbert
nice! This was really my first attempt at doing anything constructive with Cython. It was actually unbelievably easy to work with. I think i spent less time working on this, than I did trying to find an optimized solution using pure numpy and python. Chris On Wed, May 6, 2009 at 8:21 PM, wrote:

Re: [Numpy-discussion] efficient 3d histogram creation

2009-05-06 Thread josef . pktd
On Wed, May 6, 2009 at 7:39 PM, Chris Colbert wrote: > i just realized I don't need the line: > > cdef int z = img.shape(2) > > it's left over from tinkering. sorry. And i should probably convert the out > array to type float to handle large data sets. > > Chris > > On Wed, May 6, 2009 at 7:30 PM,

Re: [Numpy-discussion] efficient 3d histogram creation

2009-05-06 Thread Chris Colbert
i just realized I don't need the line: cdef int z = img.shape(2) it's left over from tinkering. sorry. And i should probably convert the out array to type float to handle large data sets. Chris On Wed, May 6, 2009 at 7:30 PM, wrote: > On Wed, May 6, 2009 at 6:06 PM, Chris Colbert wrote: > >

Re: [Numpy-discussion] efficient 3d histogram creation

2009-05-06 Thread josef . pktd
On Wed, May 6, 2009 at 6:06 PM, Chris Colbert wrote: > I decided to hold myself over until being able to take a hard look at the > numpy histogramdd code: > > Here is a quick thing a put together in cython. It's a 40x speedup over > histogramdd on Vista 32 using the minGW32 compiler. For a (480, 6

Re: [Numpy-discussion] efficient 3d histogram creation

2009-05-06 Thread Chris Colbert
I decided to hold myself over until being able to take a hard look at the numpy histogramdd code: Here is a quick thing a put together in cython. It's a 40x speedup over histogramdd on Vista 32 using the minGW32 compiler. For a (480, 630, 3) array, this executed in 0.005 seconds on my machine. Th

Re: [Numpy-discussion] efficient 3d histogram creation

2009-05-05 Thread David Huard
On Mon, May 4, 2009 at 4:18 PM, wrote: > On Mon, May 4, 2009 at 4:00 PM, Chris Colbert wrote: > > i'll take a look at them over the next few days and see what i can hack > out. > > > > Chris > > > > On Mon, May 4, 2009 at 3:18 PM, David Huard > wrote: > >> > >> > >> On Mon, May 4, 2009 at 7:00

Re: [Numpy-discussion] efficient 3d histogram creation

2009-05-04 Thread josef . pktd
On Mon, May 4, 2009 at 4:00 PM, Chris Colbert wrote: > i'll take a look at them over the next few days and see what i can hack out. > > Chris > > On Mon, May 4, 2009 at 3:18 PM, David Huard wrote: >> >> >> On Mon, May 4, 2009 at 7:00 AM, wrote: >>> >>> On Mon, May 4, 2009 at 12:31 AM, Chris Colb

Re: [Numpy-discussion] efficient 3d histogram creation

2009-05-04 Thread Chris Colbert
i'll take a look at them over the next few days and see what i can hack out. Chris On Mon, May 4, 2009 at 3:18 PM, David Huard wrote: > > > On Mon, May 4, 2009 at 7:00 AM, wrote: > >> On Mon, May 4, 2009 at 12:31 AM, Chris Colbert >> wrote: >> > this actually sort of worked. Thanks for putti

Re: [Numpy-discussion] efficient 3d histogram creation

2009-05-04 Thread David Huard
On Mon, May 4, 2009 at 7:00 AM, wrote: > On Mon, May 4, 2009 at 12:31 AM, Chris Colbert > wrote: > > this actually sort of worked. Thanks for putting me on the right track. > > > > Here is what I ended up with. > > > > this is what I ended up with: > > > > def hist3d(imgarray): > > histarray

Re: [Numpy-discussion] efficient 3d histogram creation

2009-05-04 Thread josef . pktd
On Mon, May 4, 2009 at 12:31 AM, Chris Colbert wrote: > this actually sort of worked. Thanks for putting me on the right track. > > Here is what I ended up with. > > this is what I ended up with: > > def hist3d(imgarray): >     histarray = N.zeros((16, 16, 16)) >     temp = imgarray.copy() > b

Re: [Numpy-discussion] efficient 3d histogram creation

2009-05-03 Thread Chris Colbert
this actually sort of worked. Thanks for putting me on the right track. Here is what I ended up with. this is what I ended up with: def hist3d(imgarray): histarray = N.zeros((16, 16, 16)) temp = imgarray.copy() bins = N.arange(0, 257, 16) histarray = N.histogramdd((temp[:,:,0].r

Re: [Numpy-discussion] efficient 3d histogram creation

2009-05-03 Thread Stéfan van der Walt
Hi Chris 2009/5/4 Chris Colbert : > I'm not sure: > > the docs say the input has to be: > sample : array_like >     Data to histogram passed as a sequence of D arrays of length N, or >     as an (N,D) array > > i have an (N,M,D) array and not sure how to get it to conform to input > required, main

Re: [Numpy-discussion] efficient 3d histogram creation

2009-05-03 Thread josef . pktd
On Sun, May 3, 2009 at 8:15 PM, Chris Colbert wrote: > in my endless pursuit of perfomance, i'm searching for a quick way to create > a 3d histogram from a 3d rgb image. > > Here is what I have so far for a (16,16,16) 3d histogram: > > def hist3d(imgarray): >     histarray = N.zeros((16, 16, 16))

Re: [Numpy-discussion] efficient 3d histogram creation

2009-05-03 Thread Chris Colbert
Stefan, I'm not sure: the docs say the input has to be: sample : array_like Data to histogram passed as a sequence of D arrays of length N, or as an (N,D) array i have an (N,M,D) array and not sure how to get it to conform to input required, mainly because I don't understand what it's as

Re: [Numpy-discussion] efficient 3d histogram creation

2009-05-03 Thread Stéfan van der Walt
Hi Chris 2009/5/4 Chris Colbert : > in my endless pursuit of perfomance, i'm searching for a quick way to create > a 3d histogram from a 3d rgb image. Does histogramdd do what you want? Regards Stéfan ___ Numpy-discussion mailing list Numpy-discussion@

[Numpy-discussion] efficient 3d histogram creation

2009-05-03 Thread Chris Colbert
in my endless pursuit of perfomance, i'm searching for a quick way to create a 3d histogram from a 3d rgb image. Here is what I have so far for a (16,16,16) 3d histogram: def hist3d(imgarray): histarray = N.zeros((16, 16, 16)) temp = imgarray.copy() (i, j) = imgarray.shape[0:2] te