Projects/laydi
Projects
/
laydi
Archived
7
0
Fork 0

Now can get and set name in Dataset. Also added getter for dim_names.

This commit is contained in:
Truls Alexander Tangstad 2006-04-21 12:28:29 +00:00
parent 33c9da117c
commit e4831ada13
1 changed files with 7 additions and 4 deletions

View File

@ -10,7 +10,8 @@ class Dataset:
A Dataset is an n-way array with defined string identifiers across A Dataset is an n-way array with defined string identifiers across
all dimensions. all dimensions.
""" """
def __init__(self,input_array,def_list): def __init__(self, input_array, def_list, name="Unnamed data"):
self._name = name
self._data = asarray(input_array) self._data = asarray(input_array)
dims = shape(self._data) dims = shape(self._data)
self.def_list = def_list self.def_list = def_list
@ -43,9 +44,11 @@ class Dataset:
if len(df)!=d and df: if len(df)!=d and df:
raise ValueError,"dim size and identifyer mismatch" raise ValueError,"dim size and identifyer mismatch"
def __str__(self): def get_name(self):
self.name = 'Arnar' return self._name
return self.name
def get_dim_names(self):
return self._dim_names
def names(self,axis=0): def names(self,axis=0):
"""Returns identifier names of a dimension. """Returns identifier names of a dimension.