Mercurial Hosting > traffic-intelligence
comparison trafficintelligence/tests/events.txt @ 1267:ad60e5adf084
cleaned interaction categorization and added stationary category
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Wed, 29 May 2024 09:52:42 -0400 |
parents | af329f3330ba |
children | ca70a79688ae |
comparison
equal
deleted
inserted
replaced
1266:ebb18043616e | 1267:ad60e5adf084 |
---|---|
57 >>> from numpy import pi | 57 >>> from numpy import pi |
58 >>> o1 = MovingObject.generate(0, Point(0,0), Point(1,0), TimeInterval(0,100)) | 58 >>> o1 = MovingObject.generate(0, Point(0,0), Point(1,0), TimeInterval(0,100)) |
59 >>> o2 = MovingObject.generate(0, Point(100,1), Point(-1,0), TimeInterval(0,100)) | 59 >>> o2 = MovingObject.generate(0, Point(100,1), Point(-1,0), TimeInterval(0,100)) |
60 >>> inter12 = Interaction(roadUser1 = o1, roadUser2 = o2) | 60 >>> inter12 = Interaction(roadUser1 = o1, roadUser2 = o2) |
61 >>> inter12.computeIndicators() | 61 >>> inter12.computeIndicators() |
62 >>> inter12.categorize(pi*20/180, pi*60/180) | 62 >>> inter12.categorize(pi*20/180, pi*45/180) |
63 >>> Counter(inter12.categories.values()).most_common()[0][0] # head on | 63 >>> Counter(inter12.categories.values()).most_common()[0][0] # head on |
64 0 | 64 0 |
65 >>> inter12.categories[max(inter12.categories.keys())] # then side | 65 >>> inter12.categories[max(inter12.categories.keys())] # then side |
66 2 | 66 2 |
67 >>> o3 = MovingObject.generate(0, Point(0,2), Point(1,0), TimeInterval(0,100)) | 67 >>> o3 = MovingObject.generate(0, Point(0,2), Point(1,0), TimeInterval(0,100)) |
68 >>> inter13 = Interaction(roadUser1 = o1, roadUser2 = o3) | 68 >>> inter13 = Interaction(roadUser1 = o1, roadUser2 = o3) |
69 >>> inter13.computeIndicators() | 69 >>> inter13.computeIndicators() |
70 >>> inter13.categorize(pi*20/180, pi*60/180) | 70 >>> inter13.categorize(pi*20/180, pi*45/180) |
71 >>> Counter(inter13.categories.values()).most_common()[0][0] # parallel | 71 >>> Counter(inter13.categories.values()).most_common()[0][0] # parallel |
72 3 | 72 3 |
73 >>> len(Counter(inter13.categories.values())) | 73 >>> len(Counter(inter13.categories.values())) |
74 1 | 74 1 |
75 >>> o4 = MovingObject.generate(0, Point(100,20), Point(-1,0), TimeInterval(0,100)) | 75 >>> o4 = MovingObject.generate(0, Point(100,20), Point(-1,0), TimeInterval(0,100)) |
76 >>> inter14 = Interaction(roadUser1 = o1, roadUser2 = o4) | 76 >>> inter14 = Interaction(roadUser1 = o1, roadUser2 = o4) |
77 >>> inter14.computeIndicators() | 77 >>> inter14.computeIndicators() |
78 >>> inter14.categorize(pi*20/180, pi*60/180) | 78 >>> inter14.categorize(pi*20/180, pi*45/180) |
79 >>> Counter(inter14.categories.values()).most_common()[0][0] # side | 79 >>> Counter(inter14.categories.values()).most_common()[0][0] # side |
80 2 | 80 2 |
81 >>> inter12.categories[0] # first head one | 81 >>> inter12.categories[0] # first head on |
82 0 | 82 0 |
83 >>> inter12.categories[max(inter12.categories.keys())] # then side | 83 >>> inter12.categories[max(inter12.categories.keys())] # then side |
84 2 | 84 2 |
85 >>> o5 = MovingObject.generate(0, Point(50,50), Point(0,-1), TimeInterval(0,100)) | 85 >>> o5 = MovingObject.generate(0, Point(50,50), Point(0,-1), TimeInterval(0,100)) |
86 >>> inter15 = Interaction(roadUser1 = o1, roadUser2 = o5) | 86 >>> inter15 = Interaction(roadUser1 = o1, roadUser2 = o5) |
87 >>> inter15.computeIndicators() | 87 >>> inter15.computeIndicators() |
88 >>> inter15.categorize(pi*20/180, pi*60/180) | 88 >>> inter15.categorize(pi*20/180, pi*45/180) |
89 >>> Counter(inter15.categories.values()).most_common()[0][0] # side | 89 >>> Counter(inter15.categories.values()).most_common()[0][0] # side |
90 2 | 90 2 |
91 >>> len(Counter(inter15.categories.values())) | 91 >>> len(Counter(inter15.categories.values())) |
92 1 | 92 1 |
93 >>> o6 = MovingObject.generate(0, Point(50,1), Point(0,0), TimeInterval(0,100)) | |
94 >>> inter16 = Interaction(roadUser1 = o1, roadUser2 = o6) | |
95 >>> inter16.computeIndicators() | |
96 >>> inter16.categorize(pi*20/180, pi*45/180, speedThreshold = 0.1) | |
97 >>> Counter(inter16.categories.values()).most_common()[0][0] # stationary | |
98 4 | |
99 >>> 49 in inter16.categories | |
100 True | |
101 >>> 51 in inter16.categories # not stationary interaction past the user | |
102 False |