# HG changeset patch # User Nicolas Saunier # Date 1424167338 -3600 # Node ID 2f1a583bfd2065071555452a8b2bf82173400934 # Parent 2d1d33ae1c69364b335b8b4b40bc7ae5169de820 added utility for safety points diff -r 2d1d33ae1c69 -r 2f1a583bfd20 python/events.py --- 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)