fixed bugs introduced with last commit and restored capability of handling legacy seeds format

This commit is contained in:
Martin Diehl 2015-05-08 05:02:44 +00:00
parent 4f9531e736
commit d0180540eb
1 changed files with 10 additions and 5 deletions

View File

@ -149,12 +149,17 @@ for file in files:
table.head_read() table.head_read()
labels = [] labels = []
if np.any(table.labels_index(['1_coords','2_coords','3_coords'])) == -1: if np.all(np.asarray(table.labels_index(['1_coords','2_coords','3_coords'])) != -1):
parser.error("missing seed coordinate column")
else:
labels += ['1_coords','2_coords','3_coords'] labels += ['1_coords','2_coords','3_coords']
coords = ['1_coords','2_coords','3_coords']
elif np.all(np.asarray(table.labels_index(['x','y','z'])) != -1):
labels += ['x','y','z']
coords = ['x','y','z']
else:
file['croak'].write('no coordinate data (1_coords/x) found ...')
continue
hasEulers = np.all(table.labels_index(['phi1','Phi','phi2'])) != -1 hasEulers = np.any(np.asarray(table.labels_index(['phi1','Phi','phi2'])) == -1)
if hasEulers: if hasEulers:
labels += ['phi1','Phi','phi2'] labels += ['phi1','Phi','phi2']
@ -167,7 +172,7 @@ for file in files:
labels += ['weight'] labels += ['weight']
table.data_readArray(labels) table.data_readArray(labels)
coords = table.data[:,table.labels_index(['1_coords','2_coords','3_coords'])] coords = table.data[:,table.labels_index(coords)]
eulers = table.data[:,table.labels_index(['phi1','Phi','phi2'])] if hasEulers else np.zeros(3*len(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)) 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)) weights = table.data[:,table.labels_index('weight')] if hasWeight else np.zeros(len(coords))