SPINspiral
SPINspiral is a parameter-estimation code for gravitational-wave signals detected by LIGO/Virgo
|
Contains routines that do IFO initialisation and data handling. More...
#include <SPINspiral.h>
Functions | |
void | setIFOdata (struct runPar *run, struct interferometer ifo[]) |
Set all the data for all IFOs that may be used. | |
void | IFOinit (struct interferometer **ifo, int networkSize, struct runPar run) |
Set up IFOs. | |
void | IFOdispose (struct interferometer *ifo, struct runPar run) |
Free allocated IFO variables. | |
double * | filter (int *order, int samplerate, double upperlimit, struct runPar run) |
Compute FIR filter coefficients. | |
double * | downsample (double data[], int *datalength, double filtercoef[], int ncoef, struct runPar run) |
Downsample a time series by a factor downsampleFactor. | |
double | hannWindow (int j, int N) |
Apply a 'Hann window' to data. | |
double | tukeyWindow (int j, int N, double r) |
Apply a 'Tukey window' to data. | |
double | modifiedTukeyWindow (int j, int N, double r1, double r2) |
Apply a 'Tukey window' to data. | |
void | dataFT (struct interferometer *ifo[], int ifonr, int networkSize, struct runPar run) |
Read the data and do a software injection if wanted. | |
void | noisePSDestimate (struct interferometer *ifo[], int ifonr, struct runPar run) |
Returns a (smoothed) estimate of the log- Power Spectral Density. | |
double | interpolLogNoisePSD (double f, struct interferometer *ifo) |
Returns a linearly interpolated (log-) noise PSD. | |
void | writeDataToFiles (struct interferometer *ifo[], int networkSize, struct runPar run) |
Write windowed, time-domain data (signal + noise) to disc. | |
void | writeNoiseToFiles (struct interferometer *ifo[], int networkSize, struct runPar run) |
Write noise ASD to disc. | |
void | writeSignalsToFiles (struct interferometer *ifo[], int networkSize, struct runPar run) |
Write signal and its FFT to disc. | |
void | printParameterHeaderToFile (FILE *dump, struct interferometer *ifo, struct runPar run) |
Write an optional header when saving data, ASD or signal to disc. |
Contains routines that do IFO initialisation and data handling.
void setIFOdata | ( | struct runPar * | run, |
struct interferometer | ifo[] | ||
) |
Set all the data for all IFOs that may be used.
References interferometer::after_tc, interferometer::before_tc, runPar::beVerbose, runPar::dataAfterTc, runPar::dataBeforeTc, runPar::dataFilename, runPar::datasetName, interferometer::highCut, runPar::highFrequencyCut, interferometer::lowCut, runPar::lowFrequencyCut, runPar::mainFilename, runPar::maxIFOdbaseSize, interferometer::radius_eqt, interferometer::radius_pole, readDataInputfile(), and runPar::selectdata.
Referenced by main().
void IFOinit | ( | struct interferometer ** | ifo, |
int | networkSize, | ||
struct runPar | run | ||
) |
Set up IFOs.
Determines interferometer arm (unit-) vectors (and others), given position (lat/long) and arm angles. Vectors refer to the (right-handed) Earth coordinate system spanned by the three vectors: x) from geocenter to intersection of greenwich meridian with equator plane; y) from geocenter to intersection of 90E meridian with equator plane; z) from geocenter to north pole.
References interferometer::after_tc, interferometer::before_tc, runPar::beVerbose, coord2vec(), dataFT(), interferometer::dataTrafo, interferometer::deltaFT, interferometer::FTsize, runPar::geocentricTc, interferometer::highCut, interferometer::highIndex, interferometer::index, interferometer::indexRange, interpolLogNoisePSD(), interferometer::leftvec, interferometer::lowCut, interferometer::lowIndex, interferometer::noisePSD, noisePSDestimate(), interferometer::normalvec, interferometer::orthoArm, pi, interferometer::positionvec, runPar::PSDsegmentLength, runPar::PSDsegmentNumber, r2d, interferometer::radius_eqt, interferometer::radius_pole, interferometer::raw_dataTrafo, interferometer::rightvec, rotate(), and runPar::tukeyWin.
Referenced by main().
void IFOdispose | ( | struct interferometer * | ifo, |
struct runPar | run | ||
) |
Free allocated IFO variables.
References runPar::beVerbose, interferometer::dataTrafo, interferometer::FTin, interferometer::FTout, interferometer::FTplan, interferometer::FTwindow, interferometer::index, interferometer::name, interferometer::noisePSD, interferometer::raw_dataTrafo, interferometer::raw_noisePSD, and interferometer::rawDownsampledWindowedData.
Referenced by main().
Compute FIR filter coefficients.
The filter has a total of N=(order+order-1) coefficients that are symmetric, i.e. coef[k] = coef[N-k]. For details & filter properties see the function downsampling() below.
References BANDPASS, runPar::beVerbose, runPar::downsampleFactor, and remez().
Referenced by dataFT(), and noisePSDestimate().
double* downsample | ( | double | data[], |
int * | datalength, | ||
double | filtercoef[], | ||
int | ncoef, | ||
struct runPar | run | ||
) |
Downsample a time series by a factor downsampleFactor.
Downsamples a time series by factor downsampleFactor by first low-pass filtering it using a finite-impulse-response (FIR) filter and then thinning the data. Filter coefficients are determined using the 'Parks-McClellan' or 'Remez exchange' algorithm. The resulting data vector is shorter than original. Returned vector is allocated using fftw_malloc() and thus must be freed again using fftw_free().
References runPar::downsampleFactor.
Referenced by dataFT(), and noisePSDestimate().
double hannWindow | ( | int | j, |
int | N | ||
) |
Apply a 'Hann window' to data.
Window data using a Hann window. j = 0, ..., N-1
References pi.
Referenced by noisePSDestimate().
double tukeyWindow | ( | int | j, |
int | N, | ||
double | r | ||
) |
double modifiedTukeyWindow | ( | int | j, |
int | N, | ||
double | r1, | ||
double | r2 | ||
) |
Apply a 'Tukey window' to data.
Window data using a Tukey window. r1 for lower frequency windowing, r2 for upper frequency windowing. For r=0 equal to rectangular window, for r=1 equal to Hann window (0<r<1 denotes the fraction of the window in which it behaves sinusoidal). j = 0, ..., N-1
References pi.
Referenced by waveformTemplate().
void dataFT | ( | struct interferometer * | ifo[], |
int | ifonr, | ||
int | networkSize, | ||
struct runPar | run | ||
) |
Read the data and do a software injection if wanted.
Computes the Fourier Transform for the specified range of the specified Frame (".gwf") file, after adding up the two (signal & noise) channels, or injecting a waveform template into the noise. Also takes care of preparing FT stuff (ifo[ifonr]->FTplan, ->FTin, ->FTout, ...).
References interferometer::after_tc, allocParset(), interferometer::before_tc, runPar::beVerbose, interferometer::ch1fileoffset, interferometer::ch1filesize, interferometer::ch2fileoffset, interferometer::ch2filesize, runPar::commandSettingsFlag, interferometer::deltaFT, downsample(), runPar::downsampleFactor, filter(), runPar::FrameGPSstart, runPar::FrameLength, runPar::FrameName, freeParset(), interferometer::FTin, interferometer::FTout, interferometer::FTplan, interferometer::FTsize, interferometer::FTstart, interferometer::FTwindow, runPar::geocentricTc, getInjectionParameters(), GMST(), runPar::injectionWaveform, runPar::injectSignal, runPar::injParVal, runPar::injRevID, localPar(), parSet::localti, parSet::locazi, parSet::loctc, McEta2masses(), runPar::nFrame, runPar::nInjectPar, parSet::par, pi, interferometer::raw_dataTrafo, interferometer::rawDownsampledWindowedData, interferometer::samplerate, interferometer::samplesize, runPar::tukeyWin, tukeyWindow(), and waveformTemplate().
Referenced by IFOinit().
void noisePSDestimate | ( | struct interferometer * | ifo[], |
int | ifonr, | ||
struct runPar | run | ||
) |
Returns a (smoothed) estimate of the log- Power Spectral Density.
Data is split into K segments of M seconds, and K-1 overlapping segments of length 2M are eventually windowed and transformed.
References runPar::beVerbose, runPar::commandSettingsFlag, downsample(), runPar::downsampleFactor, filter(), runPar::FrameGPSstart, runPar::FrameLength, runPar::FrameName, hannWindow(), runPar::nFrame, interferometer::noisefileoffset, interferometer::noisefilesize, interferometer::noiseGPSstart, runPar::PSDsegmentLength, runPar::PSDsegmentNumber, interferometer::PSDsize, runPar::PSDstart, and interferometer::raw_noisePSD.
Referenced by IFOinit().
double interpolLogNoisePSD | ( | double | f, |
struct interferometer * | ifo | ||
) |
Returns a linearly interpolated (log-) noise PSD.
References interferometer::highCut, interferometer::lowCut, interferometer::PSDsize, and interferometer::raw_noisePSD.
Referenced by IFOinit().
void writeDataToFiles | ( | struct interferometer * | ifo[], |
int | networkSize, | ||
struct runPar | run | ||
) |
Write windowed, time-domain data (signal + noise) to disc.
References runPar::beVerbose, interferometer::deltaFT, interferometer::indexRange, runPar::MCMCseed, printParameterHeaderToFile(), interferometer::samplesize, and runPar::writeSignal.
Referenced by main().
void writeNoiseToFiles | ( | struct interferometer * | ifo[], |
int | networkSize, | ||
struct runPar | run | ||
) |
Write noise ASD to disc.
The noise ASD is the square root of the estimated noise PSD (no injected signal).
References runPar::beVerbose, interferometer::deltaFT, interferometer::indexRange, runPar::MCMCseed, printParameterHeaderToFile(), and runPar::writeSignal.
Referenced by main().
void writeSignalsToFiles | ( | struct interferometer * | ifo[], |
int | networkSize, | ||
struct runPar | run | ||
) |
Write signal and its FFT to disc.
Write a signal with the injection parameters and its FFT to disc, as *-signal.dat.* and *-signalFFT.dat.*.
References allocParset(), runPar::beVerbose, freeParset(), interferometer::FTout, getInjectionParameters(), interferometer::highIndex, runPar::injectionWaveform, runPar::injParVal, localPar(), runPar::MCMCseed, runPar::nInjectPar, printParameterHeaderToFile(), interferometer::samplesize, waveformTemplate(), and runPar::writeSignal.
Referenced by main().
void printParameterHeaderToFile | ( | FILE * | dump, |
struct interferometer * | ifo, | ||
struct runPar | run | ||
) |
Write an optional header when saving data, ASD or signal to disc.
The header idendtifies the (waveform) parameters.
References runPar::injID, runPar::injParVal, runPar::nInjectPar, runPar::parAbrev, and interferometer::snr.
Referenced by writeDataToFiles(), writeNoiseToFiles(), and writeSignalsToFiles().