adding an attribute to an nd-array

Pierre GM pgmdevlist at gmail.com
Sat Oct 28 05:14:14 EDT 2006


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...

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642




More information about the NumPy-Discussion mailing list