multirate_helper

Multirate help for building interpolation and decimation systems

Copyright (c) March 2017, Mark Wickert All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

The views and conclusions contained in the software and documentation are those of the authors and should not be interpreted as representing official policies, either expressed or implied, of the FreeBSD Project.

sk_dsp_comm.multirate_helper.freqz_resp(b, a=[1], mode='dB', fs=1.0, Npts=1024, fsize=(6, 4))[source]

A method for displaying digital filter frequency response magnitude, phase, and group delay. A plot is produced using matplotlib

freq_resp(self,mode = ‘dB’,Npts = 1024)

A method for displaying the filter frequency response magnitude, phase, and group delay. A plot is produced using matplotlib

freqz_resp(b,a=[1],mode = ‘dB’,Npts = 1024,fsize=(6,4))

b = ndarray of numerator coefficients a = ndarray of denominator coefficents

mode = display mode: ‘dB’ magnitude, ‘phase’ in radians, or

‘groupdelay_s’ in samples and ‘groupdelay_t’ in sec, all versus frequency in Hz

Npts = number of points to plot; defult is 1024

fsize = figure size; defult is (6,4) inches

Mark Wickert, January 2015

class sk_dsp_comm.multirate_helper.multirate_FIR(b)[source]

A simple class for encapsulating FIR filtering, or FIR upsample/ filter, or FIR filter/downsample operations used in modeling a comm system. Objects of this class will hold the required filter coefficients once an object is instantiated. Frequency response and the pole zero plot can also be plotted using supplied class methods.

Mark Wickert March 2017

Methods

dn(x[, M_change])

Downsample and filter the signal

filter(x)

Filter the signal

up(x[, L_change])

Upsample and filter the signal

zplane([auto_scale, size, detect_mult, tol])

Plot the poles and zeros of the FIR filter in the z-plane

freq_resp

dn(x, M_change=12)[source]

Downsample and filter the signal

filter(x)[source]

Filter the signal

freq_resp(mode='dB', fs=8000, ylim=[-100, 2])[source]
up(x, L_change=12)[source]

Upsample and filter the signal

zplane(auto_scale=True, size=2, detect_mult=True, tol=0.001)[source]

Plot the poles and zeros of the FIR filter in the z-plane

class sk_dsp_comm.multirate_helper.multirate_IIR(sos)[source]

A simple class for encapsulating IIR filtering, or IIR upsample/ filter, or IIR filter/downsample operations used in modeling a comm system. Objects of this class will hold the required filter coefficients once an object is instantiated. Frequency response and the pole zero plot can also be plotted using supplied class methods. For added robustness to floating point quantization all filtering is done using the scipy.signal cascade of second-order sections filter method y = sosfilter(sos,x).

Mark Wickert March 2017

Methods

dn(x[, M_change])

Downsample and filter the signal

filter(x)

Filter the signal using second-order sections

freq_resp([mode, fs, ylim])

Frequency response plot

up(x[, L_change])

Upsample and filter the signal

zplane([auto_scale, size, detect_mult, tol])

Plot the poles and zeros of the FIR filter in the z-plane

dn(x, M_change=12)[source]

Downsample and filter the signal

filter(x)[source]

Filter the signal using second-order sections

freq_resp(mode='dB', fs=8000, ylim=[-100, 2])[source]

Frequency response plot

up(x, L_change=12)[source]

Upsample and filter the signal

zplane(auto_scale=True, size=2, detect_mult=True, tol=0.001)[source]

Plot the poles and zeros of the FIR filter in the z-plane

class sk_dsp_comm.multirate_helper.rate_change(M_change=12, fcutoff=0.9, N_filt_order=8, ftype='butter')[source]

A simple class for encapsulating the upsample/filter and filter/downsample operations used in modeling a comm system. Objects of this class will hold the required filter coefficients once an object is instantiated.

Mark Wickert February 2015

Methods

dn(x)

Downsample and filter the signal

up(x)

Upsample and filter the signal

dn(x)[source]

Downsample and filter the signal

up(x)[source]

Upsample and filter the signal