Mercurial > hg > nsaunier > traffic-intelligence
comparison python/tests/indicators.txt @ 287:66691c06928c
first version of indicator LCSS
| author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
|---|---|
| date | Sun, 27 Jan 2013 00:51:48 -0500 |
| parents | 5957aa1d69e1 |
| children | 933670761a57 |
comparison
equal
deleted
inserted
replaced
| 286:fa95796a76b3 | 287:66691c06928c |
|---|---|
| 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) | 7 >>> indic1.getIthValue(1) |
| 8 3 | 8 3 |
| 9 >>> indic1.valueAtInstant(3) | 9 >>> indic1.getIthValue(3) |
| 10 >>> indic1[1] | 10 >>> indic1[6] |
| 11 3 | 11 -4 |
| 12 >>> indic1[5] | 12 >>> indic1[7] |
| 13 >>> [v for v in indic1] | 13 >>> [v for v in indic1] |
| 14 [0, 3, -4] | 14 [0, 3, -4] |
| 15 >>> indic1 = TemporalIndicator('bla', {2:0,4:3,5:-5}) | 15 >>> indic1 = TemporalIndicator('bla', {2:0,4:3,5:-5}) |
| 16 >>> indic1.valueAtInstant(4) | 16 >>> indic1.getIthValue(1) |
| 17 3 | 17 3 |
| 18 >>> indic1.valueAtInstant(3) | 18 >>> indic1.getIthValue(3) |
| 19 >>> indic1[2] | 19 >>> indic1[2] |
| 20 -5 | 20 0 |
| 21 | 21 |
| 22 >>> 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]]) |
| 23 >>> indicatorMap([1,2,3], t1, 1) | 23 >>> indicatorMap([1,2,3], t1, 1) |
| 24 {(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} |
| 25 >>> indicatorMap([1,2,3], t1, 4) | 25 >>> indicatorMap([1,2,3], t1, 4) |
