From 6eb83530b86094175422f320ad350ef80a100a81 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Fri, 5 Jun 2015 11:34:41 +0000 Subject: [PATCH] streamlining --- processing/pre/geom_fromVoronoiTessellation.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/processing/pre/geom_fromVoronoiTessellation.py b/processing/pre/geom_fromVoronoiTessellation.py index b5549bd0a..969c5d84a 100755 --- a/processing/pre/geom_fromVoronoiTessellation.py +++ b/processing/pre/geom_fromVoronoiTessellation.py @@ -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')