fixed problem when reading single label through data_readArray

This commit is contained in:
Philip Eisenlohr 2015-08-23 23:18:34 +00:00
parent 681b7f0831
commit 7ceb7f7614
1 changed files with 3 additions and 0 deletions

View File

@ -416,6 +416,7 @@ class ASCIItable():
''' '''
read whole data of all (given) labels as numpy array read whole data of all (given) labels as numpy array
''' '''
from collections import Iterable
try: try:
self.data_rewind() # try to wind back to start of data self.data_rewind() # try to wind back to start of data
@ -426,6 +427,8 @@ class ASCIItable():
use = None # use all columns (and keep labels intact) use = None # use all columns (and keep labels intact)
labels_missing = [] labels_missing = []
else: else:
if isinstance(labels, str) or not isinstance(labels, Iterable): # check whether labels are a list or single item
labels = [labels]
indices = self.label_index(labels) # check requested labels ... indices = self.label_index(labels) # check requested labels ...
dimensions = self.label_dimension(labels) # ... and remember their dimension dimensions = self.label_dimension(labels) # ... and remember their dimension
present = np.where(indices >= 0)[0] # positions in request list of labels that are present ... present = np.where(indices >= 0)[0] # positions in request list of labels that are present ...