[SciPy-Dev] SciPy Goal
Thu Jan 5 16:30:44 CST 2012
Travis Oliphant wrote:
> On Jan 5, 2012, at 1:19 PM, Neal Becker wrote:
>> Travis Oliphant wrote:
>>> On Jan 5, 2012, at 10:00 AM, email@example.com wrote:
>>>> On Thu, Jan 5, 2012 at 10:32 AM, Neal Becker <firstname.lastname@example.org> wrote:
>>>>> Some comments on signal processing:
>>>>> Correct me if I'm wrong, but I think scipy signal (like matlab) implement
>>>>> only a
>>>>> general purpose filter, which is an IIR filter, single rate. Efficiency
>>>>> is very important in my work, so I implement many optimized variations.
>>>>> Most of the time, FIR filters are used. These then come in variations for
>>>>> single rate, interpolation, and decimation (there is also another design
>>>>> rational rate conversion). Then these have variants for scalar/complex
>>>>> input/output, as well as complex in/out with scalar coefficients.
>>>>> IIR filters are seperate.
>>>>> FFT based FIR filters are another type, and include both complex in/out as
>>>>> well as scalar in/out (taking advantage of the 'two channel' trick for
>>>> just out of curiosity: why no FFT base IIR filter?
>>>> It looks like a small change in the implementation, but it is slower
>>>> than lfilter for shorter time series so I mostly dropped fft based
>>> I think he is talking about filter design, correct?
>> The comments I made were all about efficient filter implementation, not about
>> filter design.
>> About FFT-based IIR filter, I never heard of it. I was talking about the
>> fact that fft can be used to efficiently implement a linear convolution
>> exactly (for the case of convolution of a finite or short sequence - the
>> impulse response of the filter - with a long or infinite sequence, the
>> overlap-add or overlap-save techniques are used).
> Sure, of course. It's hard to know the way people are using terms. I agree
> that people don't usually use the term IIR when talking about an FFT-based
> filter (but there is an "effective" time-domain response for every filtering
> operation done in the Fourier domain --- as you noted). That's what I was
> referring to.
> It's been a while since I wrote lfilter, but it transposes the filtering
> operation into Direct Form II, and then does a straightforward implementation
> of the feed-back and feed-forward equations.
> Here is some information on the approach:
> IIR filters implemented in the time-domain need something like lfilter. FIR
> filters are "just" convolution in the time domain --- and there are different
> approaches to doing that discrete-time convolution as you've noted. IIR
> filters are *just* convolution as well (but convolution with an infinite
> sequence). Of course, if you use the FFT-domain to implement the filter,
> then you can just as well design in that space the filtering-function you want
> to multiply the input signal with (it's just important to keep in mind the
> impact in the time-domain of what you are doing in the frequency domain ---
> i.e. sharp-edges result in ringing, the basic time-frequency product
> limitations, etc.)
> These same ideas come under different names and have different emphasis in
> different disciplines.
Here, I claim the best approach is to realize that
1. Just making the coefficients in the freq domain be samples of a desired
response gives you no exact result (as you noted), but
2. On the other hand, fft can be used to perform fast convolution, which is (can
be) mathematically exactly the same as time domain convolution. Therefore, just
* use your favorite FIR filter design tool (e.g., remez) to design the filter
Now the only approximation is in the fir filter design step, and you should know
precisely what is the nature of any approximation
More information about the SciPy-Dev