[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
>>2) description of axis (see
>>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, axis_information and
axis_information) of size (10,), (5,) and (33,) which give sense to the
first, second and third index.
A[i,j,k] => means the element of A at (axis_information[i],
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
However, it would be cumbersome to use.
E.g. a.field("data")[:] = cos( a.field("data")[:] )
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
More information about the Numpy-discussion