Mercurial > hg > nsaunier > traffic-intelligence
comparison python/tests/indicators.txt @ 247:8f0ed138d373
moved the tests for indicators
| author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
|---|---|
| date | Wed, 18 Jul 2012 02:54:02 -0400 |
| parents | |
| children | 5957aa1d69e1 |
comparison
equal
deleted
inserted
replaced
| 246:583a2c4622f9 | 247:8f0ed138d373 |
|---|---|
| 1 >>> from indicators import * | |
| 2 >>> from moving import TimeInterval,Trajectory | |
| 3 | |
| 4 >>> indic1 = TemporalIndicator('bla', [0,3,-4], TimeInterval(4,6)) | |
| 5 >>> indic1.empty() | |
| 6 False | |
| 7 >>> indic1[5] | |
| 8 3 | |
| 9 >>> indic1[3] | |
| 10 >>> [v for v in indic1] | |
| 11 [0, 3, -4] | |
| 12 >>> indic1 = TemporalIndicator('bla', {2:0,4:3,5:-5}) | |
| 13 >>> indic1[4] | |
| 14 3 | |
| 15 >>> indic1[3] | |
| 16 >>> [v for v in indic1] | |
| 17 [0, 3, -5] | |
| 18 | |
| 19 >>> t1 = Trajectory([[0.5,1.5,2.5],[0.5,3.5,6.5]]) | |
| 20 >>> 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} | |
| 22 >>> indicatorMap([1,2,3], t1, 4) | |
| 23 {(0.0, 1.0): 3.0, (0.0, 0.0): 1.5} |
