Mercurial Hosting > traffic-intelligence
comparison trafficintelligence/tests/events.txt @ 1151:658f87232536
extended creation of interactions to non simultaneous objects for PET calculations
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Wed, 01 Jul 2020 11:02:52 -0400 |
parents | 14140b55e580 |
children | af329f3330ba |
comparison
equal
deleted
inserted
replaced
1150:14140b55e580 | 1151:658f87232536 |
---|---|
4 | 4 |
5 >>> objects = [MovingObject(num = i, timeInterval = TimeInterval(0,10)) for i in range(10)] | 5 >>> objects = [MovingObject(num = i, timeInterval = TimeInterval(0,10)) for i in range(10)] |
6 >>> interactions = createInteractions(objects) | 6 >>> interactions = createInteractions(objects) |
7 >>> len([i for i in interactions if len(i.roadUserNumbers) == 1]) | 7 >>> len([i for i in interactions if len(i.roadUserNumbers) == 1]) |
8 0 | 8 0 |
9 >>> len(interactions) | |
10 45 | |
9 >>> objects2 = [MovingObject(num = i, timeInterval = TimeInterval(0,10)) for i in range(100, 110)] | 11 >>> objects2 = [MovingObject(num = i, timeInterval = TimeInterval(0,10)) for i in range(100, 110)] |
10 >>> interactions = createInteractions(objects, objects2) | 12 >>> interactions = createInteractions(objects, objects2) |
11 >>> len([i for i in interactions if len(i.roadUserNumbers) == 1]) | 13 >>> len([i for i in interactions if len(i.roadUserNumbers) == 1]) |
12 0 | 14 0 |
15 >>> objects3 = [MovingObject(num = i, timeInterval = TimeInterval(12,22)) for i in range(100, 110)] | |
16 >>> interactions = createInteractions(objects, objects3) | |
17 >>> len(interactions) | |
18 0 | |
19 >>> interactions = createInteractions(objects, objects3, 3) | |
20 >>> len(interactions) | |
21 100 | |
22 >>> interactions[0].getTimeInterval().empty() | |
23 True | |
13 | 24 |
14 >>> o1 = MovingObject.generate(1, Point(-5.,0.), Point(0.,0.), TimeInterval(0,10)) | 25 >>> 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)) | 26 >>> o2 = MovingObject.generate(2, Point(0.,-5.), Point(0.,1.), TimeInterval(0,10)) |
16 >>> inter = Interaction(roadUser1 = o1, roadUser2 = o2) | 27 >>> inter = Interaction(roadUser1 = o1, roadUser2 = o2) |
17 >>> inter.computeIndicators() # should not crash with 0 speed | 28 >>> inter.computeIndicators() # should not crash with 0 speed |