updated help
This commit is contained in:
parent
9e5a8d2391
commit
f42c316aa2
|
@ -34,64 +34,71 @@ Reports positions with random crystal orientations in seeds file format to STDOU
|
||||||
|
|
||||||
""", version = scriptID)
|
""", version = scriptID)
|
||||||
|
|
||||||
parser.add_option('-N', dest='N',
|
parser.add_option('-N',
|
||||||
|
dest = 'N',
|
||||||
type = 'int', metavar = 'int',
|
type = 'int', metavar = 'int',
|
||||||
help = 'number of seed points to distribute [%default]')
|
help = 'number of seed points [%default]')
|
||||||
parser.add_option('-g','--grid',
|
parser.add_option('-g',
|
||||||
|
'--grid',
|
||||||
dest = 'grid',
|
dest = 'grid',
|
||||||
type = 'int', nargs = 3, metavar = 'int int int',
|
type = 'int', nargs = 3, metavar = 'int int int',
|
||||||
help='min a,b,c grid of hexahedral box %default')
|
help='min a,b,c grid of hexahedral box %default')
|
||||||
parser.add_option('-m', '--microstructure',
|
parser.add_option('-m',
|
||||||
|
'--microstructure',
|
||||||
dest = 'microstructure',
|
dest = 'microstructure',
|
||||||
type = 'int', metavar='int',
|
type = 'int', metavar = 'int',
|
||||||
help = 'first microstructure index [%default]')
|
help = 'first microstructure index [%default]')
|
||||||
parser.add_option('-r', '--rnd',
|
parser.add_option('-r',
|
||||||
|
'--rnd',
|
||||||
dest = 'randomSeed', type = 'int', metavar = 'int',
|
dest = 'randomSeed', type = 'int', metavar = 'int',
|
||||||
help = 'seed of random number generator [%default]')
|
help = 'seed of random number generator [%default]')
|
||||||
parser.add_option('--format',
|
parser.add_option('--format',
|
||||||
dest = 'format', type = 'string', metavar = 'string',
|
dest = 'format', type = 'string', metavar = 'string',
|
||||||
help = 'number format of output [auto]')
|
help = 'output number format [auto]')
|
||||||
|
|
||||||
group = OptionGroup(parser, "Laguerre Tessellation",
|
group = OptionGroup(parser, "Laguerre Tessellation",
|
||||||
"Parameters determining shape of weight distribution of seed points"
|
"Parameters determining shape of weight distribution of seed points"
|
||||||
)
|
)
|
||||||
group.add_option('-w', '--weights',
|
group.add_option( '-w',
|
||||||
|
'--weights',
|
||||||
action = 'store_true',
|
action = 'store_true',
|
||||||
dest = 'weights',
|
dest = 'weights',
|
||||||
help = 'assign random weigts to seed points for Laguerre tessellation [%default]')
|
help = 'assign random weights to seed points for Laguerre tessellation [%default]')
|
||||||
group.add_option('--max',
|
group.add_option( '--max',
|
||||||
dest = 'max',
|
dest = 'max',
|
||||||
type = 'float', metavar = 'float',
|
type = 'float', metavar = 'float',
|
||||||
help = 'max of uniform distribution for weights [%default]')
|
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',
|
||||||
help = 'mean of normal distribution for weights [%default]')
|
help = 'mean of normal distribution for weights [%default]')
|
||||||
group.add_option('--sigma',
|
group.add_option( '--sigma',
|
||||||
dest = 'sigma',
|
dest = 'sigma',
|
||||||
type = 'float', metavar = 'float',
|
type = 'float', metavar = 'float',
|
||||||
help='standard deviation of normal distribution for weights [%default]')
|
help='standard deviation of normal distribution for weights [%default]')
|
||||||
parser.add_option_group(group)
|
parser.add_option_group(group)
|
||||||
|
|
||||||
group = OptionGroup(parser, "Selective Seeding",
|
group = OptionGroup(parser, "Selective Seeding",
|
||||||
"More uniform distribution of seed points using Mitchell's Best Candidate Algorithm"
|
"More uniform distribution of seed points using Mitchell's Best Candidate Algorithm"
|
||||||
)
|
)
|
||||||
group.add_option('-s','--selective',
|
group.add_option( '-s',
|
||||||
|
'--selective',
|
||||||
action = 'store_true',
|
action = 'store_true',
|
||||||
dest = 'selective',
|
dest = 'selective',
|
||||||
help = 'selective picking of seed points from random seed points [%default]')
|
help = 'selective picking of seed points from random seed points [%default]')
|
||||||
group.add_option('-f','--force',
|
group.add_option( '-f',
|
||||||
|
'--force',
|
||||||
action = 'store_true',
|
action = 'store_true',
|
||||||
dest = 'force',
|
dest = 'force',
|
||||||
help = 'try selective picking despite large seed point number [%default]')
|
help = 'try selective picking despite large seed point number [%default]')
|
||||||
group.add_option('--distance',
|
group.add_option( '--distance',
|
||||||
dest = 'distance',
|
dest = 'distance',
|
||||||
type = 'float', metavar = 'float',
|
type = 'float', metavar = 'float',
|
||||||
help = 'minimum distance to the next neighbor [%default]')
|
help = 'minimum distance to next neighbor [%default]')
|
||||||
group.add_option('--numCandidates',
|
group.add_option( '--numCandidates',
|
||||||
dest = 'numCandidates',
|
dest = 'numCandidates',
|
||||||
type = 'int', metavar = 'int',
|
type = 'int', metavar = 'int',
|
||||||
help = 'size of point group to select best distance from [%default]')
|
help = 'size of point group to select best distance from [%default]')
|
||||||
parser.add_option_group(group)
|
parser.add_option_group(group)
|
||||||
|
|
||||||
parser.set_defaults(randomSeed = None,
|
parser.set_defaults(randomSeed = None,
|
||||||
|
@ -124,11 +131,9 @@ random.seed(options.randomSeed)
|
||||||
if filenames == []: filenames = [None]
|
if filenames == []: filenames = [None]
|
||||||
|
|
||||||
for name in filenames:
|
for name in filenames:
|
||||||
try:
|
try: table = damask.ASCIItable(outname = name,
|
||||||
table = damask.ASCIItable(outname = name,
|
buffered = False)
|
||||||
buffered = False)
|
except: continue
|
||||||
except:
|
|
||||||
continue
|
|
||||||
damask.util.report(scriptName,name)
|
damask.util.report(scriptName,name)
|
||||||
|
|
||||||
# --- sanity checks -------------------------------------------------------------------------
|
# --- sanity checks -------------------------------------------------------------------------
|
||||||
|
@ -136,7 +141,7 @@ for name in filenames:
|
||||||
remarks = []
|
remarks = []
|
||||||
errors = []
|
errors = []
|
||||||
if gridSize == 0:
|
if gridSize == 0:
|
||||||
errors.append('zero grid dimension for %s.'%(', '.join([['a','b','c'][x] for x in np.where(options.grid == 0)[0]])))
|
errors.append('zero grid dimension for {}.'.format(', '.join([['a','b','c'][x] for x in np.where(options.grid == 0)[0]])))
|
||||||
if options.N > gridSize/10.: errors.append('seed count exceeds 0.1 of grid points.')
|
if options.N > gridSize/10.: errors.append('seed count exceeds 0.1 of grid points.')
|
||||||
if options.selective and 4./3.*math.pi*(options.distance/2.)**3*options.N > 0.5:
|
if options.selective and 4./3.*math.pi*(options.distance/2.)**3*options.N > 0.5:
|
||||||
(remarks if options.force else errors).append('maximum recommended seed point count for given distance is {}.{}'.
|
(remarks if options.force else errors).append('maximum recommended seed point count for given distance is {}.{}'.
|
||||||
|
@ -186,10 +191,8 @@ for name in filenames:
|
||||||
seeds = seeds.T # prepare shape for stacking
|
seeds = seeds.T # prepare shape for stacking
|
||||||
|
|
||||||
if options.weights:
|
if options.weights:
|
||||||
if options.max > 0.0:
|
weights = [np.random.uniform(low = 0, high = options.max, size = options.N)] if options.max > 0.0 \
|
||||||
weights = [np.random.uniform(low = 0, high = options.max, size = options.N)]
|
else [np.random.normal(loc = options.mean, scale = options.sigma, size = options.N)]
|
||||||
else:
|
|
||||||
weights = [np.random.normal(loc = options.mean, scale = options.sigma, size = options.N)]
|
|
||||||
else:
|
else:
|
||||||
weights = []
|
weights = []
|
||||||
seeds = np.transpose(np.vstack(tuple([seeds,
|
seeds = np.transpose(np.vstack(tuple([seeds,
|
||||||
|
@ -204,13 +207,13 @@ for name in filenames:
|
||||||
table.info_clear()
|
table.info_clear()
|
||||||
table.info_append([
|
table.info_append([
|
||||||
scriptID + ' ' + ' '.join(sys.argv[1:]),
|
scriptID + ' ' + ' '.join(sys.argv[1:]),
|
||||||
"grid\ta {grid[0]}\tb {grid[1]}\tc {grid[2]}".format(grid=options.grid),
|
"grid\ta {}\tb {}\tc {}".format(*options.grid),
|
||||||
"microstructures\t{}".format(options.N),
|
"microstructures\t{}".format(options.N),
|
||||||
"randomSeed\t{}".format(options.randomSeed),
|
"randomSeed\t{}".format(options.randomSeed),
|
||||||
])
|
])
|
||||||
table.labels_clear()
|
table.labels_clear()
|
||||||
table.labels_append( ['{dim}_{label}'.format(dim = 1+k,label = 'pos') for k in xrange(3)] +
|
table.labels_append( ['{dim}_{label}'.format(dim = 1+k,label = 'pos') for k in xrange(3)] +
|
||||||
['{dim}_{label}'.format(dim = 1+k,label = 'eulerangles') for k in xrange(3)] +
|
['{dim}_{label}'.format(dim = 1+k,label = 'euler') for k in xrange(3)] +
|
||||||
['microstructure'] +
|
['microstructure'] +
|
||||||
(['weight'] if options.weights else []))
|
(['weight'] if options.weights else []))
|
||||||
table.head_write()
|
table.head_write()
|
||||||
|
|
Loading…
Reference in New Issue