modern python formatting
- 2 digits should be precise enough for euler angles - no need to pad grain ID with leading zeros
This commit is contained in:
parent
73df615ff3
commit
07276d511c
|
@ -274,21 +274,19 @@ for name in filenames:
|
||||||
indices = laguerreTessellation(grid, coords, weights, grains, options.periodic, options.cpus)
|
indices = laguerreTessellation(grid, coords, weights, grains, options.periodic, options.cpus)
|
||||||
|
|
||||||
config_header = []
|
config_header = []
|
||||||
formatwidth = 1+int(np.floor(np.log10(np.nanmax(NgrainIDs)-1)))
|
|
||||||
|
|
||||||
if options.config:
|
if options.config:
|
||||||
config_header += ['<microstructure>']
|
config_header += ['<microstructure>']
|
||||||
for i,ID in enumerate(grainIDs):
|
for ID in grainIDs:
|
||||||
config_header += ['[Grain{}]'.format(str(ID).zfill(formatwidth)),
|
config_header += ['[Grain{}]'.format(ID),
|
||||||
'crystallite 1',
|
'crystallite 1',
|
||||||
'(constituent)\tphase {}\ttexture {}\tfraction 1.0'.format(options.phase,str(ID).rjust(formatwidth)),
|
'(constituent)\tphase {}\ttexture {}\tfraction 1.0'.format(options.phase,ID)
|
||||||
]
|
]
|
||||||
if hasEulers:
|
if hasEulers:
|
||||||
config_header += ['<texture>']
|
config_header += ['<texture>']
|
||||||
for ID in grainIDs:
|
for ID in grainIDs:
|
||||||
eulerID = np.nonzero(grains == ID)[0][0] # find first occurrence of this grain id
|
eulerID = np.nonzero(grains == ID)[0][0] # find first occurrence of this grain id
|
||||||
config_header += ['[Grain{}]'.format(str(ID).zfill(formatwidth)),
|
config_header += ['[Grain{}]'.format(ID),
|
||||||
'(gauss)\tphi1 {:g}\tPhi {:g}\tphi2 {:g}'.format(*eulers[eulerID])
|
'(gauss)\tphi1 {:.2f}\tPhi {:.2f}\tphi2 {:.2f}'.format(*eulers[eulerID])
|
||||||
]
|
]
|
||||||
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 += ['<!skip>']
|
config_header += ['<!skip>']
|
||||||
|
|
Loading…
Reference in New Issue