added copy
This commit is contained in:
parent
7959a167fb
commit
7940e51867
|
@ -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 scipy import sort as array_sort
|
||||||
from itertools import izip
|
from itertools import izip
|
||||||
import shelve
|
import shelve
|
||||||
|
@ -156,13 +156,13 @@ class Dataset:
|
||||||
given dim. Index (Indices) are the Identifiers position in a
|
given dim. Index (Indices) are the Identifiers position in a
|
||||||
matrix in a given dim.
|
matrix in a given dim.
|
||||||
"""
|
"""
|
||||||
try:
|
if indices!=None:
|
||||||
if len(indices)==0:# if empty list or empty array
|
if len(indices)==0:# if empty list or empty array
|
||||||
indices=[]
|
return []
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
if indices != None:
|
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]
|
ids = [self._map[dim].reverse[i] for i in indices]
|
||||||
else:
|
else:
|
||||||
if sorted==True:
|
if sorted==True:
|
||||||
|
@ -174,7 +174,6 @@ class Dataset:
|
||||||
|
|
||||||
def get_indices(self, dim, idents=None):
|
def get_indices(self, dim, idents=None):
|
||||||
"""Returns indices for identifiers along dimension.
|
"""Returns indices for identifiers along dimension.
|
||||||
|
|
||||||
You can optionally provide a list of identifiers to retrieve a
|
You can optionally provide a list of identifiers to retrieve a
|
||||||
index subset.
|
index subset.
|
||||||
|
|
||||||
|
@ -192,6 +191,8 @@ class Dataset:
|
||||||
return asarray(index)
|
return asarray(index)
|
||||||
|
|
||||||
def copy(self):
|
def copy(self):
|
||||||
|
""" Returns deepcopy of dataset.
|
||||||
|
"""
|
||||||
return copy.deepcopy(self)
|
return copy.deepcopy(self)
|
||||||
|
|
||||||
|
|
||||||
|
|
Reference in New Issue