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