Re: [Numpy-discussion] Shared memory ndarrays (update)

2011-04-10 Thread Gael Varoquaux
Hey Sturla, It's really great that you are still working on that. I'll test the code under Linux. The scipy community has moved to github. If I create a repository under github and put the code on it, would you use it? If I find time, I'll add a setup.py. Gaƫl __

Re: [Numpy-discussion] Classes as records within an numpy array

2011-04-10 Thread David Crisp
On Mon, Apr 11, 2011 at 1:17 PM, David Crisp wrote: > On Mon, Apr 11, 2011 at 11:00 AM, Sturla Molden wrote: >> Den 11.04.2011 02:01, skrev David Crisp: >>> Can anybody guide me through this problem? I dont know how acceptable it is to answer your own question :P here goes: TO some extent I h

Re: [Numpy-discussion] Classes as records within an numpy array

2011-04-10 Thread David Crisp
On Mon, Apr 11, 2011 at 11:00 AM, Sturla Molden wrote: > Den 11.04.2011 02:01, skrev David Crisp: >> Can anybody guide me through this problem? >> > > You must use dtype=object for the array vegetation_matrix. I changed the line which set up the vegetation_matrix to be the following: vegetation_

Re: [Numpy-discussion] Classes as records within an numpy array

2011-04-10 Thread Sturla Molden
Den 11.04.2011 04:17, skrev Sturla Molden: > > Consider that x[i][j] means ( x[i] )[j]. Then consider that x[i] in your > case returns an instance of Record, not ndarray. Sorry, disregard this. a[i] is the same as a[i,:], which means that a[i,j] and a[i][j] will return the same. But a[i,j] will

Re: [Numpy-discussion] Classes as records within an numpy array

2011-04-10 Thread Sturla Molden
Den 11.04.2011 03:59, skrev David Crisp: > > Is it a significant problem if I use the x[i][j] method and not the > x[i,j] method? Or are we talking about trying to stick with a > convention? It is a significant problem. Consider that x[i][j] means ( x[i] )[j]. Then consider that x[i] in your ca

Re: [Numpy-discussion] Classes as records within an numpy array

2011-04-10 Thread David Crisp
On Mon, Apr 11, 2011 at 11:00 AM, Sturla Molden wrote: > Den 11.04.2011 02:01, skrev David Crisp: >> Can anybody guide me through this problem? >> > > You must use dtype=object for the array vegetation_matrix. Thank you. This seemed to remove the error I was having. > You also index vegetation_

Re: [Numpy-discussion] Classes as records within an numpy array

2011-04-10 Thread Sturla Molden
Den 11.04.2011 02:01, skrev David Crisp: > Can anybody guide me through this problem? > You must use dtype=object for the array vegetation_matrix. You also index vegetation_matrix wrong, use x[i,j] not x[i][j]. Sturla ___ NumPy-Discussion mailing list

[Numpy-discussion] Classes as records within an numpy array

2011-04-10 Thread David Crisp
I am trying to make a class a record within a numpy array. The piece of code I am working on has the following class within it: class Record: def __init__(self): self.count = 0 self.level = 0 self.list = [] self.max = None

Re: [Numpy-discussion] Shared memory ndarrays (update)

2011-04-10 Thread Sturla Molden
Den 11.04.2011 01:20, skrev Sturla Molden: > > I'm an idiot with build tools, hence no setup.py. Invoke Cython and > then cc. Compile sharedmemory_sysv.pyx for Linux/Unix or > sharedmemory_sysv.pyx and ntqueryobject.c for Windows. Eh, that is sharedmemory_win.pyx and ntqueryobject.c for Windows