5#include <lal/LALDatatypes.h>
6#include <lal/LALDetectors.h>
7#include <lal/DetResponse.h>
8#include <lal/TimeSeries.h>
10#include <lal/TimeDelay.h>
11#include <lal/LALSimulation.h>
12#include <gsl/gsl_sf_trig.h>
20 for(
i = 0 ;
i <
new->data->length;
i++)
21 new->data->data[
i] = fill;
36 double t = t0 +
i * hplus->
deltaT;
42static double modelsignal(
LIGOTimeGPS t,
LIGOTimeGPS epoch,
double ampl,
double freq,
double armlen,
double xcos,
double ycos,
double fxplus,
double fxcross,
double fyplus,
double fycross)
46 double Txplus = armlen * (1. + xcos) /
LAL_C_SI;
47 double Txminus = armlen * (1. - xcos) /
LAL_C_SI;
48 double Typlus = armlen * (1. + ycos) /
LAL_C_SI;
49 double Tyminus = armlen * (1. - ycos) /
LAL_C_SI;
51 double t1x = t0 - Txplus / 2.0;
52 double t2x = t0 + Txminus / 2.0;
53 double signalxplus = ampl * fxplus * (gsl_sf_sinc(freq * Txminus) * cos(
LAL_TWOPI * freq * t1x) + gsl_sf_sinc(freq * Txplus) * cos(
LAL_TWOPI * freq * t2x)) / 2.0;
54 double signalxcross = ampl * fxcross * (gsl_sf_sinc(freq * Txminus) * sin(
LAL_TWOPI * freq * t1x) + gsl_sf_sinc(freq * Txplus) * sin(
LAL_TWOPI * freq * t2x)) / 2.0;
56 double t1y = t0 - Typlus / 2.0;
57 double t2y = t0 + Tyminus / 2.0;
58 double signalyplus = ampl * fyplus * (gsl_sf_sinc(freq * Tyminus) * cos(
LAL_TWOPI * freq * t1y) + gsl_sf_sinc(freq * Typlus) * cos(
LAL_TWOPI * freq * t2y)) / 2.0;
59 double signalycross = ampl * fycross * (gsl_sf_sinc(freq * Tyminus) * sin(
LAL_TWOPI * freq * t1y) + gsl_sf_sinc(freq * Typlus) * sin(
LAL_TWOPI * freq * t2y)) / 2.0;
61 return signalxplus + signalxcross + signalyplus + signalycross;
80 XLALComputeDetAMResponseParts(&armlen, &xcos, &ycos, &fxplus, &fyplus, &fxcross, &fycross,
detector, right_ascension, declination, psi,
XLALGreenwichMeanSiderealTime(&t));
84 mdl->
data->
data[
i] =
modelsignal(t,
epoch, ampl, freq, armlen, xcos, ycos, fxplus, fxcross, fyplus, fycross);
105 for(
i = 0;
i <
s->data->length;
i++)
106 rms +=
s->data->data[
i] *
s->data->data[
i];
108 return sqrt(rms /
s->data->length);
116 *min = *max =
s->data->data[0];
117 for(
i = 1;
i <
s->data->length;
i++) {
118 if(
s->data->data[
i] < *min)
119 *min =
s->data->data[
i];
120 if(
s->data->data[
i] > *max)
121 *max =
s->data->data[
i];
129 double rms, min, max;
134 fprintf(stderr,
"error vector: RMS=%g, min=%g, max=%g\n", rms, min, max);
136 if(rms > rms_bound || min < residual_min || max > residual_max) {
137 fprintf(stderr,
"error vector larger than allowed\n");
148 unsigned length_origin, start_mdl, length_mdl;
149 REAL8 right_ascension = 0.0, declination = 0.0, psi = 0.0;
153 dt = 1.0 / (f * 4.0);
154 length_origin = 1024 * 3;
165 fprintf(stderr,
"injecting unit amplitude %g Hz circular polarized monochromatic GWs sampled at %g Hz into LHO data\n", f, 1/
dt);
180 dt = 1.0 / (f * 4.0);
181 length_origin = 1024 * 3;
192 fprintf(stderr,
"injecting unit amplitude %g Hz circular polarized monochromatic GWs sampled at %g Hz into ET data\n", f, 1/
dt);
static void minmax(const REAL8TimeSeries *s, double *min, double *max)
static REAL8TimeSeries * error(const REAL8TimeSeries *s1, const REAL8TimeSeries *s0)
static void compute_answer(REAL8TimeSeries *mdl, LIGOTimeGPS epoch, double ampl, double freq, REAL8 right_ascension, REAL8 declination, REAL8 psi, const LALDetector *detector)
static void add_circular_polarized_sine(REAL8TimeSeries *hplus, REAL8TimeSeries *hcross, LIGOTimeGPS epoch, double ampl, double freq)
static REAL8TimeSeries * new_series(double deltaT, unsigned length, double fill)
static void check_result(const REAL8TimeSeries *model, const REAL8TimeSeries *result, double rms_bound, double residual_min, double residual_max)
static LIGOTimeGPS gps_zero
static REAL8TimeSeries * copy_series(const REAL8TimeSeries *src)
static double RMS(const REAL8TimeSeries *s)
static double modelsignal(LIGOTimeGPS t, LIGOTimeGPS epoch, double ampl, double freq, double armlen, double xcos, double ycos, double fxplus, double fxcross, double fyplus, double fycross)
const LALDetector lalCachedDetectors[LAL_NUM_DETECTORS]
void XLALComputeDetAMResponseParts(double *armlen, double *xcos, double *ycos, double *fxplus, double *fyplus, double *fxcross, double *fycross, const LALDetector *detector, double ra, double dec, double psi, double gmst)
REAL8TimeSeries * XLALSimDetectorStrainREAL8TimeSeries(const REAL8TimeSeries *hplus, const REAL8TimeSeries *hcross, REAL8 right_ascension, REAL8 declination, REAL8 psi, const LALDetector *detector)
Transforms the waveform polarizations into a detector strain.
REAL8 XLALTimeDelayFromEarthCenter(const double detector_earthfixed_xyz_metres[3], double source_right_ascension_radians, double source_declination_radians, const LIGOTimeGPS *gpstime)
void XLALDestroyREAL8TimeSeries(REAL8TimeSeries *series)
REAL8TimeSeries * XLALCutREAL8TimeSeries(const REAL8TimeSeries *series, size_t first, size_t length)
REAL8TimeSeries * XLALCreateREAL8TimeSeries(const CHAR *name, const LIGOTimeGPS *epoch, REAL8 f0, REAL8 deltaT, const LALUnit *sampleUnits, size_t length)
const LALUnit lalDimensionlessUnit
#define XLAL_REAL8_FAIL_NAN
REAL8 XLALGreenwichMeanSiderealTime(const LIGOTimeGPS *gpstime)
LIGOTimeGPS * XLALGPSAdd(LIGOTimeGPS *epoch, REAL8 dt)
REAL8 XLALGPSDiff(const LIGOTimeGPS *t1, const LIGOTimeGPS *t0)