<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Aug 6, 2017 at 1:10 PM, Phillip Feldman <span dir="ltr"><<a href="mailto:phillip.m.feldman@gmail.com" target="_blank">phillip.m.feldman@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Some of us in the engineering community are unhappy with the SciPy roadmap. From our perspective, the main deficiency of scipy.signal is that the filtering functionality is of limited practical utility. We would like to see the following:</div><div><br></div><div>(1) support for lowpass, bandpass, and bandstop FIR filter design, with the user specifying (a) the passband ripple, (b) the minimum stopband rejection, and (c) the design method, with this last being optional. Rather than forcing the user to specify the order of the filter, which requires many iterations to determine the minimum filter order that will do the job, we'd like to see the code automatically determine the minimum filter order that can meet the user's specs.</div><div><br></div><div>(2) support for fixed-binary-point arithmetic.</div><div><br></div><div>(3) support for filtering and the design of filters that use fixed-binary-point arithmetic.</div><div><br></div><div>Such changes would be a big step in the direction of making Python+NumPy+SciPy a viable alternative to Matlab + the Matlab Signal Processing Toolbox.</div><div><br></div><div>As an aside, I'd like to comment on the documentation for `scipy.signal.kaiserord`, which says the following:</div><div><br></div><div>scipy.signal.kaiserord(ripple, width)[source]</div><div><br></div><div><snip> ripple : float</div><div><br></div><div>Positive number specifying maximum ripple in passband (dB) and minimum ripple in stopband.</div><div><br></div><div>When designing a lowpass digital filter, one normally specifies the maximum ripple in the passband and the minimum rejection in the stopband. With this function, there is no way to specify how much rejection one gets in the stopband, and the filter design code is also apparently trying to limit stopband ripple, which is something that no engineer would care about. The documentation can't just be badly worded, because there would have to be another parameter to specify the stopband rejection.</div><div><br></div></div></blockquote><div><br><br>Phillip,<br><br>It looks like the explanation of the 'ripple' argument of the function 'kaiserord' needs some work.  You may be familiar with the following, but for anyone else following along, here's a summary of 'kaiserord'.<br><br>The function 'kaiserord' implements the empirical FIR filter design formulas developed by Kaiser in the late 60's and early 70's.  The reference that I have handy is Sections 7.5.3 and 7.6 of the text "Discrete-Time Signal Processing" (3rd ed.) by Oppenheim and Schafer.<br><br>It is true that in this method, there is only one parameter that controls the passband ripple *and* the stopband rejection.  Let delta be the attenuation (not in dB) in the stop band.  In the Kaiser method, delta also determines the ripple of the gain in the pass band: it varies between 1-delta and 1+delta. The stop band rejection in dB is A = -20*log10(delta).  This value (in dB) is the first argument of 'kaiserord'.<br><br>Kaiser developed an expression for beta, the Kaiser window parameter, that depends on A, and also a formula for the filter order M in terms of A and w, where w is the transition width between the pass and stop bands.<br><br>The Kaiser window design method, then, is to determine the order M and Kaiser window parameter beta using Kaiser's formula (implemented in `scipy.signal.kaiserord`), and then design the filter using the window method with a Kaiser window (using, for example, `scipy.signal.firwin`):<br><br>    numtaps, beta = kaiserord(A, w)<br>    taps = firwin(numtaps, cutoff, window=('kaiser', beta), [other args as needed])<br><br>Adding a good example to the docstring of 'kaiserord()' is on the SciPy to-do list (<a href="https://github.com/scipy/scipy/issues/7168">https://github.com/scipy/scipy/issues/7168</a>).  In the meantime, I have attached a self-contained script that demonstrates the Kaiser method for a lowpass filter.  It generates the attached plot.<br><br>Best regards,<br><br>Warren<br><br> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div></div><div>Phillip</div><div>--</div><div>Dr. Phillip M. Feldman</div></div>
<br>______________________________<wbr>_________________<br>
SciPy-Dev mailing list<br>
<a href="mailto:SciPy-Dev@python.org">SciPy-Dev@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/scipy-dev" rel="noreferrer" target="_blank">https://mail.python.org/<wbr>mailman/listinfo/scipy-dev</a><br>
<br></blockquote></div><br></div></div>