small adjustments for autodoc
This commit is contained in:
parent
4ce151c967
commit
fa003e8077
|
@ -41,10 +41,7 @@ parser.add_option('-f','--formula',
|
|||
|
||||
parser.add_option('-c','--condition',
|
||||
dest = 'condition', metavar='string',
|
||||
help = 'condition to alter existing column data')
|
||||
|
||||
parser.set_defaults(condition = None,
|
||||
)
|
||||
help = 'condition to alter existing column data (optional)')
|
||||
|
||||
(options,filenames) = parser.parse_args()
|
||||
|
||||
|
@ -80,7 +77,7 @@ for name in filenames:
|
|||
condition = options.condition # copy per file, since might be altered inline
|
||||
breaker = False
|
||||
|
||||
for position,(all,marker,column) in enumerate(set(re.findall(r'#(([s]#)?(.+?))#',condition))): # find three groups
|
||||
for position,(all,marker,column) in enumerate(set(re.findall(r'#(([s]#)?(.+?))#',condition))): # find three groups
|
||||
idx = table.label_index(column)
|
||||
dim = table.label_dimension(column)
|
||||
if idx < 0 and column not in specials:
|
||||
|
@ -89,15 +86,15 @@ for name in filenames:
|
|||
else:
|
||||
if column in specials:
|
||||
replacement = 'specials["{}"]'.format(column)
|
||||
elif dim == 1: # scalar input
|
||||
elif dim == 1: # scalar input
|
||||
replacement = '{}(table.data[{}])'.format({ '':'float',
|
||||
's#':'str'}[marker],idx) # take float or string value of data column
|
||||
elif dim > 1: # multidimensional input (vector, tensor, etc.)
|
||||
replacement = 'np.array(table.data[{}:{}],dtype=float)'.format(idx,idx+dim) # use (flat) array representation
|
||||
's#':'str'}[marker],idx) # take float or string value of data column
|
||||
elif dim > 1: # multidimensional input (vector, tensor, etc.)
|
||||
replacement = 'np.array(table.data[{}:{}],dtype=float)'.format(idx,idx+dim) # use (flat) array representation
|
||||
|
||||
condition = condition.replace('#'+all+'#',replacement)
|
||||
|
||||
if breaker: continue # found mistake in condition evaluation --> next file
|
||||
if breaker: continue # found mistake in condition evaluation --> next file
|
||||
|
||||
# ------------------------------------------ build formulas ----------------------------------------
|
||||
|
||||
|
|
|
@ -22,12 +22,9 @@ parser.add_option('-l','--label',
|
|||
action = 'extend', metavar = '<string LIST>',
|
||||
help = 'columns to cumulate')
|
||||
|
||||
parser.set_defaults(label = [],
|
||||
)
|
||||
|
||||
(options,filenames) = parser.parse_args()
|
||||
|
||||
if len(options.label) == 0:
|
||||
if options.label is None:
|
||||
parser.error('no data column(s) specified.')
|
||||
|
||||
# --- loop over input files -------------------------------------------------------------------------
|
||||
|
|
|
@ -111,7 +111,6 @@ parser.add_option('--nodal',
|
|||
|
||||
parser.set_defaults(defgrad = 'f',
|
||||
pos = 'pos',
|
||||
nodal = False,
|
||||
)
|
||||
|
||||
(options,filenames) = parser.parse_args()
|
||||
|
|
|
@ -34,12 +34,12 @@ parser.add_option('-o','--order',
|
|||
dest = 'order',
|
||||
type = int,
|
||||
metavar = 'int',
|
||||
help = 'order of the filter')
|
||||
help = 'order of the filter [%default]')
|
||||
parser.add_option('--sigma',
|
||||
dest = 'sigma',
|
||||
type = float,
|
||||
metavar = 'float',
|
||||
help = 'standard deviation')
|
||||
help = 'standard deviation [%default]')
|
||||
parser.add_option('--periodic',
|
||||
dest = 'periodic',
|
||||
action = 'store_true',
|
||||
|
@ -50,7 +50,6 @@ parser.add_option('--periodic',
|
|||
parser.set_defaults(pos = 'pos',
|
||||
order = 0,
|
||||
sigma = 1,
|
||||
periodic = False,
|
||||
)
|
||||
|
||||
(options,filenames) = parser.parse_args()
|
||||
|
|
|
@ -28,9 +28,9 @@ parser.add_option('-d',
|
|||
help = 'disorientation threshold in degrees [%default]')
|
||||
parser.add_option('-s',
|
||||
'--symmetry',
|
||||
dest = 'symmetry',
|
||||
dest = 'symmetry', type = 'choice', choices = damask.Symmetry.lattices[1:],
|
||||
metavar = 'string',
|
||||
help = 'crystal symmetry [%default]')
|
||||
help = 'crystal symmetry [%default] {{{}}} '.format(', '.join(damask.Symmetry.lattices[1:])))
|
||||
parser.add_option('-o',
|
||||
'--orientation',
|
||||
dest = 'quaternion',
|
||||
|
@ -49,7 +49,7 @@ parser.add_option('--quiet',
|
|||
parser.set_defaults(disorientation = 5,
|
||||
verbose = True,
|
||||
quaternion = 'orientation',
|
||||
symmetry = 'cubic',
|
||||
symmetry = damask.Symmetry.lattices[-1],
|
||||
pos = 'pos',
|
||||
)
|
||||
|
||||
|
|
|
@ -23,11 +23,12 @@ parser.add_option('-i',
|
|||
dest = 'info', action = 'extend', metavar = '<string LIST>',
|
||||
help = 'items to add')
|
||||
|
||||
parser.set_defaults(info = [],
|
||||
)
|
||||
|
||||
(options,filenames) = parser.parse_args()
|
||||
|
||||
if options.info is None:
|
||||
parser.error('no info specified.')
|
||||
|
||||
# --- loop over input files ------------------------------------------------------------------------
|
||||
|
||||
if filenames == []: filenames = [None]
|
||||
|
|
|
@ -38,13 +38,9 @@ parser.add_option('-s','--stress',
|
|||
action = 'extend', metavar = '<string LIST>',
|
||||
help = 'heading(s) of columns containing stress tensors')
|
||||
|
||||
parser.set_defaults(strain = [],
|
||||
stress = [],
|
||||
)
|
||||
|
||||
(options,filenames) = parser.parse_args()
|
||||
|
||||
if len(options.stress+options.strain) == 0:
|
||||
if options.stress is None and options.strain is None:
|
||||
parser.error('no data column specified...')
|
||||
|
||||
# --- loop over input files -------------------------------------------------------------------------
|
||||
|
|
|
@ -9,6 +9,7 @@ scriptName = os.path.splitext(os.path.basename(__file__))[0]
|
|||
scriptID = ' '.join([scriptName,damask.version])
|
||||
|
||||
# definition of element-wise p-norms for matrices
|
||||
# ToDo: better use numpy.linalg.norm
|
||||
|
||||
def norm(which,object):
|
||||
|
||||
|
@ -18,6 +19,8 @@ def norm(which,object):
|
|||
return math.sqrt(sum([x*x for x in object]))
|
||||
elif which == 'Max': # p = inf
|
||||
return max(map(abs, object))
|
||||
else:
|
||||
return -1
|
||||
|
||||
# --------------------------------------------------------------------
|
||||
# MAIN
|
||||
|
@ -43,6 +46,8 @@ parser.set_defaults(norm = 'frobenius',
|
|||
|
||||
(options,filenames) = parser.parse_args()
|
||||
|
||||
if options.norm.lower() not in normChoices:
|
||||
parser.error('invalid norm ({}) specified.'.format(options.norm))
|
||||
if options.label is None:
|
||||
parser.error('no data column specified.')
|
||||
|
||||
|
@ -74,7 +79,7 @@ for name in filenames:
|
|||
else:
|
||||
dims.append(dim)
|
||||
columns.append(table.label_index(what))
|
||||
table.labels_append('norm{}({})'.format(options.norm.capitalize(),what)) # extend ASCII header with new labels
|
||||
table.labels_append('norm{}({})'.format(options.norm.capitalize(),what)) # extend ASCII header with new labels
|
||||
|
||||
if remarks != []: damask.util.croak(remarks)
|
||||
if errors != []:
|
||||
|
|
|
@ -68,12 +68,12 @@ parser.add_option('-R',
|
|||
'--labrotation',
|
||||
dest='labrotation',
|
||||
type = 'float', nargs = 4, metavar = ' '.join(['float']*4),
|
||||
help = 'angle and axis of additional lab frame rotation')
|
||||
help = 'angle and axis of additional lab frame rotation [%default]')
|
||||
parser.add_option('-r',
|
||||
'--crystalrotation',
|
||||
dest='crystalrotation',
|
||||
type = 'float', nargs = 4, metavar = ' '.join(['float']*4),
|
||||
help = 'angle and axis of additional crystal frame rotation')
|
||||
help = 'angle and axis of additional crystal frame rotation [%default]')
|
||||
parser.add_option('--eulers',
|
||||
dest = 'eulers',
|
||||
metavar = 'string',
|
||||
|
@ -106,7 +106,6 @@ parser.add_option('-z',
|
|||
parser.set_defaults(output = [],
|
||||
labrotation = (0.,1.,1.,1.), # no rotation about 1,1,1
|
||||
crystalrotation = (0.,1.,1.,1.), # no rotation about 1,1,1
|
||||
degrees = False,
|
||||
)
|
||||
|
||||
(options, filenames) = parser.parse_args()
|
||||
|
|
|
@ -35,7 +35,6 @@ parser.add_option('-o',
|
|||
|
||||
parser.set_defaults(pole = (1.0,0.0,0.0),
|
||||
quaternion = 'orientation',
|
||||
polar = False,
|
||||
)
|
||||
|
||||
(options, filenames) = parser.parse_args()
|
||||
|
|
|
@ -115,7 +115,7 @@ parser.add_option('-l',
|
|||
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')
|
||||
help = 'C over A ratio for hexagonal systems [%default]')
|
||||
parser.add_option('-f',
|
||||
'--force',
|
||||
dest = 'force',
|
||||
|
|
|
@ -56,16 +56,15 @@ parser.add_option('-f','--defgrad',
|
|||
metavar = '<string LIST>',
|
||||
help = 'heading(s) of columns containing deformation tensor values [%default]')
|
||||
|
||||
parser.set_defaults(right = False,
|
||||
left = False,
|
||||
logarithmic = False,
|
||||
biot = False,
|
||||
green = False,
|
||||
parser.set_defaults(
|
||||
defgrad = ['f'],
|
||||
)
|
||||
|
||||
(options,filenames) = parser.parse_args()
|
||||
|
||||
if len(options.defgrad) > 1:
|
||||
options.defgrad = options.defgrad[1:]
|
||||
|
||||
stretches = []
|
||||
strains = []
|
||||
|
||||
|
|
|
@ -24,6 +24,10 @@ parser.add_option('-a', '--add','--table',
|
|||
|
||||
(options,filenames) = parser.parse_args()
|
||||
|
||||
if options.table is None:
|
||||
parser.error('no table specified.')
|
||||
|
||||
|
||||
# --- loop over input files -------------------------------------------------------------------------
|
||||
|
||||
if filenames == []: filenames = [None]
|
||||
|
|
|
@ -34,16 +34,14 @@ parser.add_option('--shift',
|
|||
parser.add_option('-g', '--grid',
|
||||
dest = 'grid',
|
||||
type = 'int', nargs = 3, metavar = 'int int int',
|
||||
help = 'grid in x,y,z [autodetect]')
|
||||
help = 'grid in x,y,z (optional)')
|
||||
parser.add_option('-s', '--size',
|
||||
dest = 'size',
|
||||
type = 'float', nargs = 3, metavar = 'float float float',
|
||||
help = 'size in x,y,z [autodetect]')
|
||||
help = 'size in x,y,z (optional)')
|
||||
parser.set_defaults(pos = 'pos',
|
||||
packing = (2,2,2),
|
||||
shift = (0,0,0),
|
||||
grid = (0,0,0),
|
||||
size = (0.0,0.0,0.0),
|
||||
)
|
||||
|
||||
(options,filenames) = parser.parse_args()
|
||||
|
@ -92,7 +90,7 @@ for name in filenames:
|
|||
|
||||
table.data_readArray()
|
||||
|
||||
if (any(options.grid) == 0 or any(options.size) == 0.0):
|
||||
if (options.grid is None or options.size is None):
|
||||
grid,size = damask.util.coordGridAndSize(table.data[:,table.label_indexrange(options.pos)])
|
||||
else:
|
||||
grid = np.array(options.grid,'i')
|
||||
|
|
|
@ -37,15 +37,15 @@ parser.add_option('-t','--type',
|
|||
parser.add_option('-x','--xrange',
|
||||
dest = 'xrange',
|
||||
type = 'float', nargs = 2, metavar = 'float float',
|
||||
help = 'min max value in x direction [autodetect]')
|
||||
help = 'min max limits in x direction (optional)')
|
||||
parser.add_option('-y','--yrange',
|
||||
dest = 'yrange',
|
||||
type = 'float', nargs = 2, metavar = 'float float',
|
||||
help = 'min max value in y direction [autodetect]')
|
||||
help = 'min max limits in y direction (optional)')
|
||||
parser.add_option('-z','--zrange',
|
||||
dest = 'zrange',
|
||||
type = 'float', nargs = 2, metavar = 'float float',
|
||||
help = 'min max value in z direction [autodetect]')
|
||||
help = 'min max limits in z direction (optional)')
|
||||
parser.add_option('-i','--invert',
|
||||
dest = 'invert',
|
||||
action = 'store_true',
|
||||
|
@ -64,9 +64,6 @@ parser.set_defaults(bins = (10,10),
|
|||
xrange = (0.0,0.0),
|
||||
yrange = (0.0,0.0),
|
||||
zrange = (0.0,0.0),
|
||||
invert = False,
|
||||
normRow = False,
|
||||
normCol = False,
|
||||
)
|
||||
|
||||
(options,filenames) = parser.parse_args()
|
||||
|
|
|
@ -27,10 +27,10 @@ parser.add_option('-p','--packing',
|
|||
help = 'dimension of packed group [%default]')
|
||||
parser.add_option('-g','--grid',
|
||||
dest = 'resolution', type = 'int', nargs = 3, metavar = 'int int int',
|
||||
help = 'resolution in x,y,z [autodetect]')
|
||||
help = 'grid in x,y,z (optional)')
|
||||
parser.add_option('-s','--size',
|
||||
dest = 'dimension', type = 'float', nargs = 3, metavar = 'int int int',
|
||||
help = 'dimension in x,y,z [autodetect]')
|
||||
help = 'size in x,y,z (optional)')
|
||||
parser.set_defaults(pos = 'pos',
|
||||
packing = (2,2,2),
|
||||
grid = (0,0,0),
|
||||
|
|
|
@ -29,7 +29,7 @@ parser.add_option('-r', '--rotation',
|
|||
parser.add_option('--degrees',
|
||||
dest = 'degrees',
|
||||
action = 'store_true',
|
||||
help = 'angles are given in degrees [%default]')
|
||||
help = 'angles are given in degrees')
|
||||
|
||||
parser.set_defaults(rotation = (0.,1.,1.,1.), # no rotation about 1,1,1
|
||||
degrees = False,
|
||||
|
|
Loading…
Reference in New Issue