comparison trafficintelligence/tests/events.txt @ 1150:14140b55e580

corrected issue with motion pattern for motion prediction for safety analysis (to few matches)
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Thu, 28 May 2020 01:03:45 -0400
parents eb88d2984637
children 658f87232536
comparison
equal deleted inserted replaced
1149:392db62ea1da 1150:14140b55e580
8 0 8 0
9 >>> objects2 = [MovingObject(num = i, timeInterval = TimeInterval(0,10)) for i in range(100, 110)] 9 >>> objects2 = [MovingObject(num = i, timeInterval = TimeInterval(0,10)) for i in range(100, 110)]
10 >>> interactions = createInteractions(objects, objects2) 10 >>> interactions = createInteractions(objects, objects2)
11 >>> len([i for i in interactions if len(i.roadUserNumbers) == 1]) 11 >>> len([i for i in interactions if len(i.roadUserNumbers) == 1])
12 0 12 0
13
14 >>> o1 = MovingObject.generate(1, Point(-5.,0.), Point(0.,0.), TimeInterval(0,10))
15 >>> o2 = MovingObject.generate(2, Point(0.,-5.), Point(0.,1.), TimeInterval(0,10))
16 >>> inter = Interaction(roadUser1 = o1, roadUser2 = o2)
17 >>> inter.computeIndicators() # should not crash with 0 speed
18 >>> va = inter.getIndicator("Velocity Angle")
19 >>> va.empty()
20 True
13 21
14 >>> o1 = MovingObject.generate(1, Point(-5.,0.), Point(1.,0.), TimeInterval(0,10)) 22 >>> o1 = MovingObject.generate(1, Point(-5.,0.), Point(1.,0.), TimeInterval(0,10))
15 >>> o2 = MovingObject.generate(2, Point(0.,-5.), Point(0.,1.), TimeInterval(0,10)) 23 >>> o2 = MovingObject.generate(2, Point(0.,-5.), Point(0.,1.), TimeInterval(0,10))
16 >>> inter = Interaction(roadUser1 = o1, roadUser2 = o2) 24 >>> inter = Interaction(roadUser1 = o1, roadUser2 = o2)
17 >>> inter.computeIndicators() 25 >>> inter.computeIndicators()
31 >>> inter.getIndicator(Interaction.indicatorNames[1])[5] is None 39 >>> inter.getIndicator(Interaction.indicatorNames[1])[5] is None
32 True 40 True
33 >>> inter.getIndicator(Interaction.indicatorNames[1])[6] # doctest:+ELLIPSIS 41 >>> inter.getIndicator(Interaction.indicatorNames[1])[6] # doctest:+ELLIPSIS
34 3.1415... 42 3.1415...
35 43
44 # test categorize
36 >>> from collections import Counter 45 >>> from collections import Counter
37 >>> from numpy import pi 46 >>> from numpy import pi
38 >>> o1 = MovingObject.generate(0, Point(0,0), Point(1,0), TimeInterval(0,100)) 47 >>> 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)) 48 >>> o2 = MovingObject.generate(0, Point(100,1), Point(-1,0), TimeInterval(0,100))
40 >>> inter12 = Interaction(roadUser1 = o1, roadUser2 = o2) 49 >>> inter12 = Interaction(roadUser1 = o1, roadUser2 = o2)