[SciPy-User] Boxcar smoothing of 1D data array...?
Sat Jun 19 11:15:59 CDT 2010
On 19 June 2010 06:00, Sturla Molden <firstname.lastname@example.org> wrote:
> Den 18. juni 2010 kl. 16.51 skrev Anne Archibald <email@example.com
>>> y[n] = y[n-1] + x[n] - x[n-m]
>>> then normalize y by 1/m.
>> How does the numerical stability of this compare to a FIR
>> implementation (with or without a Fourier transform)?
> For practical purposes, x will be a digital signal (from an ADC) or a
> digital image. Thus the recursive boxcar can be implemented with
> integer maths. Stability is excellent as numerical error is 0. :-)
> You just have to make sure that y does not overflow (e.g. let y be 32
> bit if x is 16 bit).
Heh. You have a point there. But I should say that in the application
in which we use boxcar filtering (searching for single pulses in radio
pulsar search data), the data has already been processed sufficiently
that we can't use integers any more, and in fact we use 32-bit floats
rather than doubles. It's kind of moot for us in any case since we
plan to modify the code to do matched filtering with a different
filter, so convolution will be necessary.
It's also worth checking: while scipy.signal does implement IIR
filters, I don't think it takes advantage of zero coefficients to
avoid arithmetic, so using it to implement a boxcar is probably worse
than using even a non-FFT convolution. Is this right?
More information about the SciPy-User