Mercurial Hosting > traffic-intelligence
annotate trafficintelligence/tests/indicators.txt @ 1102:cdf1773ba89e
corrected bug
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Wed, 27 Feb 2019 16:28:08 -0500 |
parents | b1ba6d44fcb9 |
children | 56d0195d043e |
rev | line source |
---|---|
1030
aafbc0bab925
moved method around to avoid cross-dependencies
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
1028
diff
changeset
|
1 >>> from trafficintelligence.indicators import * |
aafbc0bab925
moved method around to avoid cross-dependencies
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
1028
diff
changeset
|
2 >>> from trafficintelligence.moving import TimeInterval,Trajectory |
247
8f0ed138d373
moved the tests for indicators
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
3 |
8f0ed138d373
moved the tests for indicators
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
4 >>> indic1 = TemporalIndicator('bla', [0,3,-4], TimeInterval(4,6)) |
8f0ed138d373
moved the tests for indicators
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
5 >>> indic1.empty() |
8f0ed138d373
moved the tests for indicators
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
6 False |
287
66691c06928c
first version of indicator LCSS
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
285
diff
changeset
|
7 >>> indic1.getIthValue(1) |
247
8f0ed138d373
moved the tests for indicators
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
8 3 |
287
66691c06928c
first version of indicator LCSS
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
285
diff
changeset
|
9 >>> indic1.getIthValue(3) |
66691c06928c
first version of indicator LCSS
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
285
diff
changeset
|
10 >>> indic1[6] |
66691c06928c
first version of indicator LCSS
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
285
diff
changeset
|
11 -4 |
66691c06928c
first version of indicator LCSS
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
285
diff
changeset
|
12 >>> indic1[7] |
247
8f0ed138d373
moved the tests for indicators
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
13 >>> [v for v in indic1] |
8f0ed138d373
moved the tests for indicators
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
14 [0, 3, -4] |
8f0ed138d373
moved the tests for indicators
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
15 >>> indic1 = TemporalIndicator('bla', {2:0,4:3,5:-5}) |
287
66691c06928c
first version of indicator LCSS
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
285
diff
changeset
|
16 >>> indic1.getIthValue(1) |
247
8f0ed138d373
moved the tests for indicators
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
17 3 |
287
66691c06928c
first version of indicator LCSS
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
285
diff
changeset
|
18 >>> indic1.getIthValue(3) |
285
5957aa1d69e1
Integrating Mohamed's changes
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
247
diff
changeset
|
19 >>> indic1[2] |
287
66691c06928c
first version of indicator LCSS
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
285
diff
changeset
|
20 0 |
247
8f0ed138d373
moved the tests for indicators
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
21 |
1042
b1ba6d44fcb9
corrected bug in severity indicators
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
1030
diff
changeset
|
22 >>> ttc = SeverityIndicator('TTC', list(range(11)), TimeInterval(1,11), mostSevereIsMax = False) |
b1ba6d44fcb9
corrected bug in severity indicators
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
1030
diff
changeset
|
23 >>> ttc.getMostSevereValue(1) |
b1ba6d44fcb9
corrected bug in severity indicators
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
1030
diff
changeset
|
24 0.0 |
b1ba6d44fcb9
corrected bug in severity indicators
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
1030
diff
changeset
|
25 >>> ttc.getMostSevereValue(2) |
b1ba6d44fcb9
corrected bug in severity indicators
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
1030
diff
changeset
|
26 0.5 |
b1ba6d44fcb9
corrected bug in severity indicators
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
1030
diff
changeset
|
27 >>> ttc.getMostSevereValue(centile = 10.) |
b1ba6d44fcb9
corrected bug in severity indicators
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
1030
diff
changeset
|
28 1.0 |
b1ba6d44fcb9
corrected bug in severity indicators
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
1030
diff
changeset
|
29 >>> ttc.mostSevereIsMax = True |
b1ba6d44fcb9
corrected bug in severity indicators
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
1030
diff
changeset
|
30 >>> ttc.getMostSevereValue(1) |
b1ba6d44fcb9
corrected bug in severity indicators
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
1030
diff
changeset
|
31 10.0 |
b1ba6d44fcb9
corrected bug in severity indicators
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
1030
diff
changeset
|
32 >>> ttc.getMostSevereValue(2) |
b1ba6d44fcb9
corrected bug in severity indicators
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
1030
diff
changeset
|
33 9.5 |
b1ba6d44fcb9
corrected bug in severity indicators
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
1030
diff
changeset
|
34 >>> ttc.getMostSevereValue(centile = 10.) |
b1ba6d44fcb9
corrected bug in severity indicators
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
1030
diff
changeset
|
35 9.0 |
b1ba6d44fcb9
corrected bug in severity indicators
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
1030
diff
changeset
|
36 |
247
8f0ed138d373
moved the tests for indicators
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
37 >>> t1 = Trajectory([[0.5,1.5,2.5],[0.5,3.5,6.5]]) |
998
933670761a57
updated code to python 3 (tests pass and scripts run, but non-executed parts of code are probably still not correct)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
287
diff
changeset
|
38 >>> m = indicatorMap([1,2,3], t1, 1) |
933670761a57
updated code to python 3 (tests pass and scripts run, but non-executed parts of code are probably still not correct)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
287
diff
changeset
|
39 >>> m[(1.0, 3.0)] |
933670761a57
updated code to python 3 (tests pass and scripts run, but non-executed parts of code are probably still not correct)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
287
diff
changeset
|
40 2.0 |
933670761a57
updated code to python 3 (tests pass and scripts run, but non-executed parts of code are probably still not correct)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
287
diff
changeset
|
41 >>> m[(2.0, 6.0)] |
933670761a57
updated code to python 3 (tests pass and scripts run, but non-executed parts of code are probably still not correct)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
287
diff
changeset
|
42 3.0 |
933670761a57
updated code to python 3 (tests pass and scripts run, but non-executed parts of code are probably still not correct)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
287
diff
changeset
|
43 >>> m[(0.0, 0.0)] |
933670761a57
updated code to python 3 (tests pass and scripts run, but non-executed parts of code are probably still not correct)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
287
diff
changeset
|
44 1.0 |
933670761a57
updated code to python 3 (tests pass and scripts run, but non-executed parts of code are probably still not correct)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
287
diff
changeset
|
45 >>> m = indicatorMap([1,2,3], t1, 4) |
933670761a57
updated code to python 3 (tests pass and scripts run, but non-executed parts of code are probably still not correct)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
287
diff
changeset
|
46 >>> m[(0.0, 1.0)] |
933670761a57
updated code to python 3 (tests pass and scripts run, but non-executed parts of code are probably still not correct)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
287
diff
changeset
|
47 3.0 |
933670761a57
updated code to python 3 (tests pass and scripts run, but non-executed parts of code are probably still not correct)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
287
diff
changeset
|
48 >>> m[(0.0, 0.0)] |
933670761a57
updated code to python 3 (tests pass and scripts run, but non-executed parts of code are probably still not correct)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
287
diff
changeset
|
49 1.5 |