Mercurial Hosting > traffic-intelligence
diff python/poly-utils.py @ 998:933670761a57
updated code to python 3 (tests pass and scripts run, but non-executed parts of code are probably still not correct)
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Sun, 27 May 2018 23:22:48 -0400 |
parents | 15e244d2a1b5 |
children |
line wrap: on
line diff
--- a/python/poly-utils.py Fri May 25 18:15:18 2018 -0400 +++ b/python/poly-utils.py Sun May 27 23:22:48 2018 -0400 @@ -23,7 +23,7 @@ inter = Interaction(interactionNum, TimeInterval(indicatorFrameNums[0],indicatorFrameNums[-1]), roaduserNum1, roaduserNum2) inter.addVideoFilename(videoFilename) inter.addInteractionType(interactionType) - for key in indicatorsNames.keys(): + for key in indicatorsNames: values= {} for i,t in enumerate(indicatorFrameNums): values[t] = data[i,key] @@ -115,7 +115,7 @@ values[k]=v return SeverityIndicator(indicatorName, values, mostSevereIsMax = False, maxValue = 1.), roadUserData else: - for i in xrange(time[0],time[-1]+1): + for i in range(time[0],time[-1]+1): try: tmp = getDataAtInstant(roadUserData, i) values[i] = np.sum(tmp[:,5]*tmp[:,6])/np.sum(tmp[:,5])/frameRate