pyfda.filter_widgets package

Submodules

pyfda.filter_widgets.bessel module

pyfda.filter_widgets.butter module

pyfda.filter_widgets.cheby1 module

pyfda.filter_widgets.cheby2 module

pyfda.filter_widgets.common module

class pyfda.filter_widgets.common.Common[source]

Bases: object

Common settings and some helper functions for filter design

pyfda.filter_widgets.common.remezord(freqs, amps, rips, fs=1, alg='ichige')[source]

Filter parameter selection for the Remez exchange algorithm. Supplies remezord method according to Scipy Ticket #475

https://github.com/thorstenkranz/eegpy/blob/master/eegpy/filter/remezord.py

Calculate the parameters required by the Remez exchange algorithm to construct a finite impulse response (FIR) filter that approximately meets the specified design.

Parameters:
  • freqs (list) – A monotonic sequence of band edges specified in Hertz. All elements must be non-negative and less than 1/2 the sampling frequency as given by the fs parameter. The band edges “0” and “f_S / 2” do not have to be specified, hence 2 * number(amps) - 2 freqs are needed.

  • amps (list) – A sequence containing the amplitudes of the signal to be filtered over the various bands, e.g. 1 for the passband, 0 for the stopband and 0.42 for some intermediate band.

  • rips (list) – A list with the peak ripples (linear, not in dB!) for each band. For the stop band this is equivalent to the minimum attenuation.

  • fs (float) – Sampling frequency

  • alg (string) – Filter length approximation algorithm. May be either ‘herrmann’, ‘kaiser’ or ‘ichige’. Depending on the specifications, some of the algorithms may give better results than the others.

Return type:

numtaps, bands, desired, weight – See help for the remez function.

Examples

We want to design a lowpass with the band edges of 40 resp. 50 Hz and a sampling frequency of 200 Hz, a passband peak ripple of 10% and a stop band ripple of 0.01 or 40 dB.

>>> (L, F, A, W) = remezord([40, 50], [1, 0], [0.1, 0.01], fs = 200)
pyfda.filter_widgets.common.remlplen_herrmann(fp, fs, dp, ds)[source]

Determine the length of the low pass filter with passband frequency fp, stopband frequency fs, passband ripple dp, and stopband ripple ds. fp and fs must be normalized with respect to the sampling frequency. Note that the filter order is one less than the filter length.

Uses approximation algorithm described by Herrmann et al.:

O. Herrmann, L.R. Raviner, and D.S.K. Chan, Practical Design Rules for Optimum Finite Impulse Response Low-Pass Digital Filters, Bell Syst. Tech. Jour., 52(6):769-799, Jul./Aug. 1973.

pyfda.filter_widgets.common.remlplen_ichige(fp: float, fs: float, dp: float, ds: float) int[source]

Determine the length of the low pass filter with passband frequency fp, stopband frequency fs, passband ripple dp, and stopband ripple ds. fp and fs must be normalized with respect to the sampling frequency. Note that the filter order is one less than the filter length. Uses approximation algorithm described by Ichige et al.: K. Ichige, M. Iwaki, and R. Ishii, Accurate Estimation of Minimum Filter Length for Optimum FIR Digital Filters, IEEE Transactions on Circuits and Systems, 47(10):1008-1017, October 2000.

This seems tol give the most accurate results of the three approximations.

pyfda.filter_widgets.common.remlplen_kaiser(fp, fs, dp, ds)[source]

Determine the length of the low pass filter with passband frequency fp, stopband frequency fs, passband ripple dp, and stopband ripple ds. fp and fs must be normalized with respect to the sampling frequency. Note that the filter order is one less than the filter length.

Uses approximation algorithm described by Kaiser:

J.F. Kaiser, Nonrecursive Digital Filter Design Using I_0-sinh Window function, Proc. IEEE Int. Symp. Circuits and Systems, 20-23, April 1974.

pyfda.filter_widgets.delay module

pyfda.filter_widgets.ellip module

pyfda.filter_widgets.ellip_zero module

pyfda.filter_widgets.equiripple module

pyfda.filter_widgets.firwin module

pyfda.filter_widgets.ma module

pyfda.filter_widgets.manual module

Dummy / template file for manual filter designs by entering P/Z or b/a. Targets for LP, HP, BP, BS are provided. Returns nothing.

Attention: This class is re-instantiated dynamically everytime the filter design method is selected, calling the __init__ method.

API version info:
1.0:

initial working release

1.1:

mark private methods as private

1.2:

new API using fil_save

1.3:

new public methods destruct_UI + construct_UI (no longer called by __init__)

1.4:

module attribute filter_classes contains class name and combo box name instead of class attribute name

2.0:

Specify the parameters for each subwidget as tuples in a dict where the first element controls whether the widget is visible and / or enabled. This dict is now called self.rt_dict. When present, the dict self.rt_dict_add is read and merged with the first one.

2.1:

Remove empty methods construct_UI and destruct_UI and attributes self.wdg and self.hdl

2.2:

Rename filter_classes -> classes, remove Py2 compatibility

class pyfda.filter_widgets.manual.Manual_FIR[source]

Bases: object

Dummy filter design class, used / displayed when coefficients or P/Z have been entered manually.

BPman(fil_dict)[source]

Dummy method, to display widgets corresponding to filter type in UI

BSman(fil_dict)[source]

Dummy method, to display widgets corresponding to filter type in UI

DIFFman(fil_dict)[source]

Dummy method, to display widgets corresponding to filter type in UI

HILman(fil_dict)[source]

Dummy method, to display widgets corresponding to filter type in UI

HPman(fil_dict)[source]

Dummy method, to display widgets corresponding to filter type in UI

LPman(fil_dict)[source]

Dummy method, to display widgets corresponding to filter type in UI

class pyfda.filter_widgets.manual.Manual_IIR[source]

Bases: object

Dummy filter design class, used / displayed when coefficients or P/Z have been entered manually.

BPman(fil_dict)[source]

Dummy method, to display widgets corresponding to filter type in UI

BSman(fil_dict)[source]

Dummy method, to display widgets corresponding to filter type in UI

DIFFman(fil_dict)[source]

Dummy method, to display widgets corresponding to filter type in UI

HILman(fil_dict)[source]

Dummy method, to display widgets corresponding to filter type in UI

HPman(fil_dict)[source]

Dummy method, to display widgets corresponding to filter type in UI

LPman(fil_dict)[source]

Dummy method, to display widgets corresponding to filter type in UI

pyfda.filter_widgets.manual.classes = {'Manual_FIR': 'Manual', 'Manual_IIR': 'Manual'}

display name

Type:

Dict containing class name

Module contents

pyfda.filter_widgets.bessel