Skip to content

Commit

Permalink
Merge branch '#26' of http://github.com/xscript/datarray into x-master
Browse files Browse the repository at this point in the history
  • Loading branch information
kwgoodman committed Oct 6, 2010
2 parents 22afb88 + a250f98 commit a66b871
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions datarray/datarray.py
Expand Up @@ -460,7 +460,6 @@ def _set_axes(dest, in_axes):
- axis: a KeyStruct with each axis as a named attribute.
- axes: a list of all axis instances.
- labels: a list of all the axis labels.
Parameters
----------
Expand All @@ -470,7 +469,6 @@ def _set_axes(dest, in_axes):
# XXX: This method is called multiple times during a DataArray's lifetime.
# Should rethink exactly when Axis copies need to be made
axes = []
labels = []
ax_holder = KeyStruct()
# Create the containers for various axis-related info
for ax in in_axes:
Expand All @@ -481,11 +479,9 @@ def _set_axes(dest, in_axes):
'There is another Axis in this group with ' \
'the same name'
)
labels.append(ax.label)
ax_holder[ax.name] = new_ax
# Store these containers as attributes of the destination array
dest.axes = tuple(axes)
dest.labels = tuple(labels)
dest.axis = ax_holder


Expand Down Expand Up @@ -621,6 +617,11 @@ def aix(self):
def set_label(self, i, label):
self.axes[i].set_label(label)

@property
def labels (self):
"""Returns a tuple with all the axis labels."""
return tuple((ax.label for ax in self.axes))

def __array_finalize__(self, obj):
"""Called by ndarray on subobject (like views/slices) creation.
Expand Down

0 comments on commit a66b871

Please sign in to comment.