diff --git a/processing/pre/geom_fromDREAM3D.py b/processing/pre/geom_fromDREAM3D.py index 97ee2f84b..02a2fe0da 100755 --- a/processing/pre/geom_fromDREAM3D.py +++ b/processing/pre/geom_fromDREAM3D.py @@ -136,20 +136,19 @@ for name in filenames: if errors != []: damask.util.croak(errors) continue - - config_header = [''] + + config_header = [''] + for i in range(np.nanmax(microstructure)): + config_header += ['[{}{}]'.format(label,i+1), + '(gauss)\tphi1 {:.2f}\tPhi {:.2f}\tphi2 {:.2f}'.format(*rot[i].asEulers(degrees = True)), + ] + config_header += [''] for i in range(np.nanmax(microstructure)): config_header += ['[{}{}]'.format(label,i+1), 'crystallite 1', '(constituent)\tphase {}\ttexture {}\tfraction 1.0'.format(phase[i],i+1), ] - - config_header += [''] - for i in range(np.nanmax(microstructure)): - config_header += ['[{}{}]'.format(label,i+1), - '(gauss)\tphi1 {:.2f}\tPhi {:.2f}\tphi2 {:.2f}'.format(*rot[i].asEulers(degrees = True)), - ] - + header = [scriptID + ' ' + ' '.join(sys.argv[1:])]\ + config_header geom = damask.Geom(microstructure,size,origin, diff --git a/processing/pre/geom_fromOsteonGeometry.py b/processing/pre/geom_fromOsteonGeometry.py index ebfde38fa..d312220a7 100755 --- a/processing/pre/geom_fromOsteonGeometry.py +++ b/processing/pre/geom_fromOsteonGeometry.py @@ -114,25 +114,28 @@ for y in range(grid[1]): Beta [i] = beta [x,y] i+=1 -config_header = [] -config_header.append('') -config_header.append('[canal]') -config_header.append('crystallite 1') -config_header.append('(constituent)\tphase 1\ttexture 1\tfraction 1.0') -config_header.append('[interstitial]') -config_header.append('crystallite 1') -config_header.append('(constituent)\tphase 2\ttexture 2\tfraction 1.0') +config_header = ['', + '[canal]', + '[interstitial]' + ] for i in range(3,np.max(microstructure)): - config_header.append('[Point{}]'.format(i-2)) - config_header.append('crystallite 1') - config_header.append('(constituent)\tphase 3\ttexture {}\tfraction 1.0'.format(i)) - -config_header.append('') -config_header.append('[canal]') -config_header.append('[interstitial]') + config_header += ['[Point{}]'.format(i-2), + '(gauss)\tphi1 {:.2f}\tPhi {:.2f}\tphi2 0'.format(Alpha[i],Beta[i]) + ] + +config_header = ['', + '[canal]', + 'crystallite 1', + '(constituent)\tphase 1\ttexture 1\tfraction 1.0', + '[interstitial]', + 'crystallite 1', + '(constituent)\tphase 2\ttexture 2\tfraction 1.0' + ] for i in range(3,np.max(microstructure)): - config_header.append('[Point{}]'.format(i-2)) - config_header.append('(gauss)\tphi1 {:.2f}\tPhi {:.2f}\tphi2 0'.format(Alpha[i],Beta[i])) + config_header += ['[Point{}]'.format(i-2), + 'crystallite 1', + '(constituent)\tphase 3\ttexture {}\tfraction 1.0'.format(i) + ] header = [scriptID + ' ' + ' '.join(sys.argv[1:])]\ + config_header diff --git a/processing/pre/geom_fromTable.py b/processing/pre/geom_fromTable.py index 53eb06316..1ef9822a4 100755 --- a/processing/pre/geom_fromTable.py +++ b/processing/pre/geom_fromTable.py @@ -131,20 +131,20 @@ for name in filenames: microstructure[x,y,z] = unique_inverse[indices[i]]+1 i+=1 - config_header = [''] - for i,data in enumerate(unique): - config_header += ['[Grain{}]'.format(i+1), - 'crystallite 1', - '(constituent)\tphase {}\ttexture {}\tfraction 1.0'.format(int(data[4]),i+1), - ] - - config_header += [''] + config_header = [''] for i,data in enumerate(unique): ori = damask.Rotation(data[0:4]) config_header += ['[Grain{}]'.format(i+1), '(gauss)\tphi1 {:g}\tPhi {:g}\tphi2 {:g}'.format(*ori.asEulers(degrees = True)), ] - if options.axes is not None: config_header += ['axes\t{} {} {}'.format(*options.axes)] + if options.axes is not None: config_header += ['axes\t{} {} {}'.format(*options.axes)] + + config_header += [''] + for i,data in enumerate(unique): + config_header += ['[Grain{}]'.format(i+1), + 'crystallite 1', + '(constituent)\tphase {}\ttexture {}\tfraction 1.0'.format(int(data[4]),i+1), + ] header = [scriptID + ' ' + ' '.join(sys.argv[1:])]\ + config_header diff --git a/processing/pre/geom_fromVoronoiTessellation.py b/processing/pre/geom_fromVoronoiTessellation.py index 18b9b8b7f..08b069410 100755 --- a/processing/pre/geom_fromVoronoiTessellation.py +++ b/processing/pre/geom_fromVoronoiTessellation.py @@ -277,12 +277,7 @@ for name in filenames: config_header = [] if options.config: - config_header += [''] - for ID in grainIDs: - config_header += ['[Grain{}]'.format(ID), - 'crystallite 1', - '(constituent)\tphase {}\ttexture {}\tfraction 1.0'.format(options.phase,ID) - ] + if hasEulers: config_header += [''] for ID in grainIDs: @@ -291,6 +286,14 @@ for name in filenames: '(gauss)\tphi1 {:.2f}\tPhi {:.2f}\tphi2 {:.2f}'.format(*eulers[eulerID]) ] if options.axes is not None: config_header += ['axes\t{} {} {}'.format(*options.axes)] + + config_header += [''] + for ID in grainIDs: + config_header += ['[Grain{}]'.format(ID), + 'crystallite 1', + '(constituent)\tphase {}\ttexture {}\tfraction 1.0'.format(options.phase,ID) + ] + config_header += [''] header = [scriptID + ' ' + ' '.join(sys.argv[1:])]\