ldas-tools-filters  2.6.5
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
Filters::KaiserWindow Class Reference

A class representing a Kaiser window. More...

#include <KaiserWindow.hh>

Inheritance diagram for Filters::KaiserWindow:
Filters::Window Filters::Window Filters::Window

Public Member Functions

 KaiserWindow (const double beta=KaiserWindowDefaultBeta)
 Constructor. More...
 
double beta () const
 Get the beta parameter for this window. More...
 
void set_beta (const double &beta)
 Set the beta parameter for this window. More...
 
virtual std::string name () const
 Return window name. More...
 
virtual double param () const
 Return window parameter. More...
 
virtual KaiserWindowClone () const
 Clone a window. More...
 
 KaiserWindow (const double beta=KaiserWindowDefaultBeta)
 Constructor. More...
 
double beta () const
 Get the beta parameter for this window. More...
 
void set_beta (const double &beta)
 Set the beta parameter for this window. More...
 
virtual std::string name () const
 Return window name. More...
 
virtual double param () const
 Return window parameter. More...
 
virtual KaiserWindowClone () const
 Clone a window. More...
 
 KaiserWindow (const double beta=KaiserWindowDefaultBeta)
 Constructor. More...
 
double beta () const
 Get the beta parameter for this window. More...
 
void set_beta (const double &beta)
 Set the beta parameter for this window. More...
 
virtual std::string name () const
 Return window name. More...
 
virtual double param () const
 Return window parameter. More...
 
virtual KaiserWindowClone () const
 Clone a window. More...
 
size_t size () const
 Return window length. More...
 
size_t size () const
 Return window length. More...
 
size_t size () const
 Return window length. More...
 
double mean () const
 Return mean value of window. More...
 
double mean () const
 Return mean value of window. More...
 
double mean () const
 Return mean value of window. More...
 
double rms () const
 Return RMS value of window. More...
 
double rms () const
 Return RMS value of window. More...
 
double rms () const
 Return RMS value of window. More...
 
void resize (const size_t n)
 Change the size of the window. More...
 
void resize (const size_t n)
 Change the size of the window. More...
 
void resize (const size_t n)
 Change the size of the window. More...
 
template<class T >
void apply (std::valarray< T > &x)
 Apply a window to the data in-place. More...
 
template<class TOut , class TIn >
void apply (std::valarray< TOut > &out, const std::valarray< TIn > &in)
 Apply a window to the data out-of-place. More...
 
template<class T >
void apply (std::valarray< T > &x)
 Apply a window to the data in-place. More...
 
template<class TOut , class TIn >
void apply (std::valarray< TOut > &out, const std::valarray< TIn > &in)
 Apply a window to the data out-of-place. More...
 
template<class T >
void apply (std::valarray< T > &x)
 Apply a window to the data in-place. More...
 
template<class TOut , class TIn >
void apply (std::valarray< TOut > &out, const std::valarray< TIn > &in)
 Apply a window to the data out-of-place. More...
 
template<class TOut , class TIn >
void operator() (std::valarray< TOut > &out, const std::valarray< TIn > &in)
 Synonym for apply. More...
 
template<class TOut , class TIn >
void operator() (std::valarray< TOut > &out, const std::valarray< TIn > &in)
 Synonym for apply. More...
 
template<class TOut , class TIn >
void operator() (std::valarray< TOut > &out, const std::valarray< TIn > &in)
 Synonym for apply. More...
 

Protected Member Functions

void populate ()
 Populate the elements of the window. More...
 
void populate ()
 Populate the elements of the window. More...
 
void populate ()
 Populate the elements of the window. More...
 

Private Member Functions

virtual double element (const size_t i) const
 Get the ith element of the window. More...
 
double I0 (const double &x) const
 Modified Bessel Function of first kind, order 0, evaluated by power series expansion. More...
 
virtual double element (const size_t i) const
 Get the ith element of the window. More...
 
double I0 (const double &x) const
 Modified Bessel Function of first kind, order 0, evaluated by power series expansion. More...
 
virtual double element (const size_t i) const
 Get the ith element of the window. More...
 
double I0 (const double &x) const
 Modified Bessel Function of first kind, order 0, evaluated by power series expansion. More...
 

Private Attributes

double m_beta
 beta parameter More...
 
double m_I0beta
 parameter for the modified Bessel function More...
 

Detailed Description

A class representing a Kaiser window.

Constructor & Destructor Documentation

◆ KaiserWindow() [1/3]

Filters::KaiserWindow::KaiserWindow ( const double  beta = KaiserWindowDefaultBeta)
explicit

Constructor.

Exceptions
std::invalid_argumentthrown if beta is less than 0

◆ KaiserWindow() [2/3]

Filters::KaiserWindow::KaiserWindow ( const double  beta = KaiserWindowDefaultBeta)
explicit

Constructor.

Exceptions
std::invalid_argumentthrown if beta is less than 0

◆ KaiserWindow() [3/3]

Filters::KaiserWindow::KaiserWindow ( const double  beta = KaiserWindowDefaultBeta)
explicit

Constructor.

Exceptions
std::invalid_argumentthrown if beta is less than 0

Member Function Documentation

◆ apply() [1/6]

template<class T >
void Filters::Window::apply ( std::valarray< T > &  x)
inherited

Apply a window to the data in-place.

Parameters
[in,out]xinput/output sequence
Exceptions
std::length_errorthrown if desired window length is greater than maximum allowed value
std::bad_allocthrown if not able to allocate memory for window

◆ apply() [2/6]

template<class T >
void Filters::Window::apply ( std::valarray< T > &  x)
inherited

Apply a window to the data in-place.

Parameters
[in,out]xinput/output sequence
Exceptions
std::length_errorthrown if desired window length is greater than maximum allowed value
std::bad_allocthrown if not able to allocate memory for window

◆ apply() [3/6]

template<class T >
void Filters::Window::apply ( std::valarray< T > &  x)
inherited

Apply a window to the data in-place.

Parameters
[in,out]xinput/output sequence
Exceptions
std::length_errorthrown if desired window length is greater than maximum allowed value
std::bad_allocthrown if not able to allocate memory for window

◆ apply() [4/6]

template<class TOut , class TIn >
void Filters::Window::apply ( std::valarray< TOut > &  out,
const std::valarray< TIn > &  in 
)
inherited

Apply a window to the data out-of-place.

Parameters
[out]outwindowed sequence
[in]ininput sequence
Exceptions
std::length_errorthrown if desired window length is greater than maximum allowed value
std::bad_allocthrown if not able to allocate memory for window

◆ apply() [5/6]

template<class TOut , class TIn >
void Filters::Window::apply ( std::valarray< TOut > &  out,
const std::valarray< TIn > &  in 
)
inherited

Apply a window to the data out-of-place.

Parameters
[out]outwindowed sequence
[in]ininput sequence
Exceptions
std::length_errorthrown if desired window length is greater than maximum allowed value
std::bad_allocthrown if not able to allocate memory for window

◆ apply() [6/6]

template<class TOut , class TIn >
void Filters::Window::apply ( std::valarray< TOut > &  out,
const std::valarray< TIn > &  in 
)
inherited

Apply a window to the data out-of-place.

Parameters
[out]outwindowed sequence
[in]ininput sequence
Exceptions
std::length_errorthrown if desired window length is greater than maximum allowed value
std::bad_allocthrown if not able to allocate memory for window

◆ beta() [1/3]

double Filters::KaiserWindow::beta ( ) const

Get the beta parameter for this window.

Returns
beta parameter

◆ beta() [2/3]

double Filters::KaiserWindow::beta ( ) const
inline

Get the beta parameter for this window.

Returns
beta parameter

◆ beta() [3/3]

double Filters::KaiserWindow::beta ( ) const

Get the beta parameter for this window.

Returns
beta parameter

◆ Clone() [1/3]

KaiserWindow * Filters::KaiserWindow::Clone ( ) const
virtual

Clone a window.

Returns
copy of current window

Implements Filters::Window.

◆ Clone() [2/3]

virtual KaiserWindow* Filters::KaiserWindow::Clone ( ) const
virtual

Clone a window.

Returns
copy of current window

Implements Filters::Window.

◆ Clone() [3/3]

virtual KaiserWindow* Filters::KaiserWindow::Clone ( ) const
virtual

Clone a window.

Returns
copy of current window

Implements Filters::Window.

◆ element() [1/3]

virtual double Filters::KaiserWindow::element ( const size_t  i) const
privatevirtual

Get the ith element of the window.

A Kaiser window is defined by

w[i] = I0( beta*sqrt(1 - [2*i/(n-1) - 1]^2) )/I0(beta)

for i= 0,1, ... n-1, where I0(x) is the 0th order, modified Bessel function of the first kind, and beta (>=0) is a shape parameter related to the amplitude of the sidelobes of the Fourier transform of the window. See "Discrete-time Signal Processing" by Oppenheim and Schafer, p.474 for details.)

Note
when beta=0, a Kaiser window reduces to a rectangular window
Parameters
[in]ithe element at which the window is evaluated
Returns
the window element w[i]

Implements Filters::Window.

◆ element() [2/3]

double Filters::KaiserWindow::element ( const size_t  i) const
privatevirtual

Get the ith element of the window.

A Kaiser window is defined by

w[i] = I0( beta*sqrt(1 - [2*i/(n-1) - 1]^2) )/I0(beta)

for i= 0,1, ... n-1, where I0(x) is the 0th order, modified Bessel function of the first kind, and beta (>=0) is a shape parameter related to the amplitude of the sidelobes of the Fourier transform of the window. See "Discrete-time Signal Processing" by Oppenheim and Schafer, p.474 for details.)

Note
when beta=0, a Kaiser window reduces to a rectangular window
Parameters
[in]ithe element at which the window is evaluated
Returns
the window element w[i]

Implements Filters::Window.

◆ element() [3/3]

virtual double Filters::KaiserWindow::element ( const size_t  i) const
privatevirtual

Get the ith element of the window.

A Kaiser window is defined by

w[i] = I0( beta*sqrt(1 - [2*i/(n-1) - 1]^2) )/I0(beta)

for i= 0,1, ... n-1, where I0(x) is the 0th order, modified Bessel function of the first kind, and beta (>=0) is a shape parameter related to the amplitude of the sidelobes of the Fourier transform of the window. See "Discrete-time Signal Processing" by Oppenheim and Schafer, p.474 for details.)

Note
when beta=0, a Kaiser window reduces to a rectangular window
Parameters
[in]ithe element at which the window is evaluated
Returns
the window element w[i]

Implements Filters::Window.

◆ I0() [1/3]

double Filters::KaiserWindow::I0 ( const double &  x) const
private

Modified Bessel Function of first kind, order 0, evaluated by power series expansion.

◆ I0() [2/3]

double Filters::KaiserWindow::I0 ( const double &  x) const
private

Modified Bessel Function of first kind, order 0, evaluated by power series expansion.

◆ I0() [3/3]

double Filters::KaiserWindow::I0 ( const double &  x) const
private

Modified Bessel Function of first kind, order 0, evaluated by power series expansion.

Calculate I0(x)

Calculates the value of the 0th order, modified Bessel function of the first kind using a power series expansion. (See "Handbook of Math. Functions," eds. Abramowitz and Stegun, 9.6.12 for details.)

Note
the accuracy of the expansion is chosen to be 2e-9
Parameters
[in]x
Returns
I0(x)

◆ mean() [1/3]

double Filters::Window::mean ( ) const
inlineinherited

Return mean value of window.

Returns
mean value of window elements

◆ mean() [2/3]

double Filters::Window::mean ( ) const
inherited

Return mean value of window.

Returns
mean value of window elements

◆ mean() [3/3]

double Filters::Window::mean ( ) const
inherited

Return mean value of window.

Returns
mean value of window elements

◆ name() [1/3]

virtual std::string Filters::KaiserWindow::name ( ) const
virtual

Return window name.

Returns
window name

Implements Filters::Window.

◆ name() [2/3]

virtual std::string Filters::KaiserWindow::name ( ) const
virtual

Return window name.

Returns
window name

Implements Filters::Window.

◆ name() [3/3]

std::string Filters::KaiserWindow::name ( ) const
virtual

Return window name.

Returns
window name

Implements Filters::Window.

◆ operator()() [1/3]

template<class TOut , class TIn >
void Filters::Window::operator() ( std::valarray< TOut > &  out,
const std::valarray< TIn > &  in 
)
inherited

Synonym for apply.

Parameters
[out]outwindowed sequence
[in]ininput sequence
Exceptions
std::length_errorthrown if desired window length is greater than maximum allowed value
std::bad_allocthrown if not able to allocate memory for window

◆ operator()() [2/3]

template<class TOut , class TIn >
void Filters::Window::operator() ( std::valarray< TOut > &  out,
const std::valarray< TIn > &  in 
)
inherited

Synonym for apply.

Parameters
[out]outwindowed sequence
[in]ininput sequence
Exceptions
std::length_errorthrown if desired window length is greater than maximum allowed value
std::bad_allocthrown if not able to allocate memory for window

◆ operator()() [3/3]

template<class TOut , class TIn >
void Filters::Window::operator() ( std::valarray< TOut > &  out,
const std::valarray< TIn > &  in 
)
inherited

Synonym for apply.

Parameters
[out]outwindowed sequence
[in]ininput sequence
Exceptions
std::length_errorthrown if desired window length is greater than maximum allowed value
std::bad_allocthrown if not able to allocate memory for window

◆ param() [1/3]

double Filters::KaiserWindow::param ( ) const
virtual

Return window parameter.

Returns
window parameter

Implements Filters::Window.

◆ param() [2/3]

virtual double Filters::KaiserWindow::param ( ) const
virtual

Return window parameter.

Returns
window parameter

Implements Filters::Window.

◆ param() [3/3]

virtual double Filters::KaiserWindow::param ( ) const
virtual

Return window parameter.

Returns
window parameter

Implements Filters::Window.

◆ populate() [1/3]

void Filters::Window::populate ( )
protectedinherited

Populate the elements of the window.

This function will usually need to be called by a derived class whenever the the window is changed in any way which affects the element() function, such as when some window parameter is altered.

◆ populate() [2/3]

void Filters::Window::populate ( )
protectedinherited

Populate the elements of the window.

This function will usually need to be called by a derived class whenever the the window is changed in any way which affects the element() function, such as when some window parameter is altered.

◆ populate() [3/3]

void Filters::Window::populate ( )
protectedinherited

Populate the elements of the window.

This function will usually need to be called by a derived class whenever the the window is changed in any way which affects the element() function, such as when some window parameter is altered.

◆ resize() [1/3]

void Filters::Window::resize ( const size_t  n)
inherited

Change the size of the window.

Parameters
[in]ndesired length of window
Exceptions
std::length_errorthrown if desired window length is greater than maximum allowed value
std::bad_allocthrown if not able to allocate memory for the window

◆ resize() [2/3]

void Filters::Window::resize ( const size_t  n)
inherited

Change the size of the window.

Parameters
[in]ndesired length of window
Exceptions
std::length_errorthrown if desired window length is greater than maximum allowed value
std::bad_allocthrown if not able to allocate memory for the window

◆ resize() [3/3]

void Filters::Window::resize ( const size_t  n)
inherited

Change the size of the window.

Parameters
[in]ndesired length of window
Exceptions
std::length_errorthrown if desired window length is greater than maximum allowed value
std::bad_allocthrown if not able to allocate memory for the window

◆ rms() [1/3]

double Filters::Window::rms ( ) const
inherited

Return RMS value of window.

Returns
root mean square value of window elements

◆ rms() [2/3]

double Filters::Window::rms ( ) const
inherited

Return RMS value of window.

Returns
root mean square value of window elements

◆ rms() [3/3]

double Filters::Window::rms ( ) const
inlineinherited

Return RMS value of window.

Returns
root mean square value of window elements

◆ set_beta() [1/3]

void Filters::KaiserWindow::set_beta ( const double &  beta)

Set the beta parameter for this window.

Exceptions
std::invalid_argumentthrown if beta is less than 0

◆ set_beta() [2/3]

void Filters::KaiserWindow::set_beta ( const double &  beta)

Set the beta parameter for this window.

Exceptions
std::invalid_argumentthrown if beta is less than 0

◆ set_beta() [3/3]

void Filters::KaiserWindow::set_beta ( const double &  beta)

Set the beta parameter for this window.

Exceptions
std::invalid_argumentthrown if beta is less than 0

◆ size() [1/3]

size_t Filters::Window::size ( ) const
inlineinherited

Return window length.

Returns
length of window

◆ size() [2/3]

size_t Filters::Window::size ( ) const
inherited

Return window length.

Returns
length of window

◆ size() [3/3]

size_t Filters::Window::size ( ) const
inherited

Return window length.

Returns
length of window

Member Data Documentation

◆ m_beta

double Filters::KaiserWindow::m_beta
private

beta parameter

◆ m_I0beta

double Filters::KaiserWindow::m_I0beta
private

parameter for the modified Bessel function


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