Mercurial Hosting > traffic-intelligence
diff python/events.py @ 378:3805b9639647
added tests for movement orientation, object size
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Thu, 18 Jul 2013 21:55:17 -0400 |
parents | c41ff9f3c263 |
children | ba813f148ade |
line wrap: on
line diff
--- a/python/events.py Thu Jul 18 02:08:51 2013 -0400 +++ b/python/events.py Thu Jul 18 21:55:17 2013 -0400 @@ -96,14 +96,10 @@ # todo test for interaction instants and interval, compute indicators # if we have features, compute other indicators - if self.roadUser1.features and self.roadUser2.features: - from scipy.spatial.distance import cdist + if self.roadUser1.features != None and self.roadUser2.features != None: minDistance={} for instant in self.timeInterval: - positions1 = [f.getPositionAtInstant(instant).astuple() for f in self.roadUser1.features if f.existsAtInstant(instant)] - positions2 = [f.getPositionAtInstant(instant).astuple() for f in self.roadUser2.features if f.existsAtInstant(instant)] - distance = cdist(positions1, positions2, metric = 'euclidean') - minDistance[instant] = distance.min() + minDistance[instant] = MovingObject.minDistance(self.roadUser1, self.roadUser2, instant) self.addIndicator(indicators.SeverityIndicator('Minimum Distance', minDistance)) def computeCrossingsCollisions(self, predictionParameters, collisionDistanceThreshold, timeHorizon, computeCZ = False, debug = False, timeInterval = None):