more general option + improved descriptions

hopefully more user friendly
This commit is contained in:
Martin Diehl 2018-12-10 09:27:39 +01:00
parent d219842ad8
commit 767650e002
6 changed files with 51 additions and 37 deletions

@ -1 +1 @@
Subproject commit d15faafa81e7133977dcc6a160ed73a58de69ccb
Subproject commit e3dac27b709d7fb3630bbd75271b220827221492

View File

@ -31,11 +31,11 @@ parser.add_option('-s',
dest = 'symmetry',
metavar = 'string',
help = 'crystal symmetry [%default]')
parser.add_option('-q',
'--quaternion',
parser.add_option('-o',
'--orientation',
dest = 'quaternion',
metavar = 'string',
help = 'label of quaternion')
help = 'label of crystal orientation given as unit quaternion [%default]')
parser.add_option('-p',
'--pos', '--position',
dest = 'pos',

View File

@ -18,18 +18,21 @@ Add RGB color value corresponding to TSL-OIM scheme for inverse pole figures.
""", version = scriptID)
parser.add_option('-p', '--pole',
parser.add_option('-p',
'--pole',
dest = 'pole',
type = 'float', nargs = 3, metavar = 'float float float',
help = 'lab frame direction for inverse pole figure [%default]')
parser.add_option('-s', '--symmetry',
parser.add_option('-s',
'--symmetry',
dest = 'symmetry',
type = 'choice', choices = damask.Symmetry.lattices[1:], metavar='string',
help = 'crystal symmetry [%default] {{{}}} '.format(', '.join(damask.Symmetry.lattices[1:])))
parser.add_option('-q', '--quaternion',
parser.add_option('-o',
'--orientation',
dest = 'quaternion',
type = 'string', metavar = 'string',
help = 'quaternion label')
metavar = 'string',
help = 'label of crystal orientation given as unit quaternion [%default]')
parser.set_defaults(pole = (0.0,0.0,1.0),
quaternion = 'orientation',

View File

@ -54,49 +54,53 @@ outputChoices = {
'angleaxis': ['aaxs',4],
}
parser.add_option('-o', '--output',
parser.add_option('-o',
'--output',
dest = 'output',
action = 'extend', metavar = '<string LIST>',
help = 'output orientation formats {{{}}}'.format(', '.join(outputChoices)))
parser.add_option('-d', '--degrees',
parser.add_option('-d',
'--degrees',
dest = 'degrees',
action = 'store_true',
help = 'all angles in degrees')
parser.add_option('-R', '--labrotation',
parser.add_option('-R',
'--labrotation',
dest='labrotation',
type = 'float', nargs = 4, metavar = ' '.join(['float']*4),
help = 'angle and axis of additional lab frame rotation')
parser.add_option('-r', '--crystalrotation',
parser.add_option('-r',
'--crystalrotation',
dest='crystalrotation',
type = 'float', nargs = 4, metavar = ' '.join(['float']*4),
help = 'angle and axis of additional crystal frame rotation')
parser.add_option( '--eulers',
parser.add_option('--eulers',
dest = 'eulers',
type = 'string', metavar = 'string',
metavar = 'string',
help = 'Euler angles label')
parser.add_option( '--rodrigues',
parser.add_option('--rodrigues',
dest = 'rodrigues',
type = 'string', metavar = 'string',
metavar = 'string',
help = 'Rodrigues vector label')
parser.add_option( '--matrix',
parser.add_option('--matrix',
dest = 'matrix',
type = 'string', metavar = 'string',
metavar = 'string',
help = 'orientation matrix label')
parser.add_option( '--quaternion',
parser.add_option('--quaternion',
dest = 'quaternion',
type = 'string', metavar = 'string',
metavar = 'string',
help = 'quaternion label')
parser.add_option('-x',
dest = 'x',
type = 'string', metavar = 'string',
metavar = 'string',
help = 'label of lab x vector (expressed in crystal coords)')
parser.add_option('-y',
dest = 'y',
type = 'string', metavar = 'string',
metavar = 'string',
help = 'label of lab y vector (expressed in crystal coords)')
parser.add_option('-z',
dest = 'z',
type = 'string', metavar = 'string',
metavar = 'string',
help = 'label of lab z vector (expressed in crystal coords)')
parser.set_defaults(output = [],

View File

@ -14,22 +14,24 @@ scriptID = ' '.join([scriptName,damask.version])
# --------------------------------------------------------------------
parser = OptionParser(option_class=damask.extendableOption, usage='%prog options [file[s]]', description = """
Add x,y coordinates of stereographic projection of given direction (pole) in crystal frame.
Add coordinates of stereographic projection of given direction (pole) in crystal frame.
""", version = scriptID)
parser.add_option('-p', '--pole',
parser.add_option('-p',
'--pole',
dest = 'pole',
type = 'float', nargs = 3, metavar = 'float float float',
help = 'crystal frame direction for pole figure [%default]')
parser.add_option('--polar',
dest = 'polar',
action = 'store_true',
help = 'output polar coordinates r,phi [%default]')
parser.add_option('-q', '--quaternion',
help = 'output polar coordinates (r,φ) instead of Cartesian coordinates (x,y)')
parser.add_option('-o',
'--orientation',
dest = 'quaternion',
type = 'string', metavar = 'string',
help = 'quaternion label')
metavar = 'string',
help = 'label of crystal orientation given as unit quaternion [%default]')
parser.set_defaults(pole = (1.0,0.0,0.0),
quaternion = 'orientation',

View File

@ -109,26 +109,31 @@ Add columns listing Schmid factors (and optional trace vector of selected system
""", version = scriptID)
latticeChoices = ('fcc','bcc','hex')
parser.add_option('-l','--lattice',
parser.add_option('-l',
'--lattice',
dest = 'lattice', type = 'choice', choices = latticeChoices, metavar='string',
help = 'type of lattice structure [%default] {}'.format(latticeChoices))
parser.add_option('--covera',
dest = 'CoverA', type = 'float', metavar = 'float',
help = 'C over A ratio for hexagonal systems')
parser.add_option('-f', '--force',
parser.add_option('-f',
'--force',
dest = 'force',
type = 'float', nargs = 3, metavar = 'float float float',
help = 'force direction in lab frame [%default]')
parser.add_option('-n', '--normal',
parser.add_option('-n',
'--normal',
dest = 'normal',
type = 'float', nargs = 3, metavar = 'float float float',
help = 'stress plane normal in lab frame [%default]')
parser.add_option('-q', '--quaternion',
help = 'stress plane normal in lab frame, per default perpendicular to the force')
parser.add_option('-o',
'--orientation',
dest = 'quaternion',
metavar = 'string',
help = 'quaternion label')
help = 'label of crystal orientation given as unit quaternion [%default]')
parser.set_defaults(force = (0.0,0.0,1.0),
quaternion='orientation',
normal = None,
lattice = latticeChoices[0],
CoverA = math.sqrt(8./3.),
@ -139,7 +144,7 @@ parser.set_defaults(force = (0.0,0.0,1.0),
force = np.array(options.force)
force /= np.linalg.norm(force)
if options.normal:
if options.normal is not None:
normal = np.array(options.normal)
normal /= np.linalg.norm(normal)
if abs(np.dot(force,normal)) > 1e-3: