BIDS / datarray

Prototyping numpy arrays with named axes for data management.
http://bids.github.com/datarray
Other
87 stars 20 forks source link

Provide DataArray.labels as an attribute computed on-demand #26

Closed llvilanova closed 13 years ago

llvilanova commented 14 years ago

This attribute is not used on any critical path and, thus, can be moved to a property computing the contents on-demand.

This will eliminate inconsistencies when printing the representation or stringification of a DataArray after changing the label of any of its Axis.

Current output is:

In [1]: import datarray.datarray as da

In [2]: a = da.DataArray([1,2,3])

In [3]: a
Out[3]: 
DataArray([1, 2, 3])
(None,)

In [4]: a.ax
a.axes  a.axis  

In [4]: a.axes[0].label = "test"

In [5]: a
Out[5]: 
DataArray([1, 2, 3])
(None,)

In [6]: a.axes[0]
Out[6]: Axis(label='test', index=0, ticks=None)
terhorst commented 13 years ago

This was fixed at some point in the past year and a half. Added a test to verify. Note that axes have 'names' not 'labels' now.