Mercurial Hosting > traffic-intelligence
changeset 521:3707eeb20f25
changed argMaxDict name to argmaxDict
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Wed, 18 Jun 2014 17:37:28 -0400 |
parents | fd9641cbd24b |
children | ce40a89bd6ae |
files | python/utils.py |
diffstat | 1 files changed, 2 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/python/utils.py Wed Jun 18 01:19:18 2014 -0400 +++ b/python/utils.py Wed Jun 18 17:37:28 2014 -0400 @@ -208,7 +208,7 @@ from numpy import median return median([y for observedx, y in zip(X,Y) if abs(x-observedx)<halfwidth]) -def argMaxDict(d): +def argmaxDict(d): return max(d.iterkeys(), key=(lambda key: d[key])) def framesToTime(nFrames, frameRate, initialTime = time()): @@ -367,7 +367,7 @@ lcssValues[i] = self.similarityTable.max() similarityTables[i] = self.similarityTable #print self.similarityTable - alignmentShift = argMaxDict(lcssValues) # ideally get the medium alignment shift, the one that minimizes distance + alignmentShift = argmaxDict(lcssValues) # ideally get the medium alignment shift, the one that minimizes distance self.similarityTable = similarityTables[alignmentShift] else: alignmentShift = 0