![](https://secure.gravatar.com/avatar/90b085ff1995ab4fe8b7ad0209a303f6.jpg?s=120&d=mm&r=g)
Hi, One of the features that I have found missing in SciPy are functions to design nyquist and root-nyquist filters, such as raised cosine and root-raised cosine filters. I have written several functions for this purpose and was curious if anyone thought was a greater need for this. Thanks, Jeff
![](https://secure.gravatar.com/avatar/d2aafb97833979e3668c61d36e697bfc.jpg?s=120&d=mm&r=g)
On Mon, Aug 25, 2014 at 6:55 PM, Jeff Grasty <jeff.grasty@gmail.com> wrote:
Hi,
One of the features that I have found missing in SciPy are functions to design nyquist and root-nyquist filters, such as raised cosine and root-raised cosine filters. I have written several functions for this purpose and was curious if anyone thought was a greater need for this.
Yes, that would be great! I have some scratch work for the raised cosine and root-raised cosine FIR filters, but they're not ready for contributing to scipy. If you have code in pretty good shape, these would be nice additions to scipy.signal. The first thing to think about is the API. What is the API of your code? A possible design is similar to the Savitzy-Golay filter implementation. It's a very basic, function-oriented API. One function, savgol_coeffs, provides the FIR filter coefficients, given the number of taps and the parameters of the filter. Another function, savgol_filter, takes an input array along with the filter parameters. It computes the coefficients and applies the filter. It is really just a convenience function: it calls savgol_coeffs to compute the filter coefficients, and applies the filter using a convolution (the only complication is that it provides several options for handling the edges of the input). Even more basic are the functions for FIR filter design using the window method. The functions firwin and firwin2 compute the filter coefficients, and leave it up to the user to convolve them with their signal. Looking forward to hearing more. Warren Thanks,
Jeff
_______________________________________________ SciPy-Dev mailing list SciPy-Dev@scipy.org http://mail.scipy.org/mailman/listinfo/scipy-dev
![](https://secure.gravatar.com/avatar/0b7d465c9e16b93623fd6926775b91eb.jpg?s=120&d=mm&r=g)
Here's code for nyquist filter coeffs. I apologize that it is quite old, and maybe could be a little more pretty. It is, however, quite well tested.
![](https://secure.gravatar.com/avatar/90b085ff1995ab4fe8b7ad0209a303f6.jpg?s=120&d=mm&r=g)
Warren, I currently have two functions, Nyquist and rootNyquist, that return the coefficients of a nyquist or root-nyquist filter with a specified alpha and length. The algorithm that the functions implement is one proposed by Fred Harris in hist multi-rate signal processing book. It uses the remez algorithm to start as an initial guess and uses a gradient descent method to adjust the cutoff frequency of the passband until the filter's 3 dB (or 6 dB) point is at half the baud rate. I think the API that you mentioned for the Savitzky-Golay filter uses sounds simple and effective. What are ideas of how to test this? I can think of writing some simple unit tests that check filter length, gain, etc. Would that be sufficient. Here is a link to my github project for the code so far: https://github.com/fstop22/nyquist_filters Thanks, Jeff
![](https://secure.gravatar.com/avatar/0b7d465c9e16b93623fd6926775b91eb.jpg?s=120&d=mm&r=g)
Interesting, but I am maybe missing something. This optimization only enforces flatness in passband and stopband, and 3dB pt. But nyquist filter is defined as having nyquist symmetry, which is what leads to zero ISI (the main reason for using a nyquist filter). There doesn't appear to be anything enforcing this symmmetry. Jeff Grasty wrote:
Warren,
I currently have two functions, Nyquist and rootNyquist, that return the coefficients of a nyquist or root-nyquist filter with a specified alpha and length. The algorithm that the functions implement is one proposed by Fred Harris in hist multi-rate signal processing book. It uses the remez algorithm to start as an initial guess and uses a gradient descent method to adjust the cutoff frequency of the passband until the filter's 3 dB (or 6 dB) point is at half the baud rate.
I think the API that you mentioned for the Savitzky-Golay filter uses sounds simple and effective.
What are ideas of how to test this? I can think of writing some simple unit tests that check filter length, gain, etc. Would that be sufficient.
Here is a link to my github project for the code so far: https://github.com/fstop22/nyquist_filters
Thanks, Jeff -- -- Those who don't understand recursion are doomed to repeat it
participants (3)
-
Jeff Grasty
-
Neal Becker
-
Warren Weckesser