|
MNE-CPP 0.1.9
A Framework for Electrophysiology
|
The ParksMcClellan class provides the ParksMcClellan filter desing algorithm. More...
#include <parksmcclellan.h>
Public Types | |
| enum | TPassType { LPF , HPF , BPF , NOTCH } |
Public Member Functions | |
| ParksMcClellan (int NumTaps, double OmegaC, double BW, double ParksWidth, TPassType PassType) | |
| void | init (int NumTaps, double OmegaC, double BW, double ParksWidth, TPassType PassType) |
| void | CalcParkCoeff2 (int NBANDS, int NFILT) |
| double | LeGrangeInterp2 (int K, int N, int M) |
| double | GEE2 (int K, int N) |
| int | Remez2 (int GridIndex) |
| bool | ErrTest (int k, int Nut, double Comp, double *Err) |
| void | CalcCoefficients () |
Public Attributes | |
| Eigen::RowVectorXd | FirCoeff |
The ParksMcClellan class provides the ParksMcClellan filter desing algorithm.
DECLARE CLASS ParksMcClellan
Definition at line 95 of file parksmcclellan.h.

| enum RTPROCESSINGLIB::ParksMcClellan::TPassType |
Definition at line 101 of file parksmcclellan.h.
| ParksMcClellan::ParksMcClellan | ( | ) |
Definition at line 95 of file parksmcclellan.cpp.
| ParksMcClellan::ParksMcClellan | ( | int | NumTaps, |
| double | OmegaC, | ||
| double | BW, | ||
| double | ParksWidth, | ||
| TPassType | PassType | ||
| ) |
NumTaps must be odd for high pass and notch filters. Max number of taps is 128. The arrays can handle up to 256 taps, but 128 is a good practical limit for convergence. The minimum number of taps is 9 (maybe < 9, I forget the exact lower limit or what sets it) OmegaC is the 3 dB corner freq for low pass and high pass filters. It is the center freq for band pass and notch filters. BW is the bandwidth for bandpass and notch filters (ignored on low and high pass). OmegaC and BW are in terms of Pi. e.g. OmegaC = 0.5 centers a BPF at Omega = Pi/2. The PM algorithm however uses frequencies in terms of 2Pi, so we need to to this: Edge[j] /= 2.0 ParksWidth is the width of the transition bands. For simplicity, we only use one width, but the algorithm allows for unique values on every band edge. Practical limits for ParksWidth are 0.02 - 0.15 for BPF and Notch, 0.02 - 0.30 for LPF and HPF. TPassType is defined in the header file. LPF = Low Pass Filter, etc. You should note our 0.01 minimum width for each band. This limit works well for the algorithm. You will also find that OmegaC and BW need to be scaled a bit, depending ParksWidth, to get the 3 dB corner frequencies to come in on target.
e.g. NewParksMcClellan(33, 0.7, 0.2, 0.1, HPF); gives a 33 tap high pass filter with 3 dB corner at 0.7 with a transition bandwidth of 0.1 The FIR coefficients are placed in FirCoeff, starting at index 0.
Definition at line 115 of file parksmcclellan.cpp.
| ParksMcClellan::~ParksMcClellan | ( | ) |
Definition at line 137 of file parksmcclellan.cpp.
| void ParksMcClellan::CalcCoefficients | ( | ) |
This was added by IowaHills and is called from CalcParkCoeff2(). Calculation of the coefficients of the best approximation using the inverse discrete fourier transform.
Definition at line 619 of file parksmcclellan.cpp.
| void ParksMcClellan::CalcParkCoeff2 | ( | int | NBANDS, |
| int | NFILT | ||
| ) |
Definition at line 239 of file parksmcclellan.cpp.
| bool ParksMcClellan::ErrTest | ( | int | k, |
| int | Nut, | ||
| double | Comp, | ||
| double * | Err | ||
| ) |
This was added by IowaHills and is used in Remez() in 6 places.
Definition at line 609 of file parksmcclellan.cpp.
| double ParksMcClellan::GEE2 | ( | int | K, |
| int | N | ||
| ) |
Function to evaluate the frequency response using the Lagrange interpolation formula in the barycentric form.
Definition at line 579 of file parksmcclellan.cpp.
| void ParksMcClellan::init | ( | int | NumTaps, |
| double | OmegaC, | ||
| double | BW, | ||
| double | ParksWidth, | ||
| TPassType | PassType | ||
| ) |
Using nothrow prevents an exception from being thrown. new will instead return NULL. These array are much larger than actually needed. See the notes in the orig fortran file.
Definition at line 143 of file parksmcclellan.cpp.
| double ParksMcClellan::LeGrangeInterp2 | ( | int | K, |
| int | N, | ||
| int | M | ||
| ) |
Function to calculate the lagrange interpolation coefficients for use in the function gee.
Definition at line 558 of file parksmcclellan.cpp.
| int ParksMcClellan::Remez2 | ( | int | GridIndex | ) |
Definition at line 345 of file parksmcclellan.cpp.
| Eigen::RowVectorXd RTPROCESSINGLIB::ParksMcClellan::FirCoeff |
containt the generated filter coefficients.
Definition at line 185 of file parksmcclellan.h.