[SciPy-dev] Question about Kaiser Implementation in firwin

Travis Oliphant oliphant.travis at ieee.org
Sun Jul 16 00:50:56 EDT 2006


Buehler, Eric (AGRE) wrote:
> Hello,
>
> However, the last line of the firwin function is causing me some
> heartburn.
> filter_design.py
>
> 1538    win = get_window(window,N,fftbins=1)
> 1539    alpha = N//2
> 1540    m = numpy.arange(0,N)
> 1541    h = win*special.sinc(cutoff*(m-alpha))
> 1542    return h / sum(h)
>
> Line 1542 of filter_design.py, "return h / sum(h)", normalizes the
> function where it doesn't seem necessary, at least in the kaiser window
> case.  Without the normalization, the kaiser window already returns a
> value of 1 at the zero frequency point.  This normalization scales all
> of the data, making the window difficult to use in the frequency domain.
>
> Can someone point me to the rationale for this line?  Looking at the
> code, this seems to be a pretty recent change (within the last year/year
> and a half).
>
>   
I'm not aware of if and when the change was made.   Was there a time 
when firwin did not have this normalization?

The normalization is done so that the resulting filter has a 0dB gain at 
DC (which is the center of the pass-band).

In other-words fft(h)[0] is approximately equal to 1.  This is usually 
what is desired as firwin returns "time-domain" filter coefficients.  
The return value of the function is not designed for use in the 
"frequency"-domain.  I'm not even sure what you mean by that in this 
context.

The intended usage of the result of firwin is in a convolution:

convolve(h, <mysignal>)

-Travis





More information about the SciPy-Dev mailing list