Mercurial > hg > nsaunier > traffic-intelligence
comparison trafficintelligence/tests/indicators.txt @ 1028:cc5cb04b04b0
major update using the trafficintelligence package name and install through pip
| author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
|---|---|
| date | Fri, 15 Jun 2018 11:19:10 -0400 |
| parents | python/tests/indicators.txt@933670761a57 |
| children | aafbc0bab925 |
comparison
equal
deleted
inserted
replaced
| 1027:6129296848d3 | 1028:cc5cb04b04b0 |
|---|---|
| 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.getIthValue(1) | |
| 8 3 | |
| 9 >>> indic1.getIthValue(3) | |
| 10 >>> indic1[6] | |
| 11 -4 | |
| 12 >>> indic1[7] | |
| 13 >>> [v for v in indic1] | |
| 14 [0, 3, -4] | |
| 15 >>> indic1 = TemporalIndicator('bla', {2:0,4:3,5:-5}) | |
| 16 >>> indic1.getIthValue(1) | |
| 17 3 | |
| 18 >>> indic1.getIthValue(3) | |
| 19 >>> indic1[2] | |
| 20 0 | |
| 21 | |
| 22 >>> t1 = Trajectory([[0.5,1.5,2.5],[0.5,3.5,6.5]]) | |
| 23 >>> m = indicatorMap([1,2,3], t1, 1) | |
| 24 >>> m[(1.0, 3.0)] | |
| 25 2.0 | |
| 26 >>> m[(2.0, 6.0)] | |
| 27 3.0 | |
| 28 >>> m[(0.0, 0.0)] | |
| 29 1.0 | |
| 30 >>> m = indicatorMap([1,2,3], t1, 4) | |
| 31 >>> m[(0.0, 1.0)] | |
| 32 3.0 | |
| 33 >>> m[(0.0, 0.0)] | |
| 34 1.5 |
