now compatible with new table.data_readArray method

This commit is contained in:
Philip Eisenlohr 2013-12-31 21:06:32 +00:00
parent 79307de6a7
commit 4f30a6e05b
1 changed files with 33 additions and 18 deletions

View File

@ -122,15 +122,30 @@ for file in files:
theTable = damask.ASCIItable(file['input'],file['output']) theTable = damask.ASCIItable(file['input'],file['output'])
theTable.head_read() theTable.head_read()
coords = theTable.data_asArray(['x','y','z']) labels = ['x','y','z']
if numpy.all(theTable.labels_index(['phi1','Phi','phi2']) != -1): index = 0
eulers = theTable.data_asArray(['phi1','Phi','phi2']) if numpy.all(theTable.labels_index(['phi1','Phi','phi2'])) != -1:
if theTable.labels_index('microstructure') != -1: hasEulers = True
grain = theTable.data_asArray(['microstructure']) labels += ['phi1','Phi','phi2']
grainIDs = numpy.unique(grain).astype('i') index += 3
else: else:
grain = 1+numpy.arange(len(eulers)) hasEulers = False
grainIDs = grain eulerCol = index
if theTable.labels_index('microstructure') != -1:
hasGrains = True
labels += ['microstructure']
index += 1
else:
hasGrains = False
grainCol = index
theTable.data_readArray(labels)
coords = theTable.data[:,0:3]
eulers = theTable.data[:,eulerCol:eulerCol+3] if hasEulers else numpy.zeros(3*len(coords))
grain = theTable.data[:,grainCol] if hasGrains else 1+numpy.arange(len(eulers))
grainIDs = numpy.unique(grain).astype('i')
#--- interpret header ---------------------------------------------------------------------------- #--- interpret header ----------------------------------------------------------------------------
info = { info = {