[SciPy-user] Help with filter design

Travis Oliphant oliphant at ee.byu.edu
Tue Feb 24 11:33:44 CST 2004

Bob.Cowdery at CGI-Europe.com wrote:

> Forgive these questions if they are rather basic. I am trying to get 
> up to speed with python and the scientific packages. I have an 
> implementation of a dsp process for a software radio implemented using 
> Intel IPP. I am converting this to python. One of the things I need to 
> do is fast convolution filtering. To create the filter in IPP I do 
> something like:
> ippsFIRGenLowpass_64f( ( high_cutoff - low_cutoff 
> )/2, taps, no_of_taps, window_type ) ) where taps is the output array.
> Is there something similar in SciPy or other packages. I found the 
> tutorial in the signal processing area too difficult to follow and I 
> can't seem to locate any other documentation for SciPy except the help 
> where you really need to know what you are looking for.
I would be interested to know which parts of the tutorial you found 
difficulty following and how you think it could be improved.

To answer your question...

Yes, there are quite a few filtering functions in SciPy.

There is signal.convolve which will convolve two functions together (an 
FIR filter)

There is also signal.lfilter which will implement an IIR filter (given 
the numerator and denominator polynomials)

It looks like FIRGenLowPass is creating an FIR filter.  Do you know what 
algorithm it is using?  What are the possibilities in window_type?

If you want to create an FIR filter then you should look at 
signal.remez  which will construct an FIR filter to minimize the maximum 
distance between your desired response in the pass band and the obtained 
response.   You can design low-pass, high-pass and bandpass filters 
using this method.

info(signal.remez) will tell you how to call it but it does assume some 
familiarity with designing digital filters.

You can also construct low-pass filters using the Fourier Transform and 

signal.get_window() will construct a variety of windows for you.  You 
could use these windows as low-pass filters themselves or use them in 
the Fourier domain to construct an FIR filter (more common).

Let me know which approach you would prefer to use and I can give you 
more specific examples if you like.

-Travis Oliphant

More information about the SciPy-user mailing list