[SciPy-User] plot sos (freqz for sos) filter

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[SciPy-User] plot sos (freqz for sos) filter

Neal Becker
Happy to see sos format supported.  Getting the response of the sos design
requires a little effort.  A nice addition would be for freqz to directly
support an sos input.

Here's some code which I'm using for now:

sos = signal.ellip (8, 0.5, 80, 0.5 * 500e3/(sps*250e6), output='sos')
ba = [signal.sos2tf(s[np.newaxis,:]) for s in sos]
ws = np.pi * np.logspace (-4, 0, num=500)
wh = [signal.freqz (_[0],_[1],worN=ws) for _ in ba]
plt.semilogx (wh[0][0]/np.pi, np.clip (20*np.log10(np.abs(np.prod ([_[1] for
_ in wh], axis=0))),-100,0))



_______________________________________________
SciPy-User mailing list
[hidden email]
https://mail.scipy.org/mailman/listinfo/scipy-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: plot sos (freqz for sos) filter

Warren Weckesser-2


On Mon, Jun 6, 2016 at 3:25 PM, Neal Becker <[hidden email]> wrote:
Happy to see sos format supported.  Getting the response of the sos design
requires a little effort.  A nice addition would be for freqz to directly
support an sos input.

Here's some code which I'm using for now:

sos = signal.ellip (8, 0.5, 80, 0.5 * 500e3/(sps*250e6), output='sos')
ba = [signal.sos2tf(s[np.newaxis,:]) for s in sos]
ws = np.pi * np.logspace (-4, 0, num=500)
wh = [signal.freqz (_[0],_[1],worN=ws) for _ in ba]
plt.semilogx (wh[0][0]/np.pi, np.clip (20*np.log10(np.abs(np.prod ([_[1] for
_ in wh], axis=0))),-100,0))




I started an implementation of 'sosfreqz' here: https://github.com/scipy/scipy/pull/4465

The implementation is simple--just repeated calls to freqz--but the API needs work.  I've been away from nontrivial scipy development for the last six months or so, and at the moment there are a couple other pull requests with higher priority that I will be working on for the 0.18 release, so I probably won't get back sosfreqz for a while.  There are several active developers working on scipy.signal these days, and I suspect if you poke the right ones, someone might take over that work or start a new pull request (which would be fine with me!).

Warren

 

_______________________________________________
SciPy-User mailing list
[hidden email]
https://mail.scipy.org/mailman/listinfo/scipy-user


_______________________________________________
SciPy-User mailing list
[hidden email]
https://mail.scipy.org/mailman/listinfo/scipy-user
Loading...