Mercurial Hosting > traffic-intelligence
annotate python/tests/moving.txt @ 564:36605d843be5
modified bug for reading vissim files, cleaned use of readline with multiple type of characters for comments (to ignore)
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Mon, 21 Jul 2014 16:17:22 -0400 |
parents | a3add9f751ef |
children | 0057c04f94d5 |
rev | line source |
---|---|
43
6d11d9e7ad4e
methods for trajectories and objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
1 >>> from moving import * |
92
a5ef9e40688e
makes use of matplotlib function to test if point is in a polygon
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
91
diff
changeset
|
2 >>> import numpy as np |
43
6d11d9e7ad4e
methods for trajectories and objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
3 |
6d11d9e7ad4e
methods for trajectories and objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
4 >>> Interval().empty() |
6d11d9e7ad4e
methods for trajectories and objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
5 True |
6d11d9e7ad4e
methods for trajectories and objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
6 >>> Interval(0,1).empty() |
6d11d9e7ad4e
methods for trajectories and objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
7 False |
104
13187af8622d
finally added the representation of intervals
Nicolas Saunier <nico@confins.net>
parents:
96
diff
changeset
|
8 >>> Interval(0,1) |
13187af8622d
finally added the representation of intervals
Nicolas Saunier <nico@confins.net>
parents:
96
diff
changeset
|
9 [0, 1] |
43
6d11d9e7ad4e
methods for trajectories and objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
10 >>> Interval(0,1).length() |
91
daa05fae1a70
modified the type of the result of interval lengths to float, added comments
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
79
diff
changeset
|
11 1.0 |
43
6d11d9e7ad4e
methods for trajectories and objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
12 >>> Interval(23.2,24.9).length() |
6d11d9e7ad4e
methods for trajectories and objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
13 1.6999999999999993 |
6d11d9e7ad4e
methods for trajectories and objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
14 >>> Interval(10,8).length() |
91
daa05fae1a70
modified the type of the result of interval lengths to float, added comments
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
79
diff
changeset
|
15 0.0 |
43
6d11d9e7ad4e
methods for trajectories and objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
16 |
6d11d9e7ad4e
methods for trajectories and objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
17 >>> TimeInterval(0,1).length() |
91
daa05fae1a70
modified the type of the result of interval lengths to float, added comments
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
79
diff
changeset
|
18 2.0 |
43
6d11d9e7ad4e
methods for trajectories and objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
19 >>> TimeInterval(10,8).length() |
91
daa05fae1a70
modified the type of the result of interval lengths to float, added comments
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
79
diff
changeset
|
20 0.0 |
43
6d11d9e7ad4e
methods for trajectories and objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
21 |
107
916678481896
corrected bug for TimeInterval interation and added corresponding test
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
104
diff
changeset
|
22 >>> [i for i in TimeInterval(9,13)] |
916678481896
corrected bug for TimeInterval interation and added corresponding test
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
104
diff
changeset
|
23 [9, 10, 11, 12, 13] |
916678481896
corrected bug for TimeInterval interation and added corresponding test
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
104
diff
changeset
|
24 |
96
9928c2fa72cc
added equal method to intervals
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
92
diff
changeset
|
25 >>> TimeInterval(2,5).equal(TimeInterval(2,5)) |
9928c2fa72cc
added equal method to intervals
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
92
diff
changeset
|
26 True |
9928c2fa72cc
added equal method to intervals
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
92
diff
changeset
|
27 >>> TimeInterval(2,5).equal(TimeInterval(2,4)) |
9928c2fa72cc
added equal method to intervals
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
92
diff
changeset
|
28 False |
9928c2fa72cc
added equal method to intervals
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
92
diff
changeset
|
29 >>> TimeInterval(2,5).equal(TimeInterval(5,2)) |
9928c2fa72cc
added equal method to intervals
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
92
diff
changeset
|
30 False |
9928c2fa72cc
added equal method to intervals
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
92
diff
changeset
|
31 |
248
571ba5ed22e2
added utils for bus processing
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
152
diff
changeset
|
32 >>> TimeInterval(3,6).distance(TimeInterval(4,6)) |
571ba5ed22e2
added utils for bus processing
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
152
diff
changeset
|
33 0 |
571ba5ed22e2
added utils for bus processing
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
152
diff
changeset
|
34 >>> TimeInterval(3,6).distance(TimeInterval(6,10)) |
571ba5ed22e2
added utils for bus processing
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
152
diff
changeset
|
35 0 |
571ba5ed22e2
added utils for bus processing
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
152
diff
changeset
|
36 >>> TimeInterval(3,6).distance(TimeInterval(8,10)) |
571ba5ed22e2
added utils for bus processing
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
152
diff
changeset
|
37 2 |
571ba5ed22e2
added utils for bus processing
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
152
diff
changeset
|
38 >>> TimeInterval(20,30).distance(TimeInterval(3,15)) |
571ba5ed22e2
added utils for bus processing
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
152
diff
changeset
|
39 5 |
249
99173da7afae
corrected small bugs and typos
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
248
diff
changeset
|
40 >>> unionIntervals([TimeInterval(3,6), TimeInterval(8,10),TimeInterval(11,15)]) |
99173da7afae
corrected small bugs and typos
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
248
diff
changeset
|
41 [3, 15] |
248
571ba5ed22e2
added utils for bus processing
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
152
diff
changeset
|
42 |
43
6d11d9e7ad4e
methods for trajectories and objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
43 >>> Point(3,4)-Point(1,7) |
6d11d9e7ad4e
methods for trajectories and objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
44 (2.000000,-3.000000) |
451
cd342a774806
Point/CurvilinearTrajectory/Interaction utiles
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
372
diff
changeset
|
45 >>> -Point(1,2) |
cd342a774806
Point/CurvilinearTrajectory/Interaction utiles
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
372
diff
changeset
|
46 (-1.000000,-2.000000) |
43
6d11d9e7ad4e
methods for trajectories and objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
47 |
6d11d9e7ad4e
methods for trajectories and objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
48 >>> Point(3,2).norm2Squared() |
6d11d9e7ad4e
methods for trajectories and objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
49 13 |
6d11d9e7ad4e
methods for trajectories and objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
50 |
6d11d9e7ad4e
methods for trajectories and objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
51 >>> Point.distanceNorm2(Point(3,4),Point(1,7)) |
248
571ba5ed22e2
added utils for bus processing
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
152
diff
changeset
|
52 3.605551275463989 |
43
6d11d9e7ad4e
methods for trajectories and objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
53 |
372
349eb1e09f45
Cleaned the methods/functions indicating if a point is in a polygon
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
369
diff
changeset
|
54 >>> Point(3,2).inPolygonNoShapely(np.array([[0,0],[1,0],[1,1],[0,1]])) |
79
5d487f183fe2
added method to test points in polygons and tests
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
69
diff
changeset
|
55 False |
372
349eb1e09f45
Cleaned the methods/functions indicating if a point is in a polygon
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
369
diff
changeset
|
56 >>> Point(3,2).inPolygonNoShapely(np.array([[0,0],[4,0],[4,3],[0,3]])) |
79
5d487f183fe2
added method to test points in polygons and tests
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
69
diff
changeset
|
57 True |
5d487f183fe2
added method to test points in polygons and tests
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
69
diff
changeset
|
58 |
255
13ec22bec5d4
corrected typos and bugs and added a test
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
249
diff
changeset
|
59 >>> predictPositionNoLimit(10, Point(0,0), Point(1,1)) # doctest:+ELLIPSIS |
13ec22bec5d4
corrected typos and bugs and added a test
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
249
diff
changeset
|
60 ((1.0...,1.0...), (10.0...,10.0...)) |
249
99173da7afae
corrected small bugs and typos
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
248
diff
changeset
|
61 |
152
74b1fc68d4df
re-organized code to avoid cyclic python module dependencies
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
113
diff
changeset
|
62 >>> segmentIntersection(Point(0,0),Point(1,1), Point(0,1), Point(1,2)) |
74b1fc68d4df
re-organized code to avoid cyclic python module dependencies
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
113
diff
changeset
|
63 >>> segmentIntersection(Point(0,1),Point(1,0), Point(0,2), Point(2,1)) |
74b1fc68d4df
re-organized code to avoid cyclic python module dependencies
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
113
diff
changeset
|
64 >>> segmentIntersection(Point(0,0),Point(2,0), Point(1,-1),Point(1,1)) |
74b1fc68d4df
re-organized code to avoid cyclic python module dependencies
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
113
diff
changeset
|
65 (1.000000,0.000000) |
74b1fc68d4df
re-organized code to avoid cyclic python module dependencies
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
113
diff
changeset
|
66 >>> segmentIntersection(Point(0,1),Point(2,0),Point(1,1),Point(1,2)) |
74b1fc68d4df
re-organized code to avoid cyclic python module dependencies
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
113
diff
changeset
|
67 |
113
606010d1d9a4
corrected errors in trajectories (if empty) and getTrajectoryInPolygon
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
107
diff
changeset
|
68 >>> Trajectory().length() |
606010d1d9a4
corrected errors in trajectories (if empty) and getTrajectoryInPolygon
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
107
diff
changeset
|
69 0 |
69
cc192d0450b3
added full support for two implementations of indicators, with tests
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
43
diff
changeset
|
70 >>> t1 = Trajectory([[0.5,1.5,2.5],[0.5,3.5,6.5]]) |
91
daa05fae1a70
modified the type of the result of interval lengths to float, added comments
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
79
diff
changeset
|
71 >>> t1.length() == 3. |
daa05fae1a70
modified the type of the result of interval lengths to float, added comments
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
79
diff
changeset
|
72 True |
69
cc192d0450b3
added full support for two implementations of indicators, with tests
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
43
diff
changeset
|
73 >>> t1[1] |
cc192d0450b3
added full support for two implementations of indicators, with tests
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
43
diff
changeset
|
74 (1.500000,3.500000) |
372
349eb1e09f45
Cleaned the methods/functions indicating if a point is in a polygon
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
369
diff
changeset
|
75 >>> t1.getTrajectoryInPolygonNoShapely(np.array([[0,0],[4,0],[4,3],[0,3]])) |
79
5d487f183fe2
added method to test points in polygons and tests
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
69
diff
changeset
|
76 (0.500000,0.500000) |
372
349eb1e09f45
Cleaned the methods/functions indicating if a point is in a polygon
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
369
diff
changeset
|
77 >>> t1.getTrajectoryInPolygonNoShapely(np.array([[10,10],[14,10],[14,13],[10,13]])).length() |
113
606010d1d9a4
corrected errors in trajectories (if empty) and getTrajectoryInPolygon
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
107
diff
changeset
|
78 0 |
284
f2cf16ad798f
added LCSS for trajectories
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
255
diff
changeset
|
79 |
542
a3add9f751ef
added differentiate function for curvilinear trajectories and modified the addPosition functions
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
531
diff
changeset
|
80 >>> t1.differentiate() |
a3add9f751ef
added differentiate function for curvilinear trajectories and modified the addPosition functions
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
531
diff
changeset
|
81 (1.000000,3.000000) (1.000000,3.000000) |
a3add9f751ef
added differentiate function for curvilinear trajectories and modified the addPosition functions
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
531
diff
changeset
|
82 >>> t1.differentiate(True) |
a3add9f751ef
added differentiate function for curvilinear trajectories and modified the addPosition functions
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
531
diff
changeset
|
83 (1.000000,3.000000) (1.000000,3.000000) (1.000000,3.000000) |
a3add9f751ef
added differentiate function for curvilinear trajectories and modified the addPosition functions
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
531
diff
changeset
|
84 >>> t1 = Trajectory([[0.5,1.5,3.5],[0.5,2.5,7.5]]) |
a3add9f751ef
added differentiate function for curvilinear trajectories and modified the addPosition functions
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
531
diff
changeset
|
85 >>> t1.differentiate() |
a3add9f751ef
added differentiate function for curvilinear trajectories and modified the addPosition functions
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
531
diff
changeset
|
86 (1.000000,2.000000) (2.000000,5.000000) |
a3add9f751ef
added differentiate function for curvilinear trajectories and modified the addPosition functions
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
531
diff
changeset
|
87 |
369
027e254f0b53
lcss subclass for indicators
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
345
diff
changeset
|
88 >>> from utils import LCSS |
027e254f0b53
lcss subclass for indicators
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
345
diff
changeset
|
89 >>> lcss = LCSS(lambda x,y: Point.distanceNorm2(x,y) <= 0.1) |
027e254f0b53
lcss subclass for indicators
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
345
diff
changeset
|
90 >>> Trajectory.lcss(t1, t1, lcss) |
284
f2cf16ad798f
added LCSS for trajectories
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
255
diff
changeset
|
91 3 |
369
027e254f0b53
lcss subclass for indicators
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
345
diff
changeset
|
92 >>> lcss = LCSS(lambda p1, p2: (p1-p2).normMax() <= 0.1) |
027e254f0b53
lcss subclass for indicators
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
345
diff
changeset
|
93 >>> Trajectory.lcss(t1, t1, lcss) |
284
f2cf16ad798f
added LCSS for trajectories
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
255
diff
changeset
|
94 3 |
345
fa64b2e3a64f
added simple classification based on speed
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
284
diff
changeset
|
95 |
504
a40c75f04903
optimized direct time to collision computation and added tests
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
451
diff
changeset
|
96 >>> p1=Point(0,0) |
a40c75f04903
optimized direct time to collision computation and added tests
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
451
diff
changeset
|
97 >>> p2=Point(1,0) |
a40c75f04903
optimized direct time to collision computation and added tests
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
451
diff
changeset
|
98 >>> v1 = Point(0.1,0.1) |
a40c75f04903
optimized direct time to collision computation and added tests
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
451
diff
changeset
|
99 >>> v2 = Point(-0.1, 0.1) |
a40c75f04903
optimized direct time to collision computation and added tests
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
451
diff
changeset
|
100 >>> abs(Point.timeToCollision(p1, p2, v1, v2, 0.)-5.0) < 0.00001 |
a40c75f04903
optimized direct time to collision computation and added tests
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
451
diff
changeset
|
101 True |
a40c75f04903
optimized direct time to collision computation and added tests
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
451
diff
changeset
|
102 >>> abs(Point.timeToCollision(p1, p2, v1, v2, 0.1)-4.5) < 0.00001 |
a40c75f04903
optimized direct time to collision computation and added tests
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
451
diff
changeset
|
103 True |
531
f012a8ad7a0e
corrected bug in Point.timeToCollision that might result in negative TTCs
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
524
diff
changeset
|
104 >>> p1=Point(0,1) |
f012a8ad7a0e
corrected bug in Point.timeToCollision that might result in negative TTCs
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
524
diff
changeset
|
105 >>> p2=Point(1,0) |
f012a8ad7a0e
corrected bug in Point.timeToCollision that might result in negative TTCs
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
524
diff
changeset
|
106 >>> v1 = Point(0,0.1) |
f012a8ad7a0e
corrected bug in Point.timeToCollision that might result in negative TTCs
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
524
diff
changeset
|
107 >>> v2 = Point(0.1, 0) |
f012a8ad7a0e
corrected bug in Point.timeToCollision that might result in negative TTCs
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
524
diff
changeset
|
108 >>> Point.timeToCollision(p1, p2, v1, v2, 0.) == None |
f012a8ad7a0e
corrected bug in Point.timeToCollision that might result in negative TTCs
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
524
diff
changeset
|
109 True |
f012a8ad7a0e
corrected bug in Point.timeToCollision that might result in negative TTCs
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
524
diff
changeset
|
110 >>> Point.timeToCollision(p2, p1, v2, v1, 0.) == None |
f012a8ad7a0e
corrected bug in Point.timeToCollision that might result in negative TTCs
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
524
diff
changeset
|
111 True |
504
a40c75f04903
optimized direct time to collision computation and added tests
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
451
diff
changeset
|
112 |
542
a3add9f751ef
added differentiate function for curvilinear trajectories and modified the addPosition functions
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
531
diff
changeset
|
113 >>> t = CurvilinearTrajectory(S = [1., 2., 3., 5.], Y = [0.5, 0.5, 0.6, 0.7], lanes = ['1']*4) |
a3add9f751ef
added differentiate function for curvilinear trajectories and modified the addPosition functions
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
531
diff
changeset
|
114 >>> t.differentiate() # doctest:+ELLIPSIS |
a3add9f751ef
added differentiate function for curvilinear trajectories and modified the addPosition functions
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
531
diff
changeset
|
115 [1.0, 0.0, '1'] [1.0, 0.099..., '1'] [2.0, 0.099..., '1'] |
a3add9f751ef
added differentiate function for curvilinear trajectories and modified the addPosition functions
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
531
diff
changeset
|
116 >>> t.differentiate(True) # doctest:+ELLIPSIS |
a3add9f751ef
added differentiate function for curvilinear trajectories and modified the addPosition functions
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
531
diff
changeset
|
117 [1.0, 0.0, '1'] [1.0, 0.099..., '1'] [2.0, 0.099..., '1'] [2.0, 0.099..., '1'] |
a3add9f751ef
added differentiate function for curvilinear trajectories and modified the addPosition functions
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
531
diff
changeset
|
118 |
345
fa64b2e3a64f
added simple classification based on speed
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
284
diff
changeset
|
119 >>> o1 = MovingObject(positions = Trajectory([[0]*3,[2]*3]), velocities = Trajectory([[0]*3,[1]*3])) |
524
1dced8932b08
corrected bugs
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
504
diff
changeset
|
120 >>> o1.classifyUserTypeSpeedMotorized(0.5, np.median) |
345
fa64b2e3a64f
added simple classification based on speed
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
284
diff
changeset
|
121 >>> userTypeNames[o1.getUserType()] |
fa64b2e3a64f
added simple classification based on speed
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
284
diff
changeset
|
122 'car' |
524
1dced8932b08
corrected bugs
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
504
diff
changeset
|
123 >>> o1.classifyUserTypeSpeedMotorized(0.5, np.mean) |
345
fa64b2e3a64f
added simple classification based on speed
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
284
diff
changeset
|
124 >>> userTypeNames[o1.getUserType()] |
fa64b2e3a64f
added simple classification based on speed
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
284
diff
changeset
|
125 'car' |
524
1dced8932b08
corrected bugs
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
504
diff
changeset
|
126 >>> o1.classifyUserTypeSpeedMotorized(1.5, np.median) |
345
fa64b2e3a64f
added simple classification based on speed
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
284
diff
changeset
|
127 >>> userTypeNames[o1.getUserType()] |
fa64b2e3a64f
added simple classification based on speed
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
284
diff
changeset
|
128 'pedestrian' |