changeset 93:19603b5fa578

added timeinterval computation for indicators based on dictionaries
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Mon, 13 Jun 2011 14:15:08 -0400
parents a5ef9e40688e
children 7da14f07e1f9
files python/event.py python/moving.py
diffstat 2 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/python/event.py	Sun Jun 12 03:24:55 2011 -0400
+++ b/python/event.py	Mon Jun 13 14:15:08 2011 -0400
@@ -36,6 +36,7 @@
             return None
 
     def computeIndicators(self):
+        '''Computes the collision course cosine only if the cosine is positive'''
         collisionCourseDotProduct = [0]*self.timeInterval.length()
         collisionCourseCosine = {}
         distances = [0]*self.timeInterval.length()
--- a/python/moving.py	Sun Jun 12 03:24:55 2011 -0400
+++ b/python/moving.py	Mon Jun 13 14:15:08 2011 -0400
@@ -475,6 +475,12 @@
             else:
                 return self.values.values()[self.iterInstantNum-1]
 
+    def getTimeInterval(self):
+        if not self.timeInterval and type(self.values)==dict:
+            instants = self.values.keys()
+            self.timeInterval = TimeInterval(instants[0], instants[-1])
+        return self.timeInterval
+
     def getValues(self):
         if self.timeInterval:
             return self.values