Mercurial Hosting > traffic-intelligence
diff python/processing.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/processing.py Fri May 25 18:15:18 2018 -0400 +++ b/python/processing.py Sun May 27 23:22:48 2018 -0400 @@ -13,8 +13,8 @@ for o in objects: inPolygon = nx.points_inside_poly(o.getPositions().asArray().T, zone.T) if inPolygon.any(): - objspeeds = [o.getVelocityAt(i).norm2() for i in xrange(int(o.length()-1)) if inPolygon[i]] + objspeeds = [o.getVelocityAt(i).norm2() for i in range(int(o.length()-1)) if inPolygon[i]] speeds[o.num] = np.mean(objspeeds) # km/h else: objectsNotInZone.append(o) - return speeds.values(), speeds, objectsNotInZone + return speeds, objectsNotInZone