[Numpy-discussion] metadata and metabehavior for arrays (for scipy.base or Numeric3)

Sébastien de Menten sdementen at hotmail.com
Wed Apr 6 03:59:35 CDT 2005


>>1) attaching a physical unit to array data (see for instance Unum 
>>http://home.tiscali.be/be052320/Unum.html )
>>2) description of axis (see 
>>http://sourceforge.net/mailarchive/message.php?msg_id=11051806). Very 
>>useful to manipulate easily time series.
>
>Does the record array provide a means of addressing this need?
>

Not really, when I mean axis, I speak about indexing.
For an array (named a) with shape (10, 5, 33), I would like to attach 3 
arrays or list or tuple (named axis_information[0], axis_information[1] and 
axis_information[2])  of size (10,), (5,) and (33,)  which give sense to the 
first, second and third index.
For instance,
A[i,j,k] => means the element of A at (axis_information[0][i], 
axis_information[1][j], axis_information[2][k])
instead of
A[i,j,k] => means the element of A at index position [i,j,k] which makes 
less sense (you always need to track the meaning of i,j,k in parallel).

>>3) masked arrays as in MA module of Numeric

Maybe this one could be implemented using record array with a record like 
(data, mask).
However, it would be cumbersome to use.
E.g.  a.field("data")[:] = cos( a.field("data")[:] )
instead of
a[:] = cos(a[:])
with the current MA module

>>4) arrays for interval arithmetic where one keep another array with 
>>precision of data
>>5) record arrays (currently being integrated in scipy.base as a base type)
>>
>Yes, and there is numarray's array of objects.
>

This is overkilling as it eats way too much memory.
E.g. your data represents instantaneous speeds and so it tagged with a "m/s" 
information (a complex object) valid for the full array. Distributing this 
information to each component of an array via an array object is not 
practical.






More information about the Numpy-discussion mailing list