Mercurial > hg > nsaunier > traffic-intelligence
comparison trafficintelligence/tests/events.txt @ 1148:eb88d2984637
corrected interaction classification
| author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
|---|---|
| date | Tue, 12 May 2020 01:16:54 -0400 |
| parents | aafbc0bab925 |
| children | 14140b55e580 |
comparison
equal
deleted
inserted
replaced
| 1147:8c0ec7e1eb8e | 1148:eb88d2984637 |
|---|---|
| 30 True | 30 True |
| 31 >>> inter.getIndicator(Interaction.indicatorNames[1])[5] is None | 31 >>> inter.getIndicator(Interaction.indicatorNames[1])[5] is None |
| 32 True | 32 True |
| 33 >>> inter.getIndicator(Interaction.indicatorNames[1])[6] # doctest:+ELLIPSIS | 33 >>> inter.getIndicator(Interaction.indicatorNames[1])[6] # doctest:+ELLIPSIS |
| 34 3.1415... | 34 3.1415... |
| 35 | |
| 36 >>> from collections import Counter | |
| 37 >>> from numpy import pi | |
| 38 >>> o1 = MovingObject.generate(0, Point(0,0), Point(1,0), TimeInterval(0,100)) | |
| 39 >>> o2 = MovingObject.generate(0, Point(100,1), Point(-1,0), TimeInterval(0,100)) | |
| 40 >>> inter12 = Interaction(roadUser1 = o1, roadUser2 = o2) | |
| 41 >>> inter12.computeIndicators() | |
| 42 >>> inter12.categorize(pi*20/180, pi*60/180) | |
| 43 >>> Counter(inter12.categories.values()).most_common()[0][0] # head on | |
| 44 0 | |
| 45 >>> inter12.categories[max(inter12.categories.keys())] # then side | |
| 46 2 | |
| 47 >>> o3 = MovingObject.generate(0, Point(0,2), Point(1,0), TimeInterval(0,100)) | |
| 48 >>> inter13 = Interaction(roadUser1 = o1, roadUser2 = o3) | |
| 49 >>> inter13.computeIndicators() | |
| 50 >>> inter13.categorize(pi*20/180, pi*60/180) | |
| 51 >>> Counter(inter13.categories.values()).most_common()[0][0] # parallel | |
| 52 3 | |
| 53 >>> len(Counter(inter13.categories.values())) | |
| 54 1 | |
| 55 >>> o4 = MovingObject.generate(0, Point(100,20), Point(-1,0), TimeInterval(0,100)) | |
| 56 >>> inter14 = Interaction(roadUser1 = o1, roadUser2 = o4) | |
| 57 >>> inter14.computeIndicators() | |
| 58 >>> inter14.categorize(pi*20/180, pi*60/180) | |
| 59 >>> Counter(inter14.categories.values()).most_common()[0][0] # side | |
| 60 2 | |
| 61 >>> inter12.categories[0] # first head one | |
| 62 0 | |
| 63 >>> inter12.categories[max(inter12.categories.keys())] # then side | |
| 64 2 | |
| 65 >>> o5 = MovingObject.generate(0, Point(50,50), Point(0,-1), TimeInterval(0,100)) | |
| 66 >>> inter15 = Interaction(roadUser1 = o1, roadUser2 = o5) | |
| 67 >>> inter15.computeIndicators() | |
| 68 >>> inter15.categorize(pi*20/180, pi*60/180) | |
| 69 >>> Counter(inter15.categories.values()).most_common()[0][0] # side | |
| 70 2 | |
| 71 >>> len(Counter(inter15.categories.values())) | |
| 72 1 |
