• seeking scipy examples of swept-coefficient (time varying) filters

    From Robert Poor@21:1/5 to All on Sun Mar 8 16:38:46 2020
    I've been pleased with ease of use of the scipy.signal package for implementing bandpass filters: the `signal.butterworth()`, `signal.sosfilt_zi()` and `signal.sosfilt()` functions do just what I expect for a filter with constant center frequency and
    bandwidth.

    But now I'd like to make the frequency and bandwidth settings be time varying functions themselves, and I'm not sure how to do that.

    One nuance: I'm processing a buffer at a time, so I need to capture the filter state at the end of one buffer and re-initialize the filter state at the onset of the next.

    Can anyone offer guidance or examples on how to do that, preferably in scipy?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From rdpoor@klatunetworks.com@21:1/5 to All on Sun Mar 8 17:21:22 2020
    P.S. Acknowledging Steve Pope's observation that:

    Lattice filters are stable if the coefficients for the recursive part
    of the filter are in the range (-1,+1). One can ramp between, or
    even switch between two such sets of coefficients without instabilities.

    ... I should probably rephrase my question to "can anyone offer guidance on implementing lattice filters in scipy?"

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Robert Poor@21:1/5 to All on Sun Mar 8 17:28:50 2020
    I should have mentioned: as Steve Pope points out in:

    https://groups.google.com/d/msg/comp.dsp/bAUKDSnvLzw/ejI-J-aQzusJ

    Lattice filters are stable if the coefficients for the recursive part
    of the filter are in the range (-1,+1). One can ramp between, or
    even switch between two such sets of coefficients without instabilities.

    ... I should probably rephrase my question to be "can anyone offer guidance or examples of implementing lattice filters in scipy?"

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Steve Pope@21:1/5 to rdpoor@gmail.com on Tue Mar 10 00:12:55 2020
    Robert Poor <rdpoor@gmail.com> wrote:

    I should have mentioned: as Steve Pope points out in:

    https://groups.google.com/d/msg/comp.dsp/bAUKDSnvLzw/ejI-J-aQzusJ

    Lattice filters are stable if the coefficients for the recursive part
    of the filter are in the range (-1,+1). One can ramp between, or
    even switch between two such sets of coefficients without instabilities.

    ... I should probably rephrase my question to be "can anyone offer
    guidance or examples of implementing lattice filters in scipy?"

    I have no familiarity with scipy, unfortauntely. You may want
    to ask this question on Stack Exchange.

    Lattice filters are an excellent choice if you need to vary the
    coefficients on a sample by sample (or otherwise rapid) basis,
    but I think you said you are processing blocks of data, with
    coefficients fixed between blocks, so in that case any of the
    basic filter topologies will be equivalent.

    One the other hand, if after filtering, you need to "stitch"
    the blocks together, and want to do some sort of smothing between
    blocks so that there is not a glitch, lattice topology might make
    that easiter.

    Steve

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Robert Poor@21:1/5 to Steve Pope on Mon Mar 9 19:22:56 2020
    On Monday, March 9, 2020 at 5:12:59 PM UTC-7, Steve Pope wrote:

    ...I think you said you are processing blocks of data, with
    coefficients fixed between blocks

    That's half right: I am processing blocks of data, but the coefficients will be changing on a sample-by-sample basis.

    I think I can construct a lattice filter from first principles in scipy (with luck), so what I really need to learn is how to derive the A[n] and B[n] coefficients as a function of the human readable parameters: center frequency and bandwidth.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Steve Pope@21:1/5 to rdpoor@gmail.com on Tue Mar 10 19:57:37 2020
    Robert Poor <rdpoor@gmail.com> wrote:

    That's half right: I am processing blocks of data, but the coefficients
    will be changing on a sample-by-sample basis.

    I think I can construct a lattice filter from first principles in scipy
    (with luck), so what I really need to learn is how to derive the A[n]
    and B[n] coefficients as a function of the human readable parameters:
    center frequency and bandwidth.

    Great. That is a filter synthesis problem of which there are
    many methods.

    Steve

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)