From: Pierre GM <pgm...@gm...> - 2006-10-28 09:21:19
|
On Friday 27 October 2006 18:37, Albert Strasheim wrote: > Hello all ... > I would like to create an "info" array like this to attach some metadata, > mostly sampling frequency, to some of my arrays. > ... > I browsed through the NumPy book and looked at the __new__ and > __array_finalize__ stuff in Pierre GM's new MaskedArray, but I'm still > thoroughly confused about how to create a simple array+metadata subclass > that Just Works(TM). > > Does anybody have some code that they would be willing to share? I'm not sure about the JustWorks(R)(TM), but I just created a page on the Wiki describing a simple example of InfoArray class http://www.scipy.org/Subclasses That should do what you want, but let me know if you have some more specific requests. I guess I should go more into the details of subclassing on that page, but I'm quite far from being a specialist... |