Public Member Functions | List of all members
FFTtools::DigitalFilter Class Referenceabstract

#include <DigitalFilter.h>

Public Member Functions

virtual double * filter (size_t n, const double *w) const
 
virtual void filterOut (size_t n, const double *w, double *out) const =0
 
virtual void filterGraph (TGraph *g, bool filterErrors=false) const
 
virtual void filterReplace (size_t n, double *w) const
 
virtual void impulse (size_t n, double *out, size_t delay=0) const
 
virtual double * impulse (size_t n, size_t delay=0) const
 
TGraph * impulseGraph (size_t n=101, double dt=1, size_t delay=50) const
 
virtual void response (size_t n, TGraph **amplitude_response, TGraph **phase_response, TGraph **group_delay=0) const
 
virtual TGraph * amplitudeResponse (size_t n=101) const
 
virtual TGraph * phaseResponse (size_t n=101) const
 
virtual TGraph * groupDelay (size_t n=101) const
 
double avgDelay (double min_freq=0, double max_freq=1, int n=101) const
 
virtual TPad * drawResponse (TPad *c=0, int n=101, int delay=50) const
 
virtual std::complex< double > transfer (std::complex< double > z) const =0
 

Detailed Description

Base class for all digital filters. Any implementing filters must implement filterOut and transfer.

Definition at line 26 of file DigitalFilter.h.

Inheritance diagram for FFTtools::DigitalFilter:
Inheritance graph
[legend]

Member Function Documentation

double FFTtools::DigitalFilter::avgDelay ( double  min_freq = 0,
double  max_freq = 1,
int  n = 101 
) const

Computes the average delay in samples between min_freq and max_freq (both in normalized frequency) by taking the weighted average of the group delay

Definition at line 943 of file DigitalFilter.cxx.

TPad * FFTtools::DigitalFilter::drawResponse ( TPad *  c = 0,
int  n = 101,
int  delay = 50 
) const
virtual

Draws the amplitude, phase, group delay and impulse response into the pad. Returns the pad.

Definition at line 969 of file DigitalFilter.cxx.

double * FFTtools::DigitalFilter::filter ( size_t  n,
const double *  w 
) const
virtual

Filter input, returning a newly allocated output. The caller is responsible for freeing the allocated memory.

Parameters
nsize of waveform
wwaveform to filter
Returns
newly allocated output

Definition at line 186 of file DigitalFilter.cxx.

void FFTtools::DigitalFilter::filterGraph ( TGraph *  g,
bool  filterErrors = false 
) const
virtual

Filter graph (and y errors, if available) ``in place'' (with temporary allocation)

Parameters
ggraph to filter
filterErrorstrue if g->GetEY() should be filtered (if it exists)

Definition at line 172 of file DigitalFilter.cxx.

virtual void FFTtools::DigitalFilter::filterOut ( size_t  n,
const double *  w,
double *  out 
) const
pure virtual

Filter input with previously allocated output.

Parameters
nsize of waveform to filter
winput waveform
outoutput waveform (assumed to be allocated)

Implemented in FFTtools::IIRFilter, FFTtools::FIRFilter, and FFTtools::DigitalFilterSeries.

void FFTtools::DigitalFilter::filterReplace ( size_t  n,
double *  w 
) const
virtual

Filter ``in place'' (with temporary allocation)

Parameters
nsize of waveform
winput waveform, output will also be written here

Definition at line 165 of file DigitalFilter.cxx.

void FFTtools::DigitalFilter::impulse ( size_t  n,
double *  out,
size_t  delay = 0 
) const
virtual

Filter response to unit impulse. A delay may be given which is helpful for acausal filters. This works by applying filterOut on an input array with all zeroes and one one at position delay.

Parameters
nnumber of samples wanted in impulse response
outallocated memory where impulse response will be written
delaythe time (in samples) of the unit impulse

Definition at line 141 of file DigitalFilter.cxx.

double * FFTtools::DigitalFilter::impulse ( size_t  n,
size_t  delay = 0 
) const
virtual

Filter response to unit impulse that allocates new memory. A delay may be given which is helpful for acausal filters. The user is responsible for deleting te allocated memory.

Parameters
nnumber of samples wanted in impulse response
delaythe time (in samples) of the unit impulse
Returns
a newly allocated array of the impulse response

Definition at line 158 of file DigitalFilter.cxx.

TGraph * FFTtools::DigitalFilter::impulseGraph ( size_t  n = 101,
double  dt = 1,
size_t  delay = 50 
) const

Get impulse response as a newly allocated TGraph. Caller is responsbile for deletion.

Parameters
nnumber of samples wanted in impulse response
dtthe sample rate of the graph
delaythe ttime (in samples) of the unit impulse
Returns
a TGraph of the impulse response

Definition at line 149 of file DigitalFilter.cxx.

void FFTtools::DigitalFilter::response ( size_t  n,
TGraph **  amplitude_response,
TGraph **  phase_response,
TGraph **  group_delay = 0 
) const
virtual

Compute amplitude response, phase response and group delay directly from the transfer function, with all the gory ensuing numerical problems. This method is provided becuase it is more efficient to calculate two (or three) of the responses at once than individually.

If any is 0, it is not computed. If any TGraph ** points to a TGraph * that points to 0, TGraph of the right size is allocated

Definition at line 21 of file DigitalFilter.cxx.


The documentation for this class was generated from the following files: