changeset 1289:86122f5fe500

correction
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Sun, 21 Jul 2024 23:00:06 -0400
parents 96c7cfbdd226
children 9012fb72d79a
files trafficintelligence/moving.py
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/trafficintelligence/moving.py	Sat Jul 20 20:36:15 2024 -0400
+++ b/trafficintelligence/moving.py	Sun Jul 21 23:00:06 2024 -0400
@@ -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: