Mercurial Hosting > traffic-intelligence
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/python/tests/indicators.txt Wed Jul 18 02:54:02 2012 -0400 @@ -0,0 +1,23 @@ +>>> from indicators import * +>>> from moving import TimeInterval,Trajectory + +>>> 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] + +>>> t1 = Trajectory([[0.5,1.5,2.5],[0.5,3.5,6.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}