nsaunier/traffic-intelligence
correction
Commit 86122f5fe500 · Nicolas Saunier · 2024-07-21 23:00 -0400
Comments
No comments yet.
Diff
diff --git a/trafficintelligence/moving.py b/trafficintelligence/moving.py
--- a/trafficintelligence/moving.py
+++ b/trafficintelligence/moving.py
@@ -1851,7 +1851,9 @@
def isStationary(self, speedThreshold, distanceThreshold):
'''Indicates if object is not moving
if speed on average below threshold and final-initial position close enough
- or the largest time interval during which the object is stationary (same condition)'''
+ or the largest interval [t1, t2] during which the object is stationary (same condition)
+
+ Returns time instants'''
speeds = self.getSpeeds()
if quantile(speeds, 0.5) <= speedThreshold and Point.distanceNorm2(self.getPositionAt(0),self.getPositionAt(-1)) <= distanceThreshold:
return True, None
@@ -1868,7 +1870,8 @@
j-=1
#incrementI = not incrementI
if i<j: # we found a smaller subset
- return True, [indices[i], indices[j]]
+ firstInstant = self.getFirstInstant()
+ return True, [indices[i]+firstInstant, indices[j]+firstInstant]
else:
return False, None
else: