Mercurial Hosting > traffic-intelligence
comparison python/events.py @ 489:000bddf84ad0
corrected bugs in safety analysis
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Fri, 11 Apr 2014 17:47:38 -0400 |
parents | e04b22ce2fcd |
children | 21bdeb29f855 |
comparison
equal
deleted
inserted
replaced
487:e04b22ce2fcd | 489:000bddf84ad0 |
---|---|
157 num = 0 | 157 num = 0 |
158 for i in xrange(len(objects)): | 158 for i in xrange(len(objects)): |
159 if _others == None: | 159 if _others == None: |
160 others = objects[:i] | 160 others = objects[:i] |
161 for j in xrange(len(others)): | 161 for j in xrange(len(others)): |
162 commonTimeInterval = objects[i].commonTimeInterval(objects[j]) | 162 commonTimeInterval = objects[i].commonTimeInterval(others[j]) |
163 if not commonTimeInterval.empty(): | 163 if not commonTimeInterval.empty(): |
164 interactions.append(Interaction(num, commonTimeInterval, objects[i].num, objects[j].num, objects[i], objects[j])) | 164 interactions.append(Interaction(num, commonTimeInterval, objects[i].num, others[j].num, objects[i], others[j])) |
165 num += 1 | 165 num += 1 |
166 return interactions | 166 return interactions |
167 | 167 |
168 def prototypeCluster(interactions, similarityMatrix, alignmentMatrix, indicatorName, minSimilarity): | 168 def prototypeCluster(interactions, similarityMatrix, alignmentMatrix, indicatorName, minSimilarity): |
169 '''Finds exemplar indicator time series for all interactions | 169 '''Finds exemplar indicator time series for all interactions |
349 | 349 |
350 | 350 |
351 if __name__ == "__main__": | 351 if __name__ == "__main__": |
352 import doctest | 352 import doctest |
353 import unittest | 353 import unittest |
354 #suite = doctest.DocFileSuite('tests/moving.txt') | 354 suite = doctest.DocFileSuite('tests/events.txt') |
355 suite = doctest.DocTestSuite() | 355 #suite = doctest.DocTestSuite() |
356 unittest.TextTestRunner().run(suite) | 356 unittest.TextTestRunner().run(suite) |
357 | 357 |