added new predefined mapping "abssum", which returns the sum of all absolute values

This commit is contained in:
Christoph Kords 2011-06-08 14:07:15 +00:00
parent 2cbfb69235
commit 5740e13485
1 changed files with 2 additions and 1 deletions

View File

@ -359,6 +359,7 @@ def mapIncremental(label, mapping, N, base, new):
'max': lambda n,b,a: max(b,a),
'avg': lambda n,b,a: (n*b+a)/(n+1),
'sum': lambda n,b,a: b+a,
'abssum': lambda n,b,a: b+abs(a),
'unique': lambda n,b,a: {True:a,False:'n/a'}[n==0 or b==a]
}
if mapping in theMap:
@ -581,7 +582,7 @@ parser.add_option('-r','--range', dest='range', type='int', nargs=3, \
parser.add_option('--sloppy', action='store_true', dest='sloppy', \
help='do not pre-check validity of increment range')
parser.add_option('-m','--map', dest='func', type='string', \
help='data reduction mapping ["%default"] out of min, max, avg, sum or user-lambda')
help='data reduction mapping ["%default"] out of min, max, avg, sum, abssum or user-lambda')
parser.add_option('-p','--type', dest='filetype', type='string', \
help = 'type of result file [%default]')
group_material = OptionGroup(parser,'Material identifier')