Re: [Numpy-discussion] ndarray of complex-like data

2010-02-17 Thread Robert Kern
On Wed, Feb 17, 2010 at 02:43, Brecht Machiels wrote: > Robert Kern wrote: 2) Subclass the ndarray to do what you want. >>> I have subclassed ndarray, but I'm not sure how to continue from there. >>> I was thinking of overriding __getitem__ and casting the complex to my >>> complex subclass.

Re: [Numpy-discussion] ndarray of complex-like data

2010-02-17 Thread Brecht Machiels
Robert Kern wrote: >>> 2) Subclass the ndarray to do what you want. >> I have subclassed ndarray, but I'm not sure how to continue from there. >> I was thinking of overriding __getitem__ and casting the complex to my >> complex subclass. Would that be the way to go? How would that work with >> slic

Re: [Numpy-discussion] ndarray of complex-like data

2010-02-16 Thread Robert Kern
On Tue, Feb 16, 2010 at 09:58, Brecht Machiels wrote: > Travis Oliphant wrote: >> On Feb 16, 2010, at 5:00 AM, Brecht Machiels wrote: >>> I have written a subclass of Python's complex type, which only adds a >>> couple of properties that return values calculated from the real and >>> imaginary par

Re: [Numpy-discussion] ndarray of complex-like data

2010-02-16 Thread Brecht Machiels
Travis Oliphant wrote: > On Feb 16, 2010, at 5:00 AM, Brecht Machiels wrote: >> I have written a subclass of Python's complex type, which only adds a >> couple of properties that return values calculated from the real and >> imaginary parts (magnitude and angle, for example). >> >> Now I would like

Re: [Numpy-discussion] ndarray of complex-like data

2010-02-16 Thread Travis Oliphant
On Feb 16, 2010, at 5:00 AM, Brecht Machiels wrote: Hello, I have written a subclass of Python's complex type, which only adds a couple of properties that return values calculated from the real and imaginary parts (magnitude and angle, for example). Now I would like to store objects of this n

[Numpy-discussion] ndarray of complex-like data

2010-02-16 Thread Brecht Machiels
Hello, I have written a subclass of Python's complex type, which only adds a couple of properties that return values calculated from the real and imaginary parts (magnitude and angle, for example). Now I would like to store objects of this new type in an ndarray. As the new type doesn't store