streamlining

This commit is contained in:
Philip Eisenlohr 2015-06-05 11:34:41 +00:00
parent 77e799236c
commit 6eb83530b8
1 changed files with 7 additions and 8 deletions

View File

@ -153,17 +153,16 @@ for file in files:
table.head_read()
labels = []
if np.all(np.asarray(table.labels_index(['1_coords','2_coords','3_coords'])) != -1):
labels += ['1_coords','2_coords','3_coords']
if np.all(table.labels_index(['1_coords','2_coords','3_coords']) != -1):
coords = ['1_coords','2_coords','3_coords']
elif np.all(np.asarray(table.labels_index(['x','y','z'])) != -1):
labels += ['x','y','z']
elif np.all(table.labels_index(['x','y','z']) != -1):
coords = ['x','y','z']
else:
file['croak'].write('no coordinate data (1_coords/x) found ...')
file['croak'].write('no coordinate data (1/2/3_coords | x/y/z) found ...')
continue
hasEulers = np.all(np.asarray(table.labels_index(['phi1','Phi','phi2'])) != -1)
labels += coords
hasEulers = np.all(table.labels_index(['phi1','Phi','phi2']) != -1)
if hasEulers:
labels += ['phi1','Phi','phi2']
@ -178,8 +177,8 @@ for file in files:
table.data_readArray(labels)
coords = table.data[:,table.labels_index(coords)]
eulers = table.data[:,table.labels_index(['phi1','Phi','phi2'])] if hasEulers else np.zeros(3*len(coords))
grain = table.data[:,table.labels.index('microstructure')] if hasGrains else 1+np.arange(len(coords))
weights = table.data[:,table.labels.index('weight')] if hasWeight else np.zeros(len(coords))
grain = table.data[:,table.labels_index('microstructure')] if hasGrains else 1+np.arange(len(coords))
weights = table.data[:,table.labels_index('weight')] if hasWeight else np.zeros(len(coords))
grainIDs = np.unique(grain).astype('i')