digital filter - How to use Python's scipy.signal.remez output for scipy.signal.lfilter? -


i creating bandpass filter in python. calculated transfer function coefficients using signal.remez, , frequency response looks how want to. however, signal.remez returns single 1d array of coefficients. expecting 2 arrays, set each numerator , denominator of transfer function.

how use output of python remez algorithm in signal.lfilter?

code snippet:

from scipy.signal import lfilter, remez  def rfilter(data, samplerate):     g           = samplerate/2.     f           = g/62.5     e           = f*0.875     d           = e*(3./7.)     c           = d*(4./15.)     coeff           = remez(400, [0, c, d, e, f, g], [0, 1, 0], hz=samplerate, maxiter=100)     return coeff   infile      = 'data.csv' data        = open(infile, 'r') data        = data.readlines() x           = [] v           = []   line in data:     line        = line.strip().split(',')     x.append(float(line[0]))     v.append(float(line[1]))   timestep    = x[1] - x[0] samplerate  = 1/timestep  #here array of coefficients remez returns.  coeff       = rfilter(v, samplerate)  #from coeff, need generate , b, numerator , denomenator coefficients #fv             = lfilter(a, b, v) 


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -