Mercurial > hg > nsaunier > traffic-intelligence
comparison python/tests/indicators.txt @ 285:5957aa1d69e1
Integrating Mohamed's changes
Changed the indicator interface to access values, so that the generic LCSS implementation can be used
| author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
|---|---|
| date | Sat, 26 Jan 2013 19:02:25 -0500 |
| parents | 8f0ed138d373 |
| children | 66691c06928c |
comparison
equal
deleted
inserted
replaced
| 284:f2cf16ad798f | 285:5957aa1d69e1 |
|---|---|
| 2 >>> from moving import TimeInterval,Trajectory | 2 >>> from moving import TimeInterval,Trajectory |
| 3 | 3 |
| 4 >>> indic1 = TemporalIndicator('bla', [0,3,-4], TimeInterval(4,6)) | 4 >>> indic1 = TemporalIndicator('bla', [0,3,-4], TimeInterval(4,6)) |
| 5 >>> indic1.empty() | 5 >>> indic1.empty() |
| 6 False | 6 False |
| 7 >>> indic1.valueAtInstant(5) | |
| 8 3 | |
| 9 >>> indic1.valueAtInstant(3) | |
| 10 >>> indic1[1] | |
| 11 3 | |
| 7 >>> indic1[5] | 12 >>> indic1[5] |
| 8 3 | |
| 9 >>> indic1[3] | |
| 10 >>> [v for v in indic1] | 13 >>> [v for v in indic1] |
| 11 [0, 3, -4] | 14 [0, 3, -4] |
| 12 >>> indic1 = TemporalIndicator('bla', {2:0,4:3,5:-5}) | 15 >>> indic1 = TemporalIndicator('bla', {2:0,4:3,5:-5}) |
| 13 >>> indic1[4] | 16 >>> indic1.valueAtInstant(4) |
| 14 3 | 17 3 |
| 15 >>> indic1[3] | 18 >>> indic1.valueAtInstant(3) |
| 16 >>> [v for v in indic1] | 19 >>> indic1[2] |
| 17 [0, 3, -5] | 20 -5 |
| 18 | 21 |
| 19 >>> t1 = Trajectory([[0.5,1.5,2.5],[0.5,3.5,6.5]]) | 22 >>> t1 = Trajectory([[0.5,1.5,2.5],[0.5,3.5,6.5]]) |
| 20 >>> indicatorMap([1,2,3], t1, 1) | 23 >>> indicatorMap([1,2,3], t1, 1) |
| 21 {(1.0, 3.0): 2.0, (2.0, 6.0): 3.0, (0.0, 0.0): 1.0} | 24 {(1.0, 3.0): 2.0, (2.0, 6.0): 3.0, (0.0, 0.0): 1.0} |
| 22 >>> indicatorMap([1,2,3], t1, 4) | 25 >>> indicatorMap([1,2,3], t1, 4) |
