Numeric arrays with named axes?

Robbie Sedgewick bobsedge at yahoo.com
Thu Oct 17 02:55:33 EDT 2002


I've been writing a lot of Numeric code lately that require arrays
with many dimensions.  I think I currently have 5 dimensional array. 
It is starting to get somewhat confusing which axis is which
especially with the different slices of the arrays floating arround.

I'm thinking what is needed is some wrapper around Numeric arrays that
allow me to refer to the axes of the array by name.  For example:

>>> x = namedarray([[1, 2], [3, 4]], axis_names=["cow", "dog"])
>>> x[{"cow":1}]
namedarray([3, 4] axis_names=["dog"])
>>> sum( x[{"cow"}:1] )
7

Has anyone done anything like this?  I started to write a wrapper
class, but it is somewhat complicated to figure out all the different
ways that numeric functions change the shape of the array.

Anyone got any better idea how to do this?

Thanks, 
Robbie



More information about the Python-list mailing list