Mercurial > hg > nsaunier > traffic-intelligence
diff python/utils.py @ 549:b5525249eda1
Merged in mohamedgomaa/trafficintelligence (pull request #7)
add some functions for behaviour analysis and corrected a few bugs
| author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
|---|---|
| date | Tue, 08 Jul 2014 16:32:09 -0400 |
| parents | 97c5fef5b2d6 |
| children | 3622a5653ee9 |
line wrap: on
line diff
--- a/python/utils.py Tue Jul 08 15:51:43 2014 -0400 +++ b/python/utils.py Tue Jul 08 16:32:09 2014 -0400 @@ -246,9 +246,10 @@ def crossProduct(l1, l2): return l1[0]*l2[1]-l1[1]*l2[0] -def filterMovingWindow(input, halfWidth): +def filterMovingWindow(inputSignal, halfWidth): '''Returns an array obtained after the smoothing of the input by a moving average The first and last points are copied from the original.''' + from numpy import ones,convolve,array width = float(halfWidth*2+1) win = ones(width,'d') result = convolve(win/width,array(inputSignal),'same')
