Mercurial Hosting > traffic-intelligence
diff python/tests/moving.txt @ 69:cc192d0450b3
added full support for two implementations of indicators, with tests
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Wed, 10 Nov 2010 23:41:49 -0500 |
parents | 6d11d9e7ad4e |
children | 5d487f183fe2 |
line wrap: on
line diff
--- a/python/tests/moving.txt Mon Nov 08 12:20:52 2010 -0500 +++ b/python/tests/moving.txt Wed Nov 10 23:41:49 2010 -0500 @@ -25,3 +25,28 @@ >>> Point.distanceNorm2(Point(3,4),Point(1,7)) 3.6055512754639891 +>>> t1 = Trajectory([[0.5,1.5,2.5],[0.5,3.5,6.5]]) +>>> t1.length() +3 +>>> t1[1] +(1.500000,3.500000) + +>>> indic1 = TemporalIndicator('bla', [0,3,-4], TimeInterval(4,6)) +>>> indic1.empty() +False +>>> indic1[5] +3 +>>> indic1[3] +>>> [v for v in indic1] +[0, 3, -4] +>>> indic1 = TemporalIndicator('bla', {2:0,4:3,5:-5}) +>>> indic1[4] +3 +>>> indic1[3] +>>> [v for v in indic1] +[0, 3, -5] + +>>> indicatorMap([1,2,3], t1, 1) +{(1.0, 3.0): 2.0, (2.0, 6.0): 3.0, (0.0, 0.0): 1.0} +>>> indicatorMap([1,2,3], t1, 4) +{(0.0, 1.0): 3.0, (0.0, 0.0): 1.5}