annotate python/tests/indicators.txt @ 286:fa95796a76b3

simplified indicators (only non-measured values, whether measurable or not)
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Sun, 27 Jan 2013 00:22:55 -0500
parents 5957aa1d69e1
children 66691c06928c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
285
5957aa1d69e1 Integrating Mohamed's changes
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents: 247
diff changeset
7 >>> indic1.valueAtInstant(5)
247
8f0ed138d373 moved the tests for indicators
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff changeset
8 3
285
5957aa1d69e1 Integrating Mohamed's changes
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents: 247
diff changeset
9 >>> indic1.valueAtInstant(3)
5957aa1d69e1 Integrating Mohamed's changes
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents: 247
diff changeset
10 >>> indic1[1]
5957aa1d69e1 Integrating Mohamed's changes
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents: 247
diff changeset
11 3
5957aa1d69e1 Integrating Mohamed's changes
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents: 247
diff changeset
12 >>> indic1[5]
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})
285
5957aa1d69e1 Integrating Mohamed's changes
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents: 247
diff changeset
16 >>> indic1.valueAtInstant(4)
247
8f0ed138d373 moved the tests for indicators
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff changeset
17 3
285
5957aa1d69e1 Integrating Mohamed's changes
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents: 247
diff changeset
18 >>> indic1.valueAtInstant(3)
5957aa1d69e1 Integrating Mohamed's changes
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents: 247
diff changeset
19 >>> indic1[2]
5957aa1d69e1 Integrating Mohamed's changes
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents: 247
diff changeset
20 -5
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}