AverageSpectrum.c File Reference

#include <math.h>
#include <string.h>
#include <lal/FrequencySeries.h>
#include <lal/LALStdlib.h>
#include <lal/LALConstants.h>
#include <lal/AVFactories.h>
#include <lal/Sequence.h>
#include <lal/TimeFreqFFT.h>
#include <lal/Units.h>
#include <lal/Window.h>
#include <lal/LALRCSID.h>

Include dependency graph for AverageSpectrum.c:

Go to the source code of this file.

Functions

 NRCSID (AVERAGESPECTRUMC,"$Id: AverageSpectrum.c,v 1.18 2008/07/08 22:54:03 kipp Exp $")
int XLALREAL4ModifiedPeriodogram (REAL4FrequencySeries *periodogram, const REAL4TimeSeries *tseries, const REAL4Window *window, const REAL4FFTPlan *plan)
 Compute a "modified periodogram," i.e., the power spectrum of a windowed time series.
int XLALREAL8ModifiedPeriodogram (REAL8FrequencySeries *periodogram, const REAL8TimeSeries *tseries, const REAL8Window *window, const REAL8FFTPlan *plan)
 Compute a "modified periodogram," i.e., the power spectrum of a windowed time series.
int XLALREAL4AverageSpectrumWelch (REAL4FrequencySeries *spectrum, const REAL4TimeSeries *tseries, UINT4 seglen, UINT4 stride, const REAL4Window *window, const REAL4FFTPlan *plan)
 Use Welch's method to compute the average power spectrum of a time series.
int XLALREAL8AverageSpectrumWelch (REAL8FrequencySeries *spectrum, const REAL8TimeSeries *tseries, UINT4 seglen, UINT4 stride, const REAL8Window *window, const REAL8FFTPlan *plan)
 Use Welch's method to compute the average power spectrum of a time series.
REAL8 XLALMedianBias (UINT4 nn)
int XLALREAL4AverageSpectrumMedian (REAL4FrequencySeries *spectrum, const REAL4TimeSeries *tseries, UINT4 seglen, UINT4 stride, const REAL4Window *window, const REAL4FFTPlan *plan)
 Median Method: use median average rather than mean.
int XLALREAL8AverageSpectrumMedian (REAL8FrequencySeries *spectrum, const REAL8TimeSeries *tseries, UINT4 seglen, UINT4 stride, const REAL8Window *window, const REAL8FFTPlan *plan)
 Median Method: use median average rather than mean.
int XLALREAL4AverageSpectrumMedianMean (REAL4FrequencySeries *spectrum, const REAL4TimeSeries *tseries, UINT4 seglen, UINT4 stride, const REAL4Window *window, const REAL4FFTPlan *plan)
 Median-Mean Method: divide overlapping segments into "even" and "odd" segments; compute the bin-by-bin median of the "even" segments and the "odd" segments, and then take the bin-by-bin average of these two median averages.
int XLALREAL8AverageSpectrumMedianMean (REAL8FrequencySeries *spectrum, const REAL8TimeSeries *tseries, UINT4 seglen, UINT4 stride, const REAL8Window *window, const REAL8FFTPlan *plan)
 Median-Mean Method: divide overlapping segments into "even" and "odd" segments; compute the bin-by-bin median of the "even" segments and the "odd" segments, and then take the bin-by-bin average of these two median averages.
int XLALREAL4SpectrumInvertTruncate (REAL4FrequencySeries *spectrum, REAL4 lowfreq, UINT4 seglen, UINT4 trunclen, REAL4FFTPlan *fwdplan, REAL4FFTPlan *revplan)
int XLALREAL8SpectrumInvertTruncate (REAL8FrequencySeries *spectrum, REAL8 lowfreq, UINT4 seglen, UINT4 trunclen, REAL8FFTPlan *fwdplan, REAL8FFTPlan *revplan)
COMPLEX8FrequencySeriesXLALWhitenCOMPLEX8FrequencySeries (COMPLEX8FrequencySeries *fseries, const REAL4FrequencySeries *psd, REAL8 fmin, REAL8 fmax)
 Normalize a COMPLEX8 frequency series to a REAL4 average PSD.
COMPLEX16FrequencySeriesXLALWhitenCOMPLEX16FrequencySeries (COMPLEX16FrequencySeries *fseries, const REAL8FrequencySeries *psd, REAL8 fmin, REAL8 fmax)
 Double-precision version of XLALWhitenCOMPLEX8FrequencySeries().


Function Documentation

NRCSID ( AVERAGESPECTRUMC  ,
"$Id: AverageSpectrum.  c,
v 1.18 2008/07/08 22:54:03 kipp Exp $"   
)

int XLALREAL4ModifiedPeriodogram ( REAL4FrequencySeries periodogram,
const REAL4TimeSeries tseries,
const REAL4Window window,
const REAL4FFTPlan plan 
)

Compute a "modified periodogram," i.e., the power spectrum of a windowed time series.

Definition at line 43 of file AverageSpectrum.c.

int XLALREAL8ModifiedPeriodogram ( REAL8FrequencySeries periodogram,
const REAL8TimeSeries tseries,
const REAL8Window window,
const REAL8FFTPlan plan 
)

Compute a "modified periodogram," i.e., the power spectrum of a windowed time series.

Definition at line 132 of file AverageSpectrum.c.

int XLALREAL4AverageSpectrumWelch ( REAL4FrequencySeries spectrum,
const REAL4TimeSeries tseries,
UINT4  seglen,
UINT4  stride,
const REAL4Window window,
const REAL4FFTPlan plan 
)

Use Welch's method to compute the average power spectrum of a time series.

See: Peter D. Welch "The Use of Fast Fourier Transform for the Estimation of Power Spectra: A Method Based on Time Averaging Over Short, Modified Periodograms" IEEE Transactions on Audio and Electroacoustics, Vol. AU-15, No. 2, June 1967.

Definition at line 226 of file AverageSpectrum.c.

int XLALREAL8AverageSpectrumWelch ( REAL8FrequencySeries spectrum,
const REAL8TimeSeries tseries,
UINT4  seglen,
UINT4  stride,
const REAL8Window window,
const REAL8FFTPlan plan 
)

Use Welch's method to compute the average power spectrum of a time series.

See: Peter D. Welch "The Use of Fast Fourier Transform for the Estimation of Power Spectra: A Method Based on Time Averaging Over Short, Modified Periodograms" IEEE Transactions on Audio and Electroacoustics, Vol. AU-15, No. 2, June 1967.

Definition at line 325 of file AverageSpectrum.c.

REAL8 XLALMedianBias ( UINT4  nn  ) 

Definition at line 422 of file AverageSpectrum.c.

int XLALREAL4AverageSpectrumMedian ( REAL4FrequencySeries spectrum,
const REAL4TimeSeries tseries,
UINT4  seglen,
UINT4  stride,
const REAL4Window window,
const REAL4FFTPlan plan 
)

Median Method: use median average rather than mean.

Note: this will cause a bias if the segments overlap, i.e., if the stride is less than the segment length -- even though the median bias for Gaussian noise is accounted for -- because the segments are not independent and their correlation is non-zero.

Definition at line 489 of file AverageSpectrum.c.

int XLALREAL8AverageSpectrumMedian ( REAL8FrequencySeries spectrum,
const REAL8TimeSeries tseries,
UINT4  seglen,
UINT4  stride,
const REAL8Window window,
const REAL8FFTPlan plan 
)

Median Method: use median average rather than mean.

Note: this will cause a bias if the segments overlap, i.e., if the stride is less than the segment length -- even though the median bias for Gaussian noise is accounted for -- because the segments are not independent and their correlation is non-zero.

Definition at line 630 of file AverageSpectrum.c.

int XLALREAL4AverageSpectrumMedianMean ( REAL4FrequencySeries spectrum,
const REAL4TimeSeries tseries,
UINT4  seglen,
UINT4  stride,
const REAL4Window window,
const REAL4FFTPlan plan 
)

Median-Mean Method: divide overlapping segments into "even" and "odd" segments; compute the bin-by-bin median of the "even" segments and the "odd" segments, and then take the bin-by-bin average of these two median averages.

Definition at line 812 of file AverageSpectrum.c.

int XLALREAL8AverageSpectrumMedianMean ( REAL8FrequencySeries spectrum,
const REAL8TimeSeries tseries,
UINT4  seglen,
UINT4  stride,
const REAL8Window window,
const REAL8FFTPlan plan 
)

Median-Mean Method: divide overlapping segments into "even" and "odd" segments; compute the bin-by-bin median of the "even" segments and the "odd" segments, and then take the bin-by-bin average of these two median averages.

Definition at line 994 of file AverageSpectrum.c.

int XLALREAL4SpectrumInvertTruncate ( REAL4FrequencySeries spectrum,
REAL4  lowfreq,
UINT4  seglen,
UINT4  trunclen,
REAL4FFTPlan fwdplan,
REAL4FFTPlan revplan 
)

Definition at line 1169 of file AverageSpectrum.c.

int XLALREAL8SpectrumInvertTruncate ( REAL8FrequencySeries spectrum,
REAL8  lowfreq,
UINT4  seglen,
UINT4  trunclen,
REAL8FFTPlan fwdplan,
REAL8FFTPlan revplan 
)

Definition at line 1267 of file AverageSpectrum.c.

COMPLEX8FrequencySeries* XLALWhitenCOMPLEX8FrequencySeries ( COMPLEX8FrequencySeries fseries,
const REAL4FrequencySeries psd,
REAL8  fmin,
REAL8  fmax 
)

Normalize a COMPLEX8 frequency series to a REAL4 average PSD.

If the frequency series is the Fourier transform of (coloured) Gaussian random noise, and the PSD is of the same noise, and both have been computed according to the LAL technical specifications (LIGO-T010095-00-Z), then the output frequency series' bins will be complex Gaussian random variables with mean squares of 1 (the real and imaginary components, individually, have variances of 1/2). Fourier transforms computed by XLALREAL4ForwardFFT(), and PSDs computed by XLALREAL4AverageSpectrumMedian() and friends conform to the LAL technical specifications.

PSDs computed from high- or low-passed data can include 0s at one or the other end of the spectrum, and these would normally result in divide-by-zero errors. This routine avoids PSD divide-by-zero errors by permitting zeroes in the PSD outside of the band given by fmin <= f < fmax. The fmin and fmax parameters set the frequency band ``of interest''. Divide-by-zero errors within the band of interest are reported, while divide-by-zero errors outside the band of interest are ignored and the output frequency series zeroed in the affected bins.

The input PSD is allowed to span a larger frequency band than the input frequency series, but the frequency resolutions of the two must be the same. The frequency series is modified in place. The return value is the input frequency series pointer on success, or NULL on error. When an error occurs, the contents of the input frequency series are undefined.

Definition at line 1395 of file AverageSpectrum.c.

COMPLEX16FrequencySeries* XLALWhitenCOMPLEX16FrequencySeries ( COMPLEX16FrequencySeries fseries,
const REAL8FrequencySeries psd,
REAL8  fmin,
REAL8  fmax 
)

Double-precision version of XLALWhitenCOMPLEX8FrequencySeries().

Definition at line 1447 of file AverageSpectrum.c.


Generated on Sat Sep 6 03:07:49 2008 for LAL by  doxygen 1.5.2