In file LPEFilter/LPEFilter.hh:

class LPEFilter : public FIRFilter

Linear Predictive Error Filter implementation.

Inheritance:


Public Methods

LPEFilter (int filterLength = 0, int trainPeriod = 0, int trainLength = 0)
Default constructor.
LPEFilter (const LPEFilter& lpef)
Copy constructor.
virtual ~LPEFilter (void)
Destructor.
LPEFilter& operator= (const LPEFilter& lpef)
Assignment operator.
int apply (const TSeries& in, TSeries& out)
Filter TSeries
int train (const TSeries& data)
Determine filter coefficients
void setTrainPeriod (int period)
Set retraining period
void setTrainLength (int length)
Set training length
void setHistory (const TSeries& in)
Set History from TSeries
int getTrainPeriod (void) const
Get retraining period
int getTrainLength (void) const
Get training length
Time getTrainTime (void) const
Get time of most recent training
Interval getTransientTime (void) const
Get the filter length in seconds.

Inherited from FIRFilter:

Public Methods

virtual FIRFilter* clone(void) const
void dataCheck(const TSeries& ts) const
Time getCurrentTime(void) const
int getLength(void) const throw()
double getRate(void) const throw()
Time getStartTime(void) const
bool getStat(void) const throw()
Interval getTimeDelay(void) const
bool inUse(void) const
void dump(std::ostream& ostr) const throw()
void reset(void)
void setCoefs(int N, const double* Coefs) throw()
void setCoefs(const double* Coefs) throw()
void setLength(int N) throw()
void setRate(double F) throw()
virtual bool Xfer(fComplex& coeff, double f) const throw()
bool Xfer(fComplex* tf, const float* freqs, int points) const throw()
FSeries Xfer(float Fmin=0.0, float Fmax=0.0, float dF=1.0) const throw()

Protected Methods

bool xfer(fComplex& coeff, double f) const throw()

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

Inherited from FilterBase:

Public Methods

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

Documentation

Linear predictive error filters are FIR filters whose coefficients are optimized in a least-squares sense to predict and remove the stationary components of a signal. It is a useful technique for removing line frequencies or a constant background from a signal and provides a simple method to rapidly identify transient events.

The LPEFilter class implements a linear predictive error filter based on the FIRFilter class. In addition to the methods of FIRFilter, LPEFilter provides the following functionality.

A method is provided to determine the optimal filter coefficients based on training data, while ensuring that the filter history is retained.

Initial training is automatically performed when the filter is applied to data for the first time. Subsequent periodic retraining is automatically performed at predefined intervals. In addition, the user can call the training functions directly.

Like FIRFilter, LPEFilter operates on successive blocks of data. To ensure that retraining does not occur across succesive data blocks, the user specified retraining period should be an integer multiple of the block duration.

All data are promoted to type double prior to filtering.

LPEFilter(int filterLength = 0, int trainPeriod = 0, int trainLength = 0)
Construct a new filter with the given filter length, retraining period, and training length. The filter history and start times are cleared.
Parameters:
Filter - length
Retraining - period
Training - length

LPEFilter(const LPEFilter& lpef)
Creates new filter with the same filter length, retraining period, training length, sample rate, and filter coefficients as the given filter. The filter history and start times are cleared.

virtual ~LPEFilter(void)
Destroys the filter and releases any allocated memory.

LPEFilter& operator=(const LPEFilter& lpef)
Creates new filter with the same filter length, retraining period, training length, sample rate, and filter coefficients as the given filter. The filter history and start times are cleared.

int apply(const TSeries& in, TSeries& out)
Filters an input TSeries and places the result in the given output TSeries. Before filtering, training is performed if the filter has never been trained or if the retrain period has elapsed. A non-zero return value indicates a training was performed. The filter history is also updated.
Returns:
Non-zero if retrain occurred
Parameters:
TSeries - input
TSeries - output

int train(const TSeries& data)
Determine the optimal filter coefficients based on training data. The entire TSeries is used as the training data. The training data length must be greater than the filter length. A non-zero return value indicates that the training was unsuccessful.
Returns:
Non-zero on error
Parameters:
TSeries - training data

void setTrainPeriod(int period)
Sets the length of time (in seconds) between trainings. To ensure that training does not occur across the boundary between successive data blocks, the retraining period should be an integer multiple of the data block duration. A value of zero prevents automatic periodic retraining of the filter.
Parameters:
Retraining - period [seconds]

void setTrainLength(int length)
Sets the amount of data (in samples) which is used to train the filter. To determine the filter coefficients, the training algorithm requires a training length greater than the filter length.
Parameters:
Training - length [samples]

void setHistory(const TSeries& in)
Sets the filter history by applying the filter to a TSeries.
Parameters:
TSeries - data

int getTrainPeriod(void) const
Gets the length of time (in seconds) between trainings.
Returns:
Retraining period [seconds]

int getTrainLength(void) const
Gets the amount of data (in samples) which is used to train the filter.
Returns:
Training length [samples]

Time getTrainTime(void) const
Gets the time of the most recent filter training. The train time is set automatically whenever the filter is trained.
Returns:
Time of last training

Interval getTransientTime(void) const
Gets the length in seconds of the filter's impulse response. Determines the dead time after an impulsive event, during which the filter output is unreliable.
Returns:
Filter length in seconds.


This class has no child classes.
Author:
Shourov K. Chatterji
Version:
1.2; Last modified: January 14, 2005

alphabetic index hierarchy of classes


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


generated by doc++