#include <math.h>#include <string.h>#include <lal/LALComplex.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/Date.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.27 2008/10/11 01:04:05 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) |
| COMPLEX8FrequencySeries * | XLALWhitenCOMPLEX8FrequencySeries (COMPLEX8FrequencySeries *fseries, const REAL4FrequencySeries *psd) |
| Normalize a COMPLEX8 frequency series to a REAL4 average PSD. | |
| COMPLEX16FrequencySeries * | XLALWhitenCOMPLEX16FrequencySeries (COMPLEX16FrequencySeries *fseries, const REAL8FrequencySeries *psd) |
| Double-precision version of XLALWhitenCOMPLEX8FrequencySeries(). | |
| LALPSDRegressor * | XLALPSDRegressorNew (int max_samples) |
| PSD regression functions. | |
| void | XLALPSDRegressorFree (LALPSDRegressor *r) |
| void | XLALPSDRegressorReset (LALPSDRegressor *r) |
| int | XLALPSDRegressorAdd (LALPSDRegressor *r, const COMPLEX16FrequencySeries *sample) |
| COMPLEX16FrequencySeries * | XLALPSDRegressorGetMean (const LALPSDRegressor *r, const LIGOTimeGPS *epoch, REAL8 min_sigma_sq) |
| REAL8FrequencySeries * | XLALPSDRegressorGetPSD (const LALPSDRegressor *r) |
| int | XLALPSDRegressorSetPSD (LALPSDRegressor *r, const REAL8FrequencySeries *psd, int weight) |
| NRCSID | ( | AVERAGESPECTRUMC | , | |
| "$Id: AverageSpectrum. | c, | |||
| v 1.27 2008/10/11 01:04:05 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 45 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 123 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 206 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 294 of file AverageSpectrum.c.
Definition at line 380 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 447 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 577 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 748 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 919 of file AverageSpectrum.c.
| int XLALREAL4SpectrumInvertTruncate | ( | REAL4FrequencySeries * | spectrum, | |
| REAL4 | lowfreq, | |||
| UINT4 | seglen, | |||
| UINT4 | trunclen, | |||
| REAL4FFTPlan * | fwdplan, | |||
| REAL4FFTPlan * | revplan | |||
| ) |
Definition at line 1083 of file AverageSpectrum.c.
| int XLALREAL8SpectrumInvertTruncate | ( | REAL8FrequencySeries * | spectrum, | |
| REAL8 | lowfreq, | |||
| UINT4 | seglen, | |||
| UINT4 | trunclen, | |||
| REAL8FFTPlan * | fwdplan, | |||
| REAL8FFTPlan * | revplan | |||
| ) |
Definition at line 1187 of file AverageSpectrum.c.
| COMPLEX8FrequencySeries* XLALWhitenCOMPLEX8FrequencySeries | ( | COMPLEX8FrequencySeries * | fseries, | |
| const REAL4FrequencySeries * | psd | |||
| ) |
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 ignoring those frequency bins, setting them to zero in the frequency series. The justification is that if the PSD is 0 then there must be nothing in that frequency bin to normalize anyway.
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' address on success, or NULL on error. When an error occurs, the contents of the input frequency series are undefined.
Definition at line 1319 of file AverageSpectrum.c.
| COMPLEX16FrequencySeries* XLALWhitenCOMPLEX16FrequencySeries | ( | COMPLEX16FrequencySeries * | fseries, | |
| const REAL8FrequencySeries * | psd | |||
| ) |
Double-precision version of XLALWhitenCOMPLEX8FrequencySeries().
Definition at line 1369 of file AverageSpectrum.c.
| LALPSDRegressor* XLALPSDRegressorNew | ( | int | max_samples | ) |
| void XLALPSDRegressorFree | ( | LALPSDRegressor * | r | ) |
Definition at line 1441 of file AverageSpectrum.c.
| void XLALPSDRegressorReset | ( | LALPSDRegressor * | r | ) |
Definition at line 1452 of file AverageSpectrum.c.
| int XLALPSDRegressorAdd | ( | LALPSDRegressor * | r, | |
| const COMPLEX16FrequencySeries * | sample | |||
| ) |
Definition at line 1458 of file AverageSpectrum.c.
| COMPLEX16FrequencySeries* XLALPSDRegressorGetMean | ( | const LALPSDRegressor * | r, | |
| const LIGOTimeGPS * | epoch, | |||
| REAL8 | min_sigma_sq | |||
| ) |
Definition at line 1558 of file AverageSpectrum.c.
| REAL8FrequencySeries* XLALPSDRegressorGetPSD | ( | const LALPSDRegressor * | r | ) |
Definition at line 1599 of file AverageSpectrum.c.
| int XLALPSDRegressorSetPSD | ( | LALPSDRegressor * | r, | |
| const REAL8FrequencySeries * | psd, | |||
| int | weight | |||
| ) |
Definition at line 1640 of file AverageSpectrum.c.
1.5.2