Projects/laydi
Projects
/
laydi
Archived
7
0
Fork 0

added copy

This commit is contained in:
Arnar Flatberg 2006-10-06 10:19:19 +00:00
parent 7959a167fb
commit 7940e51867
1 changed files with 8 additions and 7 deletions

View File

@ -1,4 +1,4 @@
from scipy import ndarray,atleast_2d,asarray
from scipy import ndarray,atleast_2d,asarray,intersect1d
from scipy import sort as array_sort
from itertools import izip
import shelve
@ -156,13 +156,13 @@ class Dataset:
given dim. Index (Indices) are the Identifiers position in a
matrix in a given dim.
"""
try:
if indices!=None:
if len(indices)==0:# if empty list or empty array
indices=[]
except:
pass
return []
if indices != None:
# be sure to match intersection
#indices = intersect1d(self.get_indices(dim),indices)
ids = [self._map[dim].reverse[i] for i in indices]
else:
if sorted==True:
@ -174,7 +174,6 @@ class Dataset:
def get_indices(self, dim, idents=None):
"""Returns indices for identifiers along dimension.
You can optionally provide a list of identifiers to retrieve a
index subset.
@ -192,6 +191,8 @@ class Dataset:
return asarray(index)
def copy(self):
""" Returns deepcopy of dataset.
"""
return copy.deepcopy(self)