correcting help and default, some comments
This commit is contained in:
parent
afb9a2186b
commit
f2c4db0bb5
|
@ -292,15 +292,15 @@ parser.add_option('--points', dest='output_points', action='store_true',
|
||||||
parser.add_option('--nopoints', dest='output_points', action='store_false',
|
parser.add_option('--nopoints', dest='output_points', action='store_false',
|
||||||
help='omit VTK points file')
|
help='omit VTK points file')
|
||||||
parser.add_option('--separator', dest='separator', type='choice', choices=sepChoices, metavar='string',
|
parser.add_option('--separator', dest='separator', type='choice', choices=sepChoices, metavar='string',
|
||||||
help='data separator (%s) [t]'%(','.join(map(str,sepChoices))))
|
help='data separator {%s} [t]'%(' '.join(map(str,sepChoices))))
|
||||||
parser.add_option('--scaling', dest='scaling', action='extend', type='string',
|
parser.add_option('--scaling', dest='scaling', action='extend', metavar = '<float LIST>',
|
||||||
help='scaling of fluctuation', metavar = '<float LIST>')
|
help='scaling of fluctuation')
|
||||||
parser.add_option('-u', '--unitlength', dest='unitlength', type='float', metavar = 'float',
|
parser.add_option('-u', '--unitlength', dest='unitlength', type='float', metavar = 'float',
|
||||||
help='set unit length for 2D model [%default]')
|
help='set unit length for 2D model [%default]')
|
||||||
parser.add_option('--filenodalcoords', dest='filenodalcoords', metavar = 'string',
|
parser.add_option('--filenodalcoords', dest='filenodalcoords', metavar = 'string',
|
||||||
help='ASCII table containing nodal coords')
|
help='ASCII table containing nodal coords')
|
||||||
parser.add_option('--labelnodalcoords', dest='labelnodalcoords', nargs=3,
|
parser.add_option('--labelnodalcoords', dest='labelnodalcoords', nargs=3,
|
||||||
help='labels of nodal coords in ASCII table %default', metavar = 'string string string')
|
help='labels of nodal coords in ASCII table {%s} '%(' '.join(map(str,%default))), metavar = 'string string string')
|
||||||
parser.add_option('-l', '--linear', dest='linearreconstruction', action='store_true',
|
parser.add_option('-l', '--linear', dest='linearreconstruction', action='store_true',
|
||||||
help='use linear reconstruction of geometry [%default]')
|
help='use linear reconstruction of geometry [%default]')
|
||||||
|
|
||||||
|
@ -319,7 +319,7 @@ parser.set_defaults(undeformed = False)
|
||||||
parser.set_defaults(unitlength = 0.0)
|
parser.set_defaults(unitlength = 0.0)
|
||||||
parser.set_defaults(cell = True)
|
parser.set_defaults(cell = True)
|
||||||
parser.set_defaults(filenodalcoords = '')
|
parser.set_defaults(filenodalcoords = '')
|
||||||
parser.set_defaults(labelnodalcoords = ['coord.x','coord.y','coord.z'])
|
parser.set_defaults(labelnodalcoords = ('coord.x','coord.y','coord.z'))
|
||||||
parser.set_defaults(linearreconstruction = False)
|
parser.set_defaults(linearreconstruction = False)
|
||||||
|
|
||||||
sep = {'n': '\n', 't': '\t', 's': ' '}
|
sep = {'n': '\n', 't': '\t', 's': ' '}
|
||||||
|
@ -528,8 +528,8 @@ for filename in args:
|
||||||
'quadruple': 4,\
|
'quadruple': 4,\
|
||||||
}
|
}
|
||||||
|
|
||||||
structure = vtk.vtkIntArray()
|
# structure = vtk.vtkIntArray()
|
||||||
structure.SetName('Microstructures')
|
# structure.SetName('Microstructures')
|
||||||
for datatype in fields.keys():
|
for datatype in fields.keys():
|
||||||
print '\n%s:'%datatype,
|
print '\n%s:'%datatype,
|
||||||
fields[datatype]['_order_'] = []
|
fields[datatype]['_order_'] = []
|
||||||
|
|
|
@ -56,6 +56,7 @@ for file in files:
|
||||||
table.head_read() # read ASCII header info
|
table.head_read() # read ASCII header info
|
||||||
table.info_append(scriptID + '\t' + ' '.join(sys.argv[1:]))
|
table.info_append(scriptID + '\t' + ' '.join(sys.argv[1:]))
|
||||||
|
|
||||||
|
# --------------- figure out columns to process ---------------------------------------------------
|
||||||
active = defaultdict(list)
|
active = defaultdict(list)
|
||||||
column = defaultdict(dict)
|
column = defaultdict(dict)
|
||||||
missingColumns = False
|
missingColumns = False
|
||||||
|
|
|
@ -42,7 +42,7 @@ parser.add_option('-d','--direction', \
|
||||||
'--hkl', dest='hkl', type='int', nargs=3, metavar='int int int',
|
'--hkl', dest='hkl', type='int', nargs=3, metavar='int int int',
|
||||||
help='direction of elastic modulus %default')
|
help='direction of elastic modulus %default')
|
||||||
parser.set_defaults(vector = [])
|
parser.set_defaults(vector = [])
|
||||||
parser.set_defaults(hkl = [1,1,1])
|
parser.set_defaults(hkl = (1,1,1))
|
||||||
|
|
||||||
(options,filenames) = parser.parse_args()
|
(options,filenames) = parser.parse_args()
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
import pdb, os, sys, gc, math, re, threading, time, struct, string
|
import pdb, os, sys, gc, math, re, threading, time, struct, string
|
||||||
import damask
|
import damask
|
||||||
from optparse import OptionParser, OptionGroup, Option, SUPPRESS_HELP
|
from optparse import OptionParser
|
||||||
|
|
||||||
|
|
||||||
fileExtensions = { \
|
fileExtensions = { \
|
||||||
|
@ -258,27 +258,6 @@ class MPIEspectral_result: # mimic py_post result object
|
||||||
def element_tensors(self):
|
def element_tensors(self):
|
||||||
return self.N_element_tensors
|
return self.N_element_tensors
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# -----------------------------
|
|
||||||
class MyOption(Option):
|
|
||||||
# -----------------------------
|
|
||||||
# used for definition of new option parser action 'extend', which enables to take multiple option arguments
|
|
||||||
# taken from online tutorial http://docs.python.org/library/optparse.html
|
|
||||||
|
|
||||||
ACTIONS = Option.ACTIONS + ("extend",)
|
|
||||||
STORE_ACTIONS = Option.STORE_ACTIONS + ("extend",)
|
|
||||||
TYPED_ACTIONS = Option.TYPED_ACTIONS + ("extend",)
|
|
||||||
ALWAYS_TYPED_ACTIONS = Option.ALWAYS_TYPED_ACTIONS + ("extend",)
|
|
||||||
|
|
||||||
def take_action(self, action, dest, opt, value, values, parser):
|
|
||||||
if action == "extend":
|
|
||||||
lvalue = value.split(",")
|
|
||||||
values.ensure_value(dest, []).extend(lvalue)
|
|
||||||
else:
|
|
||||||
Option.take_action(self, action, dest, opt, value, values, parser)
|
|
||||||
|
|
||||||
|
|
||||||
# -----------------------------
|
# -----------------------------
|
||||||
class backgroundMessage(threading.Thread):
|
class backgroundMessage(threading.Thread):
|
||||||
# -----------------------------
|
# -----------------------------
|
||||||
|
@ -644,7 +623,7 @@ def SummarizePostfile(stat,where=sys.stdout,format='marc'):
|
||||||
|
|
||||||
# --- input parsing
|
# --- input parsing
|
||||||
|
|
||||||
parser = OptionParser(option_class=MyOption, usage='%prog [options] resultfile', description = """
|
parser = OptionParser(option_class=damask.extendableOption, usage='%prog [options] resultfile', description = """
|
||||||
Extract data from a .t16 (MSC.Marc) or .spectralOut results file.
|
Extract data from a .t16 (MSC.Marc) or .spectralOut results file.
|
||||||
|
|
||||||
List of output variables is given by options '--ns','--es','--et','--ho','--cr','--co'.
|
List of output variables is given by options '--ns','--es','--et','--ho','--cr','--co'.
|
||||||
|
@ -661,7 +640,7 @@ User mappings need to be formulated in an incremental fashion for each new data
|
||||||
and may use the current (incremental) result, b(ase), as well as the number, n(umber),
|
and may use the current (incremental) result, b(ase), as well as the number, n(umber),
|
||||||
of already processed data points for evaluation.
|
of already processed data points for evaluation.
|
||||||
|
|
||||||
""" + string.replace('$Id$','\n','\\n')
|
""", version = string.replace('$Id$','\n','\\n')
|
||||||
)
|
)
|
||||||
|
|
||||||
parser.add_option('-i','--info', action='store_true', dest='info', \
|
parser.add_option('-i','--info', action='store_true', dest='info', \
|
||||||
|
|
|
@ -20,9 +20,9 @@ Uniformly scale values of scalar, vector, or tensor columns by given factor.
|
||||||
""", version = scriptID)
|
""", version = scriptID)
|
||||||
|
|
||||||
parser.add_option('-v','--vector', dest = 'vector', action = 'extend', metavar = 'string',
|
parser.add_option('-v','--vector', dest = 'vector', action = 'extend', metavar = 'string',
|
||||||
help = 'column heading of vector to scale')
|
help = 'column heading of vector to rotate')
|
||||||
parser.add_option('-t','--tensor', dest = 'tensor', action = 'extend', metavar = 'string',
|
parser.add_option('-t','--tensor', dest = 'tensor', action = 'extend', metavar = 'string',
|
||||||
help = 'column heading of tensor to scale')
|
help = 'column heading of tensor to rotate')
|
||||||
parser.add_option('-r', '--rotation',dest = 'rotation', type = 'float', nargs = 4, metavar = ' '.join(['float']*4),
|
parser.add_option('-r', '--rotation',dest = 'rotation', type = 'float', nargs = 4, metavar = ' '.join(['float']*4),
|
||||||
help = 'angle and axis to rotate data %default')
|
help = 'angle and axis to rotate data %default')
|
||||||
parser.add_option('-d', '--degrees', dest = 'degrees', action = 'store_true',
|
parser.add_option('-d', '--degrees', dest = 'degrees', action = 'store_true',
|
||||||
|
|
Loading…
Reference in New Issue