diff --git a/examples/SpectralMethod/20grains.seeds b/examples/SpectralMethod/20grains.seeds index 466e7a1ad..63fb71936 100644 --- a/examples/SpectralMethod/20grains.seeds +++ b/examples/SpectralMethod/20grains.seeds @@ -1,25 +1,25 @@ 4 header -resolution a 16 b 16 c 16 -grains 20 +grid a 16 b 16 c 16 +microstructures 20 random seed 0 -x y z phi1 Phi phi2 - 0.375488 0.161813 0.891040 197.572861 16.816409 129.422844 - 0.187988 0.849313 0.953540 257.468172 53.250534 157.331503 - 0.750488 0.349313 0.953540 216.994815 94.418518 251.147231 - 0.312988 0.099313 0.891040 196.157946 55.870978 21.681170 - 0.562988 0.536813 0.703540 152.515728 139.769395 240.036018 - 0.750488 0.036813 0.641040 232.521881 73.749222 241.429633 - 0.812988 0.724313 0.016040 157.531396 135.503513 75.737722 - 0.187988 0.161813 0.266040 321.038280 27.209843 46.413467 - 0.562988 0.286813 0.203540 346.918594 87.495569 113.554206 - 0.937988 0.599313 0.953540 138.038947 99.827132 130.935878 - 0.937988 0.349313 0.578540 285.021014 118.092004 205.270837 - 0.812988 0.661813 0.453540 190.402171 56.738068 157.896545 - 0.125488 0.411813 0.203540 204.496042 95.031265 355.814582 - 0.625488 0.224313 0.578540 333.214790 82.133355 36.736132 - 0.687988 0.161813 0.891040 25.572981 164.242648 75.195632 - 0.625488 0.161813 0.766040 31.366548 76.392403 58.071426 - 0.437988 0.724313 0.266040 7.278623 77.044663 235.118997 - 0.437988 0.099313 0.641040 299.743144 76.475096 91.184977 - 0.937988 0.911813 0.828540 280.136430 27.439718 167.871878 - 0.437988 0.411813 0.516040 313.204373 68.676053 87.993213 +1_coords 2_coords 3_coords phi1 Phi phi2 +0.375488 0.161813 0.891040 197.572861 16.816409 129.422844 +0.187988 0.849313 0.953540 257.468172 53.250534 157.331503 +0.750488 0.349313 0.953540 216.994815 94.418518 251.147231 +0.312988 0.099313 0.891040 196.157946 55.870978 21.681170 +0.562988 0.536813 0.703540 152.515728 139.769395 240.036018 +0.750488 0.036813 0.641040 232.521881 73.749222 241.429633 +0.812988 0.724313 0.016040 157.531396 135.503513 75.737722 +0.187988 0.161813 0.266040 321.038280 27.209843 46.413467 +0.562988 0.286813 0.203540 346.918594 87.495569 113.554206 +0.937988 0.599313 0.953540 138.038947 99.827132 130.935878 +0.937988 0.349313 0.578540 285.021014 118.092004 205.270837 +0.812988 0.661813 0.453540 190.402171 56.738068 157.896545 +0.125488 0.411813 0.203540 204.496042 95.031265 355.814582 +0.625488 0.224313 0.578540 333.214790 82.133355 36.736132 +0.687988 0.161813 0.891040 25.572981 164.242648 75.195632 +0.625488 0.161813 0.766040 31.366548 76.392403 58.071426 +0.437988 0.724313 0.266040 7.278623 77.044663 235.118997 +0.437988 0.099313 0.641040 299.743144 76.475096 91.184977 +0.937988 0.911813 0.828540 280.136430 27.439718 167.871878 +0.437988 0.411813 0.516040 313.204373 68.676053 87.993213 diff --git a/processing/pre/geom_fromVoronoiTessellation.py b/processing/pre/geom_fromVoronoiTessellation.py index 5038f0eba..84f915292 100755 --- a/processing/pre/geom_fromVoronoiTessellation.py +++ b/processing/pre/geom_fromVoronoiTessellation.py @@ -105,26 +105,20 @@ for file in files: table = damask.ASCIItable(file['input'],file['output'],buffered = False) table.head_read() - labels = ['x','y','z'] - index = 0 + coordsCol = table.labels_index('1_coords') + if coordsCol < 0: + coordsCol = table.labels_index('x') # try if file is in legacy format + if coordsCol < 0: + file['croak'].write('column 1_coords/x not found...\n') + continue eulerCol = table.labels_index('phi1') hasEulers = np.all(table.labels_index(['phi1','Phi','phi2'])) != -1 grainCol = table.labels_index('microstructure') hasGrains = grainCol != -1 - if hasEulers: - labels += ['phi1','Phi','phi2'] - index += 3 - - - if hasGrains: - labels += ['microstructure'] - index += 1 - - - table.data_readArray(labels) - coords = table.data[:,0:3] + table.data_readArray() + coords = table.data[:,coordsCol:coordsCol+3] eulers = table.data[:,eulerCol:eulerCol+3] if hasEulers else np.zeros(3*len(coords)) grain = table.data[:,grainCol] if hasGrains else 1+np.arange(len(eulers)) grainIDs = np.unique(grain).astype('i') @@ -185,8 +179,8 @@ for file in files: continue #--- prepare data --------------------------------------------------------------------------------- - coords = (coords*info['size']).transpose() - eulers = eulers.transpose() + coords = (coords*info['size']).T + eulers = eulers.T #--- switch according to task --------------------------------------------------------------------- if options.config: # write config file diff --git a/processing/pre/seeds_check.py b/processing/pre/seeds_check.py index 8f6bef459..3a082b2ec 100755 --- a/processing/pre/seeds_check.py +++ b/processing/pre/seeds_check.py @@ -61,17 +61,18 @@ for file in files: table = damask.ASCIItable(file['input'],file['output']) table.head_read() - labels = ['x','y','z'] + coordsCol = table.labels_index('1_coords') + if coordsCol < 0: + coordsCol = table.labels_index('x') # try if file is in legacy format + if coordsCol < 0: + file['croak'].write('column 1_coords/x not found...\n') + continue + grainCol = table.labels_index('microstructure') hasGrains = grainCol != -1 - if hasGrains: - labels += ['microstructure'] - - - table.data_readArray(labels) - coords = table.data[:,0:3] - + table.data_readArray() + coords = table.data[:,coordsCol:coordsCol+3] grain = table.data[:,grainCol] if hasGrains else 1+np.arange(len(coords)) grainIDs = np.unique(grain).astype('i') diff --git a/processing/pre/seeds_fromGeom.py b/processing/pre/seeds_fromGeom.py index 0af7a6592..6200d6ac5 100755 --- a/processing/pre/seeds_fromGeom.py +++ b/processing/pre/seeds_fromGeom.py @@ -136,7 +136,7 @@ for file in files: "origin\tx %i\ty %i\tz %i"%(info['origin'][0],info['origin'][1],info['origin'][2],), ] table.labels_clear() - table.labels_append(['x','y','z','microstructure']) # implicitly switching label processing/writing on + table.labels_append(['1_coords','2_coords','3_coords','microstructure']) # implicitly switching label processing/writing on table.head_write() #--- filtering of grain voxels ------------------------------------------------------------------------------------ diff --git a/processing/pre/seeds_fromRandom.py b/processing/pre/seeds_fromRandom.py index 4c2c0ff6d..8272db468 100755 --- a/processing/pre/seeds_fromRandom.py +++ b/processing/pre/seeds_fromRandom.py @@ -81,7 +81,7 @@ header = ["5\theader", "grid\ta {}\tb {}\tc {}".format(options.grid[0],options.grid[1],options.grid[2]), "microstructures\t{}".format(options.N), "randomSeed\t{}".format(options.randomSeed), - "x\ty\tz\tphi1\tPhi\tphi2", + "1_coords\t2_coords\t3_coords\tphi1\tPhi\tphi2", ] for line in header: diff --git a/processing/pre/seeds_fromTable.py b/processing/pre/seeds_fromTable.py index b0ccbbe19..4b18eb79d 100755 --- a/processing/pre/seeds_fromTable.py +++ b/processing/pre/seeds_fromTable.py @@ -144,12 +144,12 @@ for file in files: map(str,boundingBox[1,:]-boundingBox[0,:])))))), ] table.labels_clear() - table.labels_append(['x','y','z','microstructure']) # implicitly switching label processing/writing on + table.labels_append(['1_coords','2_coords','3_coords','microstructure']) # implicitly switching label processing/writing on table.head_write() table.data_writeArray() table.output_flush() - table.input_close() # close input ASCII table + table.input_close() # close input ASCII table if file['name'] != 'STDIN': - table.output_close() # close output ASCII table + table.output_close() # close output ASCII table