[Numpy-discussion] PEP: named axis

Lars Friedrich lfriedri at imtek.de
Wed Feb 11 03:31:57 EST 2009


Hello list,

I am not sure, if I understood everything of the discussion on the 
named-axis-idea of numpy-arrays, since I am only a *user* of numpy. I 
never subclassed the numpy-array-class ;-)

However, I have the need to store meta-information for my arrays. I do 
this with a stand-alone class with the name 'Wave' that stores its data 
in a n-dimensional numpy-array as a member. The meta-information I store 
(using dicts and lists) is

* coordinateLabel per axis
* x0 per axis
* dx per axis

This concept is taken from the data structures in the commercial 
software IGOR, that are also called 'Waves'. An example would be an 
image I took with a microscope. The data would be 2d, say shape = (640, 
480) holding the intesity information per pixel. x0 could then be 
[-1e-6, -2e-6] and dx [100e-9, 100e-9] meaning that the image's pixel 
index [0,0] corresponds to a position of -1micrometer/-2micrometer and 
the pixels have a spacing of 100nanometers. coordinateLabels would be 
['x(m)', 'y(m)'].

If I have a movie, the data would be 3d with x0 = [-1e-6, -2e-6, 0], dx 
= [100e-9, 100e-9, 100e-3] and coordinateLabels = ['x(m)', 'y(m)', 
't(s)'] for a frame rate of 10 fps.

What I would like to say with this is the following (as a user...) :

* Meta-information is often necessary
* A string-label per axis is often not enough. Scaling is also important
* I like the idea of a most-basic-as-possible numpy-array. In my 
opinion, the meta-data-management should be done by another (sub-?) 
class. This way, numpy-arrays are simple enough for new users (as I was 
roughly two years ago...).

I would be very interested in a class that *uses* numpy-arrays to 
provide a datastructure for physical data with coordinate labels and 
scaling.

Regards,
Lars Friedrich


-- 
Dipl.-Ing. Lars Friedrich

Bio- and Nano-Photonics
Department of Microsystems Engineering -- IMTEK
University of Freiburg
Georges-Köhler-Allee 102
D-79110 Freiburg
Germany

phone: +49-761-203-7531
fax:   +49-761-203-7537
room:  01 088
email: lfriedri at imtek.de



More information about the NumPy-Discussion mailing list