Mercurial Hosting > traffic-intelligence
annotate python/tests/indicators.txt @ 341:2f39c4ed0b62
first version of indicator saving to sqlite
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Thu, 20 Jun 2013 14:31:24 -0400 |
parents | 66691c06928c |
children | 933670761a57 |
rev | line source |
---|---|
247
8f0ed138d373
moved the tests for indicators
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
1 >>> from indicators import * |
8f0ed138d373
moved the tests for indicators
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
2 >>> from moving import TimeInterval,Trajectory |
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 |
8f0ed138d373
moved the tests for indicators
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
22 >>> t1 = Trajectory([[0.5,1.5,2.5],[0.5,3.5,6.5]]) |
8f0ed138d373
moved the tests for indicators
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
23 >>> indicatorMap([1,2,3], t1, 1) |
8f0ed138d373
moved the tests for indicators
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
24 {(1.0, 3.0): 2.0, (2.0, 6.0): 3.0, (0.0, 0.0): 1.0} |
8f0ed138d373
moved the tests for indicators
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
25 >>> indicatorMap([1,2,3], t1, 4) |
8f0ed138d373
moved the tests for indicators
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
26 {(0.0, 1.0): 3.0, (0.0, 0.0): 1.5} |