[SciPy-User] Boxcar smoothing of 1D data array...?

Sturla Molden sturla@molden...
Fri Jun 18 06:22:45 CDT 2010


Den 16.06.2010 02:26, skrev David Baddeley:
> Alternatively you could just use scipy.convolve with a tophat kernel 
> ie (for a filter of length N & signal y):
>
> scipy.convolve(y, ones(N)/N)
>
> see the docs for scipy.convolve for more info (you might want to 
> specify how it handles the ends, for example)
>

You should not use convolution for boxcar filtering. It can be solved 
using a recursive filter, basically

     y[n] = y[n-1] + x[n] - x[n-m]

then normalize y by 1/m.

Sturla
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20100618/4154817d/attachment-0001.html 


More information about the SciPy-User mailing list