DF¶
-
class
pylayers.signal.DF.
DF
(b=array([1]), a=array([1]))[source]¶ Bases:
pylayers.util.project.PyLayers
Digital Filter Class
- aarray
transfer function coefficients denominator
- barray
transfer function coefficients numerator
- parray dtype=complex
transfer function poles
- zarray dtype=complex
transfer function zeros
filter : filter a signal freqz : Display transfer function ellip_bp : elliptic bandpath filter remez : FIR design
Attributes Summary
Methods Summary
butter
([order, w, typ])Butterwoth digital filter design
ellip_bp
(wp, ws[, gpass, gstop])Elliptic Bandpath filter
factorize the filter into a minimal phase and maximal phase
filter
(s[, causal])filter s
flipc
()flip coefficient
freqz
(**kwargs)freqz : evaluation of filter transfer function
ir
([N, show])returns impulse response
match
()return a match filter
remez
([numtaps, bands, desired])FIR design Remez algorithm
simplify
([tol])simplify transfer function
update
()wnxcorr
(**kwargs)filtered noise output autocorrelation
zplane
([title, fontsize])Display filter in the complex plane
Attributes Documentation
-
a
¶
-
b
¶
-
p
¶
-
z
¶
Methods Documentation
-
butter
(order=5, w=0.25, typ='low')[source]¶ Butterwoth digital filter design
- orderint
filter order
- warray_like
a scalar or length-2 sequence (relative frequency 0<1 fN <=> 1)
- typstring
‘lowpass’ | ‘highpass’ | ‘bandpass’ | ‘bandstop’
>>> from pylayers.signal.DF import * >>> flt = DF() >>> flt.butter(order=3,w=0.25,typ='low') >>> flt.freqz()
-
ellip_bp
(wp, ws, gpass=0.5, gstop=20)[source]¶ Elliptic Bandpath filter
wp : ws : gpass gstop :
iirdesign
-
factorize
()[source]¶ factorize the filter into a minimal phase and maximal phase
- (Fmin,Fmax)tuple of filter
Fmin : minimal phase filter Fmax : maximal phase filter
-
filter
(s, causal=True)[source]¶ filter s
- snp.array |TUsignal
input signal
- ynp.array | TUsignal
output signal
>>> import matplotlib.pyplot as plt >>> df = DF(b=np.array([1,1],a=np.array([1,-1])) >>> N = 100 >>> s = np.zeros(N) >>> s[0] = 1 >>> y = df.filter(s) >>> plt.stem(np.arange(N),x) >>> plt.stem(np.arange(N),y) >>> plt.show()
-
freqz
(**kwargs)[source]¶ freqz : evaluation of filter transfer function
The function evaluates an FUsignal
- displayboolean
True
- fsGHzfloat
if set to 0 (relative frequency)
-
match
()[source]¶ return a match filter
DF :
if $$H(z)=\frac{1+b_1z^1+…+b_Nz^{-N}}{1+a_1z^1+…+a_Mz^{-M}}$$
it returns
$$H_m(z)=\frac{b_N+b_{N-1}z^1+…+z^{-N}}{1+a_1z^1+…+a_Mz^{-M}}$$
-
remez
(numtaps=401, bands=(0, 0.1, 0.11, 0.2, 0.21, 0.5), desired=(0.0001, 1, 0.0001))[source]¶ FIR design Remez algorithm
numtaps : int bands : tuple of N floats desired : tuple of N/2 floats
flt.remez(numtaps=401,bands=(0,0.1,0.11,0.2,0.21,0.5),desired=(0.0001,1,0.0001)):
numtaps = 401 bands = (0,0.1,0.11,0.2,0.21,0.5) desired = (0.0001,1,0.0001))
flt.remez( numtaps , bands , desired)