adoption of recent API change in ASCIItable.
This commit is contained in:
parent
3097c87bea
commit
5dad5df588
|
@ -57,7 +57,11 @@ group = OptionGroup(parser, "Laguerre Tessellation Options",
|
||||||
group.add_option('-w', '--weights',
|
group.add_option('-w', '--weights',
|
||||||
action = 'store_true',
|
action = 'store_true',
|
||||||
dest = 'weights',
|
dest = 'weights',
|
||||||
help = 'assign random weigts (normal distribution) to seed points for Laguerre tessellation [%default]')
|
help = 'assign random weigts to seed points for Laguerre tessellation [%default]')
|
||||||
|
group.add_option('--max',
|
||||||
|
dest = 'max',
|
||||||
|
type = 'float', metavar = 'float',
|
||||||
|
help = 'max of uniform distribution for weights [%default]')
|
||||||
group.add_option('--mean',
|
group.add_option('--mean',
|
||||||
dest = 'mean',
|
dest = 'mean',
|
||||||
type = 'float', metavar = 'float',
|
type = 'float', metavar = 'float',
|
||||||
|
@ -93,8 +97,9 @@ parser.set_defaults(randomSeed = None,
|
||||||
grid = (16,16,16),
|
grid = (16,16,16),
|
||||||
N = 20,
|
N = 20,
|
||||||
weights = False,
|
weights = False,
|
||||||
mean = 0.0,
|
max = 0.0,
|
||||||
sigma = 0.1,
|
mean = 0.2,
|
||||||
|
sigma = 0.05,
|
||||||
microstructure = 1,
|
microstructure = 1,
|
||||||
selective = False,
|
selective = False,
|
||||||
force = False,
|
force = False,
|
||||||
|
@ -114,13 +119,15 @@ random.seed(options.randomSeed)
|
||||||
|
|
||||||
# --- loop over output files -------------------------------------------------------------------------
|
# --- loop over output files -------------------------------------------------------------------------
|
||||||
|
|
||||||
if filenames == []: filenames = ['STDIN']
|
if filenames == []: filenames = [None]
|
||||||
|
|
||||||
for name in filenames:
|
for name in filenames:
|
||||||
|
try:
|
||||||
table = damask.ASCIItable(name = name, outname = None,
|
table = damask.ASCIItable(outname = name,
|
||||||
buffered = False, writeonly = True)
|
buffered = False)
|
||||||
table.croak('\033[1m'+scriptName+'\033[0m'+(': '+name if name != 'STDIN' else ''))
|
except:
|
||||||
|
continue
|
||||||
|
table.croak('\033[1m'+scriptName+'\033[0m'+(': '+name if name else ''))
|
||||||
|
|
||||||
# --- sanity checks -------------------------------------------------------------------------
|
# --- sanity checks -------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -172,21 +179,21 @@ for name in filenames:
|
||||||
if i%(options.N/100.) < 1: table.croak('.',False)
|
if i%(options.N/100.) < 1: table.croak('.',False)
|
||||||
|
|
||||||
table.croak('')
|
table.croak('')
|
||||||
seeds = np.transpose(seeds) # prepare shape for stacking
|
seeds = seeds.T # prepare shape for stacking
|
||||||
|
|
||||||
if options.weights:
|
if options.weights:
|
||||||
seeds = np.transpose(np.vstack((seeds,
|
if options.max > 0.0:
|
||||||
grainEuler,
|
weights = [np.random.uniform(low = 0, high = options.max, size = options.N)]
|
||||||
np.arange(options.microstructure,
|
else:
|
||||||
options.microstructure + options.N),
|
weights = [np.random.normal(loc = options.mean, scale = options.sigma, size = options.N)]
|
||||||
np.random.normal(loc=options.mean, scale=options.sigma, size=options.N),
|
|
||||||
)))
|
|
||||||
else:
|
else:
|
||||||
seeds = np.transpose(np.vstack((seeds,
|
weights = []
|
||||||
grainEuler,
|
seeds = np.transpose(np.vstack(tuple([seeds,
|
||||||
np.arange(options.microstructure,
|
grainEuler,
|
||||||
options.microstructure + options.N),
|
np.arange(options.microstructure,
|
||||||
)))
|
options.microstructure + options.N),
|
||||||
|
] + weights
|
||||||
|
)))
|
||||||
|
|
||||||
# ------------------------------------------ assemble header ---------------------------------------
|
# ------------------------------------------ assemble header ---------------------------------------
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue