polishing

This commit is contained in:
Martin Diehl 2019-12-05 10:37:13 +01:00
parent f885748a58
commit 53a38e3a97
2 changed files with 6 additions and 6 deletions

View File

@ -22,7 +22,7 @@ Uniformly scale column values by given factor.
""", version = scriptID) """, version = scriptID)
parser.add_option('-l','--label', parser.add_option('-l','--label',
dest = 'label', dest = 'labels',
action = 'extend', metavar = '<string LIST>', action = 'extend', metavar = '<string LIST>',
help ='column(s) to scale') help ='column(s) to scale')
parser.add_option('-f','--factor', parser.add_option('-f','--factor',
@ -31,7 +31,7 @@ parser.add_option('-f','--factor',
help = 'factor(s) per column') help = 'factor(s) per column')
parser.set_defaults(label = [], parser.set_defaults(label = [],
) factor = [])
(options,filenames) = parser.parse_args() (options,filenames) = parser.parse_args()
if filenames == []: filenames = [None] if filenames == []: filenames = [None]
@ -43,7 +43,7 @@ for name in filenames:
damask.util.report(scriptName,name) damask.util.report(scriptName,name)
table = damask.Table.from_ASCII(StringIO(''.join(sys.stdin.read())) if name is None else name) table = damask.Table.from_ASCII(StringIO(''.join(sys.stdin.read())) if name is None else name)
for i,label in enumerate(options.label): for i,label in enumerate(options.labels):
table.set(label, table.set(label,
table.get(label)*float(options.factor[i]), table.get(label)*float(options.factor[i]),
scriptID+' '+' '.join(sys.argv[1:])) scriptID+' '+' '.join(sys.argv[1:]))

View File

@ -22,7 +22,7 @@ Uniformly shift column values by given offset.
""", version = scriptID) """, version = scriptID)
parser.add_option('-l','--label', parser.add_option('-l','--label',
dest = 'label', dest = 'labels',
action = 'extend', metavar = '<string LIST>', action = 'extend', metavar = '<string LIST>',
help ='column(s) to shift') help ='column(s) to shift')
parser.add_option('-o','--offset', parser.add_option('-o','--offset',
@ -31,7 +31,7 @@ parser.add_option('-o','--offset',
help = 'offset(s) per column') help = 'offset(s) per column')
parser.set_defaults(label = [], parser.set_defaults(label = [],
) offset = [])
(options,filenames) = parser.parse_args() (options,filenames) = parser.parse_args()
if filenames == []: filenames = [None] if filenames == []: filenames = [None]
@ -43,7 +43,7 @@ for name in filenames:
damask.util.report(scriptName,name) damask.util.report(scriptName,name)
table = damask.Table.from_ASCII(StringIO(''.join(sys.stdin.read())) if name is None else name) table = damask.Table.from_ASCII(StringIO(''.join(sys.stdin.read())) if name is None else name)
for i,label in enumerate(options.label): for i,label in enumerate(options.labels):
table.set(label, table.set(label,
table.get(label)+float(options.offset[i]), table.get(label)+float(options.offset[i]),
scriptID+' '+' '.join(sys.argv[1:])) scriptID+' '+' '.join(sys.argv[1:]))