In file IIRFilter/IIRFilter.hh:

class IIRFilter : public Pipe

Digital IIR filter implementation API

Inheritance:


Public Methods

IIRFilter (void)
Default constructor.
explicit IIRFilter (double design_sample_rate)
Default constructor.
IIRFilter (unsigned int npoles, const dComplex* pole, unsigned int nzeros, const dComplex* zero, double design_sample_rate)
Constructor from poles and zeros
IIRFilter (unsigned int npoles, const dComplex* pole, unsigned int nzeros, const dComplex* zero, double design_sample_rate, double gain)
Constructor from poles and zeros
IIRFilter& operator= (const IIRFilter& f)
Assign filter characteristics from one IIR filter to another
IIRFilter& operator*= ( const IIRFilter& f )
Add an other IIRFilter to this one
IIRFilter& operator*= ( const IIRSos& sos )
Add a single second order section to an IIR filter
IIRFilter& operator*= ( const double& gainfactor )
Multiply filter gain by a numerical factor
IIRFilter (const IIRFilter& f)
copy constructor
void init (unsigned int npoles, const dComplex* pole, unsigned int nzeros, const dComplex* zero, double design_sample_rate, double gain)
This function sets the pole and zero frequencies of the filter and the filter gain
int dumpSosData (std::ostream& output) const
Print the values of the second order section coefficients
int dumpSPlaneRoots (std::ostream& output) const
Print the root values
~IIRFilter (void)
Default destructor.
IIRFilter* clone (void) const
Clone the filter.
TSeries apply (const TSeries& data_in)
Apply filter to a timeseries.
void dataCheck (const TSeries& data_in) const
Check data integrity
void reset (void)
Not implemented.
bool inUse (void) const
Check filter for coefficients, history buffers.
Time getStartTime (void) const
Get data start time.
Time getCurrentTime (void) const
Get start time for current data.
unsigned getOrder (void) const
Filter order.
bool hasSRepresentation (void) const
Check if filter has s-plane representation.
const std::vector <double> & getRealPoles (void) const
Real pole list.
const std::vector <dComplex> & getComplexPoles (void) const
Complex pole list.
const std::vector <double> & getRealZeros (void) const
Real zero list.
const std::vector <dComplex> & getComplexZeros (void) const
Complex zero list.
double getGain (void) const
Gain.
double getFSample (void) const
Sampling rate .
bool isInvertible (void) const
Check if filter is invertible.
const std::vector <IIRSos> & getSOS (void) const
SOS list.

Protected Methods

bool xfer (fComplex& coeff, double f) const
Get a transfer coefficent of a Filter.

Inherited from Pipe:

Public Methods

virtual TSeries operator)(const TSeries& in)
FilterIO& operator)(const FilterIO& in)
virtual bool isDataValid(const TSeries& in) const
KeyChain& getInputKeys(void) const
KeyChain& getOutputKeys(void) const
virtual Interval getTimeDelay(void) const
virtual bool Xfer(fComplex& coeff, double f) const
virtual bool Xfer(fComplex* tf, const float* freqs, int points) const
virtual bool Xfer(FSeries& Fs, float Fmin = 0.0, float Fmax = 1000.0, float dF = 1.0) const

Inherited from FilterBase:

Public Methods

virtual bool rootGetStartTime(Time& t) const throw()
virtual bool rootGetCurrentTime(Time& t) const throw()

Documentation

IIR Filter implements digital IIR (Infinite Impulse Response) filters. An object of class IIRFilter is constructed by specifying the positions of the filter poles and zeros in the S plane and the sampling rate of the data. Any TSeries object can be filtered. Note that error trapping to spot gaps between successive TSeries inputs applied to the same filter is not yet implemented.
IIRFilter(void)
Default constructor. No coefficient or history storage is allocated.

explicit IIRFilter(double design_sample_rate)
Constructor. Makes a unity operator.
Parameters:
design_sample_rate - The sampling rate of the channel to be filtered, in Hz.

IIRFilter(unsigned int npoles, const dComplex* pole, unsigned int nzeros, const dComplex* zero, double design_sample_rate)
Constructor from S plane poles and zeros. The pole and zero positions are written to two arrays of type dComplex. For example, to initialize a filter with two poles at 10Hz and no zeros, you could type: dComplex pole0(-10,0); dComplex pole1(-10,0); dComplex poles[2]; pole[0]=pole0; pole[1]=pole1; IIRFilter myfilter(2,poles,0,0x0,256); This IIRFilter myfilter could be applied to any channel with a 256 Hz sampling rate. The gain of the filter is set to 1, so that the transfer function is
H(s) = \frac{(s - s_1)(s - s_2) \cdots}{(s - p_1)(s - p_2) \cdots}$$

Parameters:
npoles - The number of poles.
pole - An array of type dComplex containing the list of poles. Note that where a complex pole is in the list, its complex conjugate must also be in the list. The convention for root specification is the same as for Matlab, except that matlab expresses s plane values in whereas here s plane values are in Hz. So to enter Matlab generated poles and zeros with this software, divide real and imaginary parts by .
nzeros. - The number of zeros.
zero - An array of type dComplex containing the list of zeros. See comment above for pole specification.
design_sample_rate - The sampling rate of the channel to be filtered, in Hz.

IIRFilter(unsigned int npoles, const dComplex* pole, unsigned int nzeros, const dComplex* zero, double design_sample_rate, double gain)
Constructor from S plane poles and zeros. The pole and zero positions are written to two arrays of type dComplex. For example, to initialize a filter with two poles at 10Hz and no zeros, you could type: dComplex pole0(-10,0); dComplex pole1(-10,0); dComplex poles[2]; pole[0]=pole0; pole[1]=pole1; IIRFilter myfilter(2,poles,0,0x0,256); This IIRFilter myfilter could be applied to any channel with a 256 Hz sampling rate.
Parameters:
npoles - The number of poles.
pole - An array of type dComplex containing the list of poles. Note that where a complex pole is in the list, its complex conjugate must also be in the list. The convention for root specification is the same as for Matlab, except that matlab expresses s plane values in whereas here s plane values are in Hz. So to enter Matlab generated poles and zeros with this software, divide real and imaginary parts by .
nzeros. - The number of zeros.
zero - An array of type dComplex containing the list of zeros. See comment above for pole specification.
gain - The gain of the filter.
design_sample_rate - The sampling rate of the channel to be filtered, in Hz.

IIRFilter& operator=(const IIRFilter& f)
Assign filter characteristics from one IIR filter to another

IIRFilter& operator*=( const IIRFilter& f )
Add an other IIRFilter to this one

IIRFilter& operator*=( const IIRSos& sos )
Add a single second order section to an IIR filter

IIRFilter& operator*=( const double& gainfactor )
Multiply filter gain by a numerical factor

IIRFilter(const IIRFilter& f)
Copy an existing filter.

void init(unsigned int npoles, const dComplex* pole, unsigned int nzeros, const dComplex* zero, double design_sample_rate, double gain)
This function sets the pole and zero frequencies of the filter and the filter gain. All values are in Hz. To input compute poles and zeros from s plane parameters, divide the s plane parameters (poles and zeros) by . See documentation for constructors for details on how to initialize filters.

int dumpSosData(std::ostream& output) const
Print the values of the second order section coefficients

int dumpSPlaneRoots(std::ostream& output) const
Print the positions of the S plane poles and zeros in rad s^-1.

~IIRFilter(void)
Default destructor. Frees the history buffers.

IIRFilter* clone(void) const
Clone an IIR Filter

TSeries apply(const TSeries& data_in)
Apply filter to a timeseries. No error trapping for gaps between successive timeseries filtered. Note that a filter should always be applied to the same channel.
Returns:
Filtered TSeries.

void dataCheck(const TSeries& data_in) const
Check data before filtering. Not implemented.

void reset(void)
Clear history buffers, clear error flag. Not implemented.

bool inUse(void) const
See if filter coefficients have been set and history buffers created.
Returns:
1 (true) if yes, 0 (false) if no

Time getStartTime(void) const
Get data start time.
Returns:
Start time for first data set on which IIR filter applied.

Time getCurrentTime(void) const
Get start time for current data.
Returns:
Current time for first data set on which IIR filter applied.

unsigned getOrder(void) const
Get filter order. Implemented for pole/zero designs. The filter order is defined as max(number of zeros,number of poles)
Returns:
Order of filter

bool hasSRepresentation(void) const
Check if filter has s-plane representation.

const std::vector <double> & getRealPoles(void) const
Get real pole list.
Returns:
Real pole list

const std::vector <dComplex> & getComplexPoles(void) const
Get complex pole list.
Returns:
Complex pole list

const std::vector <double> & getRealZeros(void) const
Get real zero list.
Returns:
Real zero list

const std::vector <dComplex> & getComplexZeros(void) const
Get complex zero list.
Returns:
Complex zero list

double getGain(void) const
Get gain.
Returns:
gain

double getFSample(void) const
Get sampling rate.
Returns:
Sampling rate

bool isInvertible(void) const
Check if filter is invertible.

const std::vector <IIRSos> & getSOS(void) const
Get SOS list.
Returns:
SOS list

bool xfer(fComplex& coeff, double f) const
The transfer coefficient of the filter at the specified frequency is calculated and returned as a complex number. Filters that support a fast way to compute a transfer coefficient should implement this method and return true.
Returns:
true if successful
Parameters:
coeff - a complex number representing the Filter response at the specified frequency (return)
f - Frequency at which to sample the transfer function.


This class has no child classes.
Author:
Edward J. Daw @email edaw@lsuligo.phys.lsu.edu
Version:
1.0; Last modified: June 9, 2001

alphabetic index hierarchy of classes


Please send questions and comments to zweizig_j@ligo.caltech.edu


generated by doc++