Re: [Numpy-discussion] dtype comparison, hash

2012-01-17 Thread Robert Kern
On Tue, Jan 17, 2012 at 05:11, Andreas Kloeckner li...@informa.tiker.net wrote: Hi Robert, On Fri, 30 Dec 2011 20:05:14 +, Robert Kern robert.k...@gmail.com wrote: On Fri, Dec 30, 2011 at 18:57, Andreas Kloeckner li...@informa.tiker.net wrote: Hi Robert, On Tue, 27 Dec 2011 10:17:41

[Numpy-discussion] segfault on searchsorted (1.6.2.dev-396dbb9)

2012-01-17 Thread Adam Klein
Hello, I get a segfault here: In [1]: x = np.array([1,2,3], dtype='M') In [2]: x.searchsorted(2, side='left') But it's fine here: In [1]: x = np.array([1,2,3], dtype='M') In [2]: x.view('i8').searchsorted(2, side='left') Out[2]: 1 This segfaults again:

Re: [Numpy-discussion] segfault on searchsorted (1.6.2.dev-396dbb9)

2012-01-17 Thread Charles R Harris
On Tue, Jan 17, 2012 at 8:57 AM, Adam Klein a...@lambdafoundry.com wrote: Hello, I get a segfault here: In [1]: x = np.array([1,2,3], dtype='M') In [2]: x.searchsorted(2, side='left') But it's fine here: In [1]: x = np.array([1,2,3], dtype='M') In [2]: x.view('i8').searchsorted(2,

Re: [Numpy-discussion] Counting the Colors of RGB-Image

2012-01-17 Thread Chris Barker
Here's a thought: Too bad numpy doesn't have a 24 bit integer, but you could tack a 0 on, making your image 32 bit, then use histogram2d to count the colors. something like (untested): # create the 32 bit image 32bit_im = np.zeros((w, h), dtype = np.uint32) view = 32bit_im.view(dtype =

[Numpy-discussion] Strange numpy behaviour (bug?)

2012-01-17 Thread Sturla Molden
While playing with a point-in-polygon test, I have discovered some a failure mode that I cannot make sence of. The algorithm is vectorized for NumPy from a C and Python implementation I found on the net (see links below). It is written to process a large dataset in chunks. I'm rather happy

Re: [Numpy-discussion] Strange numpy behaviour (bug?)

2012-01-17 Thread Sturla Molden
Never mind this, it was my own mistake as I expected :-) def __chunk(n,size): x = range(0,n,size) x.append(n) return zip(x[:-1],x[1:]) makes it a lot better :) Sturla Den 18.01.2012 06:26, skrev Sturla Molden: While playing with a point-in-polygon test, I have discovered