[SciPy-User] Boxcar smoothing of 1D data array...?
Charles R Harris
Sat Jun 19 13:00:23 CDT 2010
On Sat, Jun 19, 2010 at 10:15 AM, Anne Archibald <email@example.com
> On 19 June 2010 06:00, Sturla Molden <firstname.lastname@example.org> wrote:
> > Den 18. juni 2010 kl. 16.51 skrev Anne Archibald <
> > >:
> >>> 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?
Note that the transfer functions are the same if the zero at 1 in the
numerator exactly cancels the zero in the denominator. However, the output
has to be correctly initialized, since the initial value is otherwise
carried along, which you can see by setting the inputs to zero. So the
algebraic cancellation doesn't remove all the side effects of using a
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the SciPy-User