Mercurial > hg > nsaunier > traffic-intelligence
comparison python/events.py @ 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 | 3058e00887bc |
comparison
equal
deleted
inserted
replaced
| 631:2d1d33ae1c69 | 632:2f1a583bfd20 |
|---|---|
| 243 i+=1 | 243 i+=1 |
| 244 if i<len(interactions): | 244 if i<len(interactions): |
| 245 return interactions[i] | 245 return interactions[i] |
| 246 else: | 246 else: |
| 247 return None | 247 return None |
| 248 | |
| 249 def aggregateSafetyPoints(interactions, pointType = 'collision'): | |
| 250 '''Put all collision points or crossing zones in a list for display''' | |
| 251 allPoints = [] | |
| 252 if pointType == 'collision': | |
| 253 for i in interactions: | |
| 254 for points in i.collisionPoints.values(): | |
| 255 allPoints += points | |
| 256 elif pointType == 'crossing': | |
| 257 for i in interactions: | |
| 258 for points in i.crossingZones.values(): | |
| 259 allPoints += points | |
| 260 else: | |
| 261 print('unknown type of point '+pointType) | |
| 262 return allPoints | |
| 248 | 263 |
| 249 def prototypeCluster(interactions, similarityMatrix, alignmentMatrix, indicatorName, minSimilarity): | 264 def prototypeCluster(interactions, similarityMatrix, alignmentMatrix, indicatorName, minSimilarity): |
| 250 '''Finds exemplar indicator time series for all interactions | 265 '''Finds exemplar indicator time series for all interactions |
| 251 Returns the prototype indices (in the interaction list) and the label of each indicator (interaction) | 266 Returns the prototype indices (in the interaction list) and the label of each indicator (interaction) |
| 252 | 267 |
