LAL  7.1.7.1-ab2cc12
Window.c File Reference

Prototypes

static REAL4WindowXLALREAL4Window_from_REAL8Window (REAL8Window *orig)
 Constructs a REAL4Window from a REAL8Window by quantizing the double-precision data to single-precision. More...
 
static double Y (int length, int i)
 Maps the length of a window and the offset within the window to the "y" co-ordinate of the LAL documentation. More...
 
static REAL8 sum_squares (REAL8 *start, int length)
 Computes the sum of squares, and sum, of the samples in a window function. More...
 
static REAL8 sum_samples (REAL8 *start, int length)
 
REAL8WindowXLALCreateREAL8WindowFromSequence (REAL8Sequence *sequence)
 Constructs a new REAL8Window from a REAL8Sequence. More...
 
REAL4WindowXLALCreateREAL4WindowFromSequence (REAL4Sequence *sequence)
 Single-precision version of XLALCreateREAL8WindowFromSequence(). More...
 
REAL8SequenceXLALUnitaryWindowREAL8Sequence (REAL8Sequence *sequence, const REAL8Window *window)
 Multiply a REAL8Sequence in-place by a REAL8Window with a normalization that preserves the variance of a zero-mean stationary Gaussian random process. More...
 
COMPLEX16SequenceXLALUnitaryWindowCOMPLEX16Sequence (COMPLEX16Sequence *sequence, const REAL8Window *window)
 Double-precision complex version of XLALUnitaryWindowREAL8Sequence(). More...
 
REAL4SequenceXLALUnitaryWindowREAL4Sequence (REAL4Sequence *sequence, const REAL4Window *window)
 Single-precision version of XLALUnitaryWindowREAL8Sequence(). More...
 
COMPLEX8SequenceXLALUnitaryWindowCOMPLEX8Sequence (COMPLEX8Sequence *sequence, const REAL4Window *window)
 Single-precision complex version of XLALUnitaryWindowREAL8Sequence(). More...
 
REAL8WindowXLALCreateRectangularREAL8Window (UINT4 length)
 
REAL8WindowXLALCreateHannREAL8Window (UINT4 length)
 
REAL8WindowXLALCreateWelchREAL8Window (UINT4 length)
 
REAL8WindowXLALCreateBartlettREAL8Window (UINT4 length)
 
REAL8WindowXLALCreateParzenREAL8Window (UINT4 length)
 
REAL8WindowXLALCreatePapoulisREAL8Window (UINT4 length)
 
REAL8WindowXLALCreateHammingREAL8Window (UINT4 length)
 
REAL8WindowXLALCreateKaiserREAL8Window (UINT4 length, REAL8 beta)
 
REAL8WindowXLALCreateCreightonREAL8Window (UINT4 length, REAL8 beta)
 
REAL8WindowXLALCreateTukeyREAL8Window (UINT4 length, REAL8 beta)
 
REAL8WindowXLALCreateGaussREAL8Window (UINT4 length, REAL8 beta)
 
REAL8WindowXLALCreateLanczosREAL8Window (UINT4 length)
 
void XLALDestroyREAL8Window (REAL8Window *window)
 
REAL4WindowXLALCreateRectangularREAL4Window (UINT4 length)
 
REAL4WindowXLALCreateHannREAL4Window (UINT4 length)
 
REAL4WindowXLALCreateWelchREAL4Window (UINT4 length)
 
REAL4WindowXLALCreateBartlettREAL4Window (UINT4 length)
 
REAL4WindowXLALCreateParzenREAL4Window (UINT4 length)
 
REAL4WindowXLALCreatePapoulisREAL4Window (UINT4 length)
 
REAL4WindowXLALCreateHammingREAL4Window (UINT4 length)
 
REAL4WindowXLALCreateKaiserREAL4Window (UINT4 length, REAL4 beta)
 
REAL4WindowXLALCreateCreightonREAL4Window (UINT4 length, REAL4 beta)
 
REAL4WindowXLALCreateTukeyREAL4Window (UINT4 length, REAL4 beta)
 
REAL4WindowXLALCreateGaussREAL4Window (UINT4 length, REAL4 beta)
 
REAL4WindowXLALCreateLanczosREAL4Window (UINT4 length)
 
void XLALDestroyREAL4Window (REAL4Window *window)
 
static int XLALParseWindowNameAndCheckBeta (const char *windowName, REAL8 beta)
 Parse window-name string (case-insensitive) into an internal window-type index (>=0, returned), and also check if the user-input 'beta' is valid for given window. More...
 
REAL8WindowXLALCreateNamedREAL8Window (const char *windowName, REAL8 beta, UINT4 length)
 Generic window-function wrapper, allowing to select a window by its name. More...
 
REAL4WindowXLALCreateNamedREAL4Window (const char *windowName, REAL8 beta, UINT4 length)
 

Go to the source code of this file.

Enumerations

enum  LALWindowType {
  LAL_WINDOWTYPE_RECTANGULAR = 0, LAL_WINDOWTYPE_HANN, LAL_WINDOWTYPE_WELCH, LAL_WINDOWTYPE_BARTLETT,
  LAL_WINDOWTYPE_PARZEN, LAL_WINDOWTYPE_PAPOULIS, LAL_WINDOWTYPE_HAMMING, LAL_WINDOWTYPE_KAISER,
  LAL_WINDOWTYPE_CREIGHTON, LAL_WINDOWTYPE_TUKEY, LAL_WINDOWTYPE_GAUSS, LAL_WINDOWTYPE_LANCZOS,
  LAL_WINDOWTYPE_LAST
}
 

Variables

struct {
   const char *const   name
 window name More...
 
   const BOOLEAN   hasBeta
 does this window need a 'beta' parameter? More...
 
AllowedWindows [LAL_WINDOWTYPE_LAST]
 

Enumeration Type Documentation

◆ LALWindowType

Enumerator
LAL_WINDOWTYPE_RECTANGULAR 
LAL_WINDOWTYPE_HANN 
LAL_WINDOWTYPE_WELCH 
LAL_WINDOWTYPE_BARTLETT 
LAL_WINDOWTYPE_PARZEN 
LAL_WINDOWTYPE_PAPOULIS 
LAL_WINDOWTYPE_HAMMING 
LAL_WINDOWTYPE_KAISER 
LAL_WINDOWTYPE_CREIGHTON 
LAL_WINDOWTYPE_TUKEY 
LAL_WINDOWTYPE_GAUSS 
LAL_WINDOWTYPE_LANCZOS 
LAL_WINDOWTYPE_LAST 

Definition at line 774 of file Window.c.

Function Documentation

◆ XLALREAL4Window_from_REAL8Window()

static REAL4Window* XLALREAL4Window_from_REAL8Window ( REAL8Window orig)
static

Constructs a REAL4Window from a REAL8Window by quantizing the double-precision data to single-precision.

The REAL8Window is freed unconditionally. Intended to be used as a wrapper, to convert any function that constructs a REAL8Window into a function to construct a REAL4Window.

Definition at line 58 of file Window.c.

◆ Y()

static double Y ( int  length,
int  i 
)
static

Maps the length of a window and the offset within the window to the "y" co-ordinate of the LAL documentation.

Input: length > 0, 0 <= i < length

Output: length < 2 –> return 0.0 i == 0 –> return -1.0 i == (length - 1) / 2 –> return 0.0 i == length - 1 –> return +1.0

e.g., length = 5 (odd), then i == 2 –> return 0.0 if length = 6 (even), then i == 2.5 –> return 0.0

(in the latter case, obviously i can't be a non-integer, but that's the value it would have to be for this function to return 0.0)

Definition at line 109 of file Window.c.

◆ sum_squares()

static REAL8 sum_squares ( REAL8 start,
int  length 
)
static

Computes the sum of squares, and sum, of the samples in a window function.

Two techniques are employed to achieve accurate results. Firstly, the loop iterates from the edges to the centre. Generally, window functions have smaller values at the edges and larger values in the middle, so adding them in this order avoids adding small numbers to big numbers. The loops also implement Kahan's compensated summation algorithm in which a second variable is used to accumulate round-off errors and fold them into later iterations.

Definition at line 128 of file Window.c.

◆ sum_samples()

static REAL8 sum_samples ( REAL8 start,
int  length 
)
static

Definition at line 158 of file Window.c.

◆ XLALParseWindowNameAndCheckBeta()

static int XLALParseWindowNameAndCheckBeta ( const char *  windowName,
REAL8  beta 
)
static

Parse window-name string (case-insensitive) into an internal window-type index (>=0, returned), and also check if the user-input 'beta' is valid for given window.

Window-types that don't take a beta input parameter need to have beta==0.

Returns XLAL_FAILURE=-1 on error

Definition at line 819 of file Window.c.

Variable Documentation

◆ name

const char* const name

window name

Definition at line 792 of file Window.c.

◆ hasBeta

const BOOLEAN hasBeta

does this window need a 'beta' parameter?

Definition at line 793 of file Window.c.

◆ AllowedWindows

const { ... } AllowedWindows[LAL_WINDOWTYPE_LAST]
Initial value: