From ad06fc1a77e6e5632f53323bda829f2579c5bb41 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Tue, 27 Oct 2015 20:16:24 +0000 Subject: [PATCH] =?UTF-8?q?fixed=20buggy=20mapIncremental=20behavior=20for?= =?UTF-8?q?=20anything=20else=20than=20averaging=20(the=20standard=20case?= =?UTF-8?q?=20luckily=E2=80=A6)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- processing/post/postResults.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/processing/post/postResults.py b/processing/post/postResults.py index dc6cff592..db9801c48 100755 --- a/processing/post/postResults.py +++ b/processing/post/postResults.py @@ -479,13 +479,13 @@ def mapIncremental(label, mapping, N, base, new): # to a list of data # ----------------------------- - theMap = { 'min': lambda n,b,a: min(b,a), - 'max': lambda n,b,a: max(b,a), + theMap = { 'min': lambda n,b,a: a if n==0 else min(b,a), + 'max': lambda n,b,a: a if n==0 else max(b,a), 'avg': lambda n,b,a: (n*b+a)/(n+1), 'avgabs': lambda n,b,a: (n*b+abs(a))/(n+1), - 'sum': lambda n,b,a: b+a, - 'sumabs': lambda n,b,a: b+abs(a), - 'unique': lambda n,b,a: {True:a,False:'n/a'}[n==0 or b==a] + 'sum': lambda n,b,a: a if n==0 else b+a, + 'sumabs': lambda n,b,a: abs(a) if n==0 else b+abs(a), + 'unique': lambda n,b,a: a if n==0 or b==a else 'n/a' } if mapping in theMap: mapped = map(theMap[mapping],[N]*len(base),base,new) # map one of the standard functions to data