changed header in seeds file from 'x,y,z' to '1..3_coords'.

scripts now use the header information and do not rely on coordinates being in the first three columns
This commit is contained in:
Martin Diehl 2015-04-22 18:44:54 +00:00
parent 1f809f9d73
commit 2e6bbe887e
6 changed files with 47 additions and 52 deletions

View File

@ -1,25 +1,25 @@
4 header 4 header
resolution a 16 b 16 c 16 grid a 16 b 16 c 16
grains 20 microstructures 20
random seed 0 random seed 0
x y z phi1 Phi phi2 1_coords 2_coords 3_coords phi1 Phi phi2
0.375488 0.161813 0.891040 197.572861 16.816409 129.422844 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.187988 0.849313 0.953540 257.468172 53.250534 157.331503
0.750488 0.349313 0.953540 216.994815 94.418518 251.147231 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.312988 0.099313 0.891040 196.157946 55.870978 21.681170
0.562988 0.536813 0.703540 152.515728 139.769395 240.036018 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.750488 0.036813 0.641040 232.521881 73.749222 241.429633
0.812988 0.724313 0.016040 157.531396 135.503513 75.737722 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.187988 0.161813 0.266040 321.038280 27.209843 46.413467
0.562988 0.286813 0.203540 346.918594 87.495569 113.554206 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.599313 0.953540 138.038947 99.827132 130.935878
0.937988 0.349313 0.578540 285.021014 118.092004 205.270837 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.812988 0.661813 0.453540 190.402171 56.738068 157.896545
0.125488 0.411813 0.203540 204.496042 95.031265 355.814582 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.625488 0.224313 0.578540 333.214790 82.133355 36.736132
0.687988 0.161813 0.891040 25.572981 164.242648 75.195632 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.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.724313 0.266040 7.278623 77.044663 235.118997
0.437988 0.099313 0.641040 299.743144 76.475096 91.184977 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.937988 0.911813 0.828540 280.136430 27.439718 167.871878
0.437988 0.411813 0.516040 313.204373 68.676053 87.993213 0.437988 0.411813 0.516040 313.204373 68.676053 87.993213

View File

@ -105,26 +105,20 @@ for file in files:
table = damask.ASCIItable(file['input'],file['output'],buffered = False) table = damask.ASCIItable(file['input'],file['output'],buffered = False)
table.head_read() table.head_read()
labels = ['x','y','z'] coordsCol = table.labels_index('1_coords')
index = 0 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') eulerCol = table.labels_index('phi1')
hasEulers = np.all(table.labels_index(['phi1','Phi','phi2'])) != -1 hasEulers = np.all(table.labels_index(['phi1','Phi','phi2'])) != -1
grainCol = table.labels_index('microstructure') grainCol = table.labels_index('microstructure')
hasGrains = grainCol != -1 hasGrains = grainCol != -1
if hasEulers: table.data_readArray()
labels += ['phi1','Phi','phi2'] coords = table.data[:,coordsCol:coordsCol+3]
index += 3
if hasGrains:
labels += ['microstructure']
index += 1
table.data_readArray(labels)
coords = table.data[:,0:3]
eulers = table.data[:,eulerCol:eulerCol+3] if hasEulers else np.zeros(3*len(coords)) 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)) grain = table.data[:,grainCol] if hasGrains else 1+np.arange(len(eulers))
grainIDs = np.unique(grain).astype('i') grainIDs = np.unique(grain).astype('i')
@ -185,8 +179,8 @@ for file in files:
continue continue
#--- prepare data --------------------------------------------------------------------------------- #--- prepare data ---------------------------------------------------------------------------------
coords = (coords*info['size']).transpose() coords = (coords*info['size']).T
eulers = eulers.transpose() eulers = eulers.T
#--- switch according to task --------------------------------------------------------------------- #--- switch according to task ---------------------------------------------------------------------
if options.config: # write config file if options.config: # write config file

View File

@ -61,17 +61,18 @@ for file in files:
table = damask.ASCIItable(file['input'],file['output']) table = damask.ASCIItable(file['input'],file['output'])
table.head_read() 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') grainCol = table.labels_index('microstructure')
hasGrains = grainCol != -1 hasGrains = grainCol != -1
if hasGrains: table.data_readArray()
labels += ['microstructure'] coords = table.data[:,coordsCol:coordsCol+3]
table.data_readArray(labels)
coords = table.data[:,0:3]
grain = table.data[:,grainCol] if hasGrains else 1+np.arange(len(coords)) grain = table.data[:,grainCol] if hasGrains else 1+np.arange(len(coords))
grainIDs = np.unique(grain).astype('i') grainIDs = np.unique(grain).astype('i')

View File

@ -136,7 +136,7 @@ for file in files:
"origin\tx %i\ty %i\tz %i"%(info['origin'][0],info['origin'][1],info['origin'][2],), "origin\tx %i\ty %i\tz %i"%(info['origin'][0],info['origin'][1],info['origin'][2],),
] ]
table.labels_clear() 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.head_write()
#--- filtering of grain voxels ------------------------------------------------------------------------------------ #--- filtering of grain voxels ------------------------------------------------------------------------------------

View File

@ -81,7 +81,7 @@ header = ["5\theader",
"grid\ta {}\tb {}\tc {}".format(options.grid[0],options.grid[1],options.grid[2]), "grid\ta {}\tb {}\tc {}".format(options.grid[0],options.grid[1],options.grid[2]),
"microstructures\t{}".format(options.N), "microstructures\t{}".format(options.N),
"randomSeed\t{}".format(options.randomSeed), "randomSeed\t{}".format(options.randomSeed),
"x\ty\tz\tphi1\tPhi\tphi2", "1_coords\t2_coords\t3_coords\tphi1\tPhi\tphi2",
] ]
for line in header: for line in header:

View File

@ -144,7 +144,7 @@ for file in files:
map(str,boundingBox[1,:]-boundingBox[0,:])))))), map(str,boundingBox[1,:]-boundingBox[0,:])))))),
] ]
table.labels_clear() 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.head_write()
table.data_writeArray() table.data_writeArray()