changeset 632:2f1a583bfd20

added utility for safety points
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Tue, 17 Feb 2015 11:02:18 +0100
parents 2d1d33ae1c69
children f410c8fb07b7
files python/events.py
diffstat 1 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/python/events.py	Tue Feb 17 03:55:55 2015 +0100
+++ b/python/events.py	Tue Feb 17 11:02:18 2015 +0100
@@ -246,6 +246,21 @@
     else:
         return None
 
+def aggregateSafetyPoints(interactions, pointType = 'collision'):
+    '''Put all collision points or crossing zones in a list for display'''
+    allPoints = []
+    if pointType == 'collision':
+        for i in interactions:
+            for points in i.collisionPoints.values():
+                allPoints += points
+    elif pointType == 'crossing':
+        for i in interactions:
+            for points in i.crossingZones.values():
+                allPoints += points
+    else:
+        print('unknown type of point '+pointType)
+    return allPoints
+
 def prototypeCluster(interactions, similarityMatrix, alignmentMatrix, indicatorName, minSimilarity):
     '''Finds exemplar indicator time series for all interactions
     Returns the prototype indices (in the interaction list) and the label of each indicator (interaction)