27#include <lal/LALInspiral.h>
28#include <lal/SeqFactories.h>
29#include <lal/TimeSeries.h>
30#include <lal/FrequencySeries.h>
32#include <lal/VectorOps.h>
33#include <lal/TimeFreqFFT.h>
34#include <lal/GenerateInspiral.h>
35#include <lal/GenerateInspRing.h>
36#include <lal/LALStatusMacros.h>
37#include <lal/LALInference.h>
38#include <lal/XLALError.h>
39#include <lal/LIGOMetadataRingdownUtils.h>
40#include <lal/LALSimInspiral.h>
41#include <lal/LALInferenceTemplate.h>
42#include <lal/LALInferenceMultibanding.h>
43#include <lal/LALSimNeutronStar.h>
44#include <lal/LALSimInspiralTestingGRCorrections.h>
46#include <lal/LALSimSphHarmMode.h>
49#include <lal/LALInferenceBurstRoutines.h>
52#define PROGRAM_NAME "LALInferenceTemplate.c"
53#define CVS_ID_STRING "$Id$"
54#define CVS_REVISION "$Revision$"
55#define CVS_SOURCE "$Source$"
56#define CVS_DATE "$Date$"
57#define CVS_NAME_STRING "$Name$"
60#define UNUSED __attribute__ ((unused))
66#define MAX_NONPRECESSING_AMP_PN_ORDER 6
67#define MAX_PRECESSING_AMP_PN_ORDER 3
69#define Pi_p2 9.8696044010893586188344909998761511
70#define Pi_p2by3 2.1450293971110256000774441009412356
71#define log4 1.3862943611198906188344642429163531
78const char list_extra_parameters[78][16] = {
"dchiMinus2",
"dchiMinus1",
"dchi0",
"dchi1",
"dchi2",
"dchi3",
"dchi3S",
"dchi3NS",
"dchi4",
"dchi4S",
"dchi4NS",
"dchi5",
"dchi5S",
"dchi5NS",
"dchi5l",
"dchi5lS",
"dchi5lNS",
"dchi6",
"dchi6S",
"dchi6NS",
"dchi6l",
"dchi7",
"dchi7S",
"dchi7NS",
"aPPE",
"alphaPPE",
"bPPE",
"betaPPE",
"betaStep",
"fStep",
"dxi1",
"dxi2",
"dxi3",
"dxi4",
"dxi5",
"dxi6",
"dalpha1",
"dalpha2",
"dalpha3",
"dalpha4",
"dalpha5",
"dbeta1",
"dbeta2",
"dbeta3",
"dsigma1",
"dsigma2",
"dsigma3",
"dsigma4",
"log10lambda_eff",
"lambda_eff",
"nonGR_alpha",
"LIV_A_sign",
"dQuadMon1",
"dQuadMon2",
"dQuadMonS",
"dQuadMonA",
"dchikappaS",
"dchikappaA",
"domega220",
"dtau220",
"domega210",
"dtau210",
"domega330",
"dtau330",
"domega440",
"dtau440",
"domega550",
"dtau550",
"db1",
"db2",
"db3",
"db4",
"dc1",
"dc2",
"dc4",
"dcl",
"damp21",
"damp33"};
82const char list_FTA_parameters[26][16] = {
"dchiMinus2",
"dchiMinus1",
"dchi0",
"dchi1",
"dchi2",
"dchi3",
"dchi3S",
"dchi3NS",
"dchi4",
"dchi4S",
"dchi4NS",
"dchi5",
"dchi5S",
"dchi5NS",
"dchi5l",
"dchi5lS",
"dchi5lNS",
"dchi6",
"dchi6S",
"dchi6NS",
"dchi6l",
"dchi7",
"dchi7S",
"dchi7NS",
"dchikappaS",
"dchikappaA"};
96 double ll = log(lambdav);
97 double ai = .194, bi = .0936, ci = 0.0474, di = -4.21e-3, ei = 1.23e-4;
98 double ln_quad_moment = ai + bi*ll + ci*ll*ll + di*pow(ll,3.0) + ei*pow(ll,4.0);
99 return(exp(ln_quad_moment) - 1.0);
108 memset(d, 0,
sizeof(*(d))*
j);
113 double startpsi = carg(
src->data->data[
i]);
114 double startamp = cabs(
src->data->data[
i]);
115 double endpsi = carg(
src->data->data[
i+1]);
116 double endamp = cabs(
src->data->data[
i+1]);
118 double startf=freqs->
data[
i];
119 double endf=freqs->
data[
i+1];
121 double df = endf - startf;
124 double dpsi = (endpsi - startpsi);
133 double dpsidf = dpsi/
df;
134 double dampdf = (endamp - startamp)/
df;
136 double damp = dampdf *
deltaF;
138 const double dim = sin(dpsidf*
deltaF);
139 const double dre = 2.0*sin(dpsidf*
deltaF*0.5)*sin(dpsidf*
deltaF*0.5);
142 double newRe,newIm,f,re,im,
a;
144 re = cos(startpsi), im = sin(startpsi),
150 newRe = re - dre*re-dim*im,
151 newIm = im + re*dim-dre*im,
152 re=newRe, im = newIm,
155 d[
j] =
a * (re + I*im);
158 memset(&(d[
j]), 0,
sizeof(d[
j])*(
dest->data->length -
j));
171 XLALPrintError(
" ERROR in templateNullFreqdomain(): encountered unallocated 'freqModelhPlus/-Cross'.\n");
192 XLALPrintError(
" ERROR in templateNullTimedomain(): encountered unallocated 'timeModelhPlus/-Cross'.\n");
215 double root = sqrt(0.25-
eta);
216 double fraction = (0.5+root) / (0.5-root);
217 *
m2 =
mc * (pow(1+fraction,0.2) / pow(fraction,0.6));
218 *
m1 =
mc * (pow(1+1.0/fraction,0.2) / pow(1.0/fraction,0.6));
227 *
m1 =
mc * pow(
q, -3.0/5.0) * pow(
q+1, 1.0/5.0);
239 model->
roq->hptildeLinear=NULL, model->
roq->hctildeLinear=NULL;
240 model->
roq->hptildeQuadratic=NULL, model->
roq->hctildeQuadratic=NULL;
249 XLALPrintError(
" ERROR in templateLALGenerateInspiral(): (INT4) \"LAL_APPROXIMANT\" parameter not provided!\n");
256 XLALPrintError(
" ERROR in templateLALGenerateInspiral(): (INT4) \"LAL_PNORDER\" parameter not provided!\n");
292 fprintf(stderr,
"No mass parameters found!");
356 &
inclination, &spin1x, &spin1y, &spin1z, &spin2x, &spin2y, &spin2z,
357 thetaJN, phiJL,
tilt1,
tilt2,
phi12, a_spin1, a_spin2,
m1*
LAL_MSUN_SI,
m2*
LAL_MSUN_SI, fTemp, phi0), errnum);
360 XLALPrintError(
" ERROR in XLALSimInspiralTransformPrecessingNewInitialConditions(): error converting angles. errnum=%d\n",errnum );
387 REAL8 sym_mass_ratio_eta = 0.;
431 REAL8 gamma[] = {SDgamma0,SDgamma1,SDgamma2,SDgamma3};
460 char PPEparam[64]=
"";
461 const char *PPEnames[]={
"aPPE",
"alphaPPE",
"bPPE",
"betaPPE",NULL};
462 for(
UINT4 idx=0;PPEnames[idx];idx++)
464 for(
UINT4 ppeidx=0;;ppeidx++)
466 sprintf(PPEparam,
"%s%d",PPEnames[idx],ppeidx);
478 spin1x, spin1y, spin1z, spin2x, spin2y, spin2z, f_ref, corrected_distance,
inclination, model->
LALpars,
approximant, (model->
roq->frequencyNodesLinear)), errnum);
481 spin1x, spin1y, spin1z, spin2x, spin2y, spin2z, f_ref, corrected_distance,
inclination, model->
LALpars,
approximant, (model->
roq->frequencyNodesQuadratic)), errnum);
518 fprintf(stderr,
" ERROR in templateSineGaussian(): zero or negative \"sigma\" parameter (sigma=%e).\n", sigma);
522 fprintf(stderr,
" WARNING in templateSineGaussian(): negative \"frequency\" parameter (f=%e).\n", f);
524 fprintf(stderr,
" WARNING in templateSineGaussian(): negative \"amplitude\" parameter (a=%e).\n",
a);
526 t = ((double)
i)*model->
deltaT + (epochGPS-endtime);
528 if (fabs(tsigma) < 5.0)
565 fprintf(stderr,
" ERROR in templateDampedSinusoid(): zero or negative \"tau\" parameter (tau=%e).\n", tau);
569 fprintf(stderr,
" WARNING in templateDampedSinusoid(): negative \"frequency\" parameter (f=%e).\n", f);
571 t = ((double)
i)*model->
deltaT + (epochGPS-endtime);
572 if ((t>0.0) && ((ttau=t/tau) < 10.0))
606 double t, sinArg, sinc, twopif =
LAL_TWOPI*f;
610 fprintf(stderr,
" WARNING in templateSinc(): negative \"frequency\" parameter (f=%e).\n", f);
612 t = ((double)
i)*model->
deltaT + (epochGPS-endtime);
614 sinc = (sinArg==0.0) ? 1.0 : sin(sinArg)/sinArg;
638 t = ((double)
i)*model->
deltaT + (epochGPS);
706 INT4 generic_fd_correction;
708 static int sizeWarning = 0;
727 XLALPrintError(
" ERROR in templateLALGenerateInspiral(): (INT4) \"LAL_APPROXIMANT\" parameter not provided!\n");
734 XLALPrintError(
" ERROR in templateLALGenerateInspiral(): (INT4) \"LAL_PNORDER\" parameter not provided!\n");
752 generic_fd_correction = 0;
777 fprintf(stderr,
"No mass parameters found!");
860 &
inclination, &spin1x, &spin1y, &spin1z, &spin2x, &spin2y, &spin2z,
861 thetaJN, phiJL,
tilt1,
tilt2,
phi12, a_spin1, a_spin2,
m1*
LAL_MSUN_SI,
m2*
LAL_MSUN_SI, fTemp, phi0), errnum);
864 XLALPrintError(
" ERROR in XLALSimInspiralTransformPrecessingNewInitialConditions(): error converting angles. errnum=%d: %s\n",errnum,
XLALErrorString(errnum) );
891 REAL8 sym_mass_ratio_eta = 0.;
909 if(m1<mass_max && m1>mass_min)
916 if(m2<mass_max && m2>mass_min)
938 REAL8 compactness1 = 0.371 - 0.0391 * log_lambda1 + 0.001056 * log_lambda1 * log_lambda1;
939 REAL8 compactness2 = 0.371 - 0.0391 * log_lambda2 + 0.001056 * log_lambda2 * log_lambda2;
944 if (fmax_eos <
f_max)
988 REAL8 gamma[] = {SDgamma0,SDgamma1,SDgamma2,SDgamma3};
1015 char PPEparam[64]=
"";
1016 const char *PPEnames[]={
"aPPE",
"alphaPPE",
"bPPE",
"betaPPE",NULL};
1017 for(
UINT4 idx=0;PPEnames[idx];idx++)
1019 for(
UINT4 ppeidx=0;;ppeidx++)
1021 sprintf(PPEparam,
"%s%d",PPEnames[idx],ppeidx);
1038 if (generic_fd_correction != 1)
1050 LALDictEntry *param;
1058 REAL8 default_GR_value = 0.0;
1064 REAL8 correction_window = 1.;
1068 REAL8 correction_ncycles_taper = 1.;
1073 INT4 generic_fd_correction_hm = 0;
1077 if(generic_fd_correction_hm == 0){
1085 XLAL_TRY(ret =
XLALSimInspiralTestingGRCorrections(hptilde,2,2,
m1*
LAL_MSUN_SI,
m2*
LAL_MSUN_SI, spin1z, spin2z,
f_start, f_ref, correction_window, correction_ncycles_taper, model->
LALpars), errnum);
1087 XLAL_TRY(ret =
XLALSimInspiralTestingGRCorrections(hctilde,2,2,
m1*
LAL_MSUN_SI,
m2*
LAL_MSUN_SI, spin1z, spin2z,
f_start, f_ref, correction_window, correction_ncycles_taper, model->
LALpars), errnum);
1092 XLAL_TRY(hlms=
XLALSimInspiralChooseFDModes(
m1*
LAL_MSUN_SI,
m2*
LAL_MSUN_SI, spin1x, spin1y, spin1z, spin2x, spin2y, spin2z,
deltaF,
f_start,
f_max, f_ref, phi0, corrected_distance, 0., grParams,
approximant), errnum);
1112 XLAL_TRY(ret =
XLALSimInspiralTestingGRCorrections(hlm_mode,hlms_temp->
l,abs(hlms_temp->
m),
m1*
LAL_MSUN_SI,
m2*
LAL_MSUN_SI, spin1z, spin2z,
f_start, f_ref, correction_window, correction_ncycles_taper, model->
LALpars), errnum);
1113 hlms_temp = hlms_temp->
next;
1126 memset(hctilde->data->data, 0, npts_wave *
sizeof(
COMPLEX16));
1132 hlms_temp = hlms_temp->
next;
1149 errnum&=~XLAL_EFUNC;
1158 XLAL_ERROR_VOID(errnum,
"%s: Template generation failed in XLALSimInspiralChooseFDWaveformFromCache:\n\
1159XLALSimInspiralChooseFDWaveformFromCache(&hptilde, &hctilde, \
1160%g, %g, %g, %g, %g, %g, %g, %g, %g, %g, %g, %g, %g, %g, %g, \
1161,model->LALpars,model->waveformCache)\n",__func__,
1162 phi0,
deltaF,
m1*
LAL_MSUN_SI,
m2*
LAL_MSUN_SI, spin1x, spin1y, spin1z, spin2x, spin2y, spin2z,
1167 if (hptilde==NULL || hptilde->
data==NULL || hptilde->
data->
data==NULL ) {
1168 XLALPrintError(
" ERROR in %s: encountered unallocated 'hptilde'.\n",__func__);
1171 if (hctilde==NULL || hctilde->data==NULL || hctilde->data->data==NULL ) {
1172 XLALPrintError(
" ERROR in %s: encountered unallocated 'hctilde'.\n",__func__);
1183 size=hctilde->data->length;
1196 spin2x, spin2y, spin2z,
f_start, f_ref, distance,
1208 errnum&=~XLAL_EFUNC;
1217 XLAL_ERROR_VOID(errnum,
"%s: Template generation failed in XLALSimInspiralChooseTDWaveformFromCache\n\
1218XLALSimInspiralChooseTDWaveformFromCache(&hplus, &hcross, \
1219%g, %g, %g, %g, %g, %g, %g, %g, %g, %g, %g, %g, %g, %g, \
1220model->LALpars,model->waveformCache)\n",__func__,
1221 phi0,
deltaT,
m1*
LAL_MSUN_SI,
m2*
LAL_MSUN_SI, spin1x, spin1y, spin1z, spin2x, spin2y, spin2z,
1275 size_t maxShift = (size_t)lround(4.255e-2/
deltaT);
1279 size_t taperLength = (size_t)lround(0.4/
deltaT);
1283 size_t unsafeLength = taperLength + maxShift;
1289 if (desiredTc < tStart || desiredTc >
tEnd) {
1308 size_t wavePostTc = waveLength - waveTcSample;
1310 size_t bufStartIndex = (tcSample >= waveTcSample ? tcSample - waveTcSample : 0);
1311 size_t bufEndIndex = (wavePostTc + tcSample <= bufLength ? wavePostTc + tcSample : bufLength);
1312 size_t bufWaveLength = bufEndIndex - bufStartIndex;
1313 size_t waveStartIndex = (tcSample >= waveTcSample ? 0 : waveTcSample - tcSample);
1315 if (bufStartIndex < unsafeLength || (bufLength - bufEndIndex) <= unsafeLength) {
1320 fprintf(stderr,
"WARNING: Generated template is too long to guarantee that it will not\n");
1321 fprintf(stderr,
"WARNING: (a) lie in a tapered region of the time-domain buffer\n");
1322 fprintf(stderr,
"WARNING: (b) wrap periodically when timeshifted in likelihood computation\n");
1323 fprintf(stderr,
"WARNING: Either of these may cause differences between the template and the\n");
1324 fprintf(stderr,
"WARNING: correct GW waveform in each detector.\n");
1325 fprintf(stderr,
"WARNING: Parameter estimation will continue, but you should consider\n");
1326 fprintf(stderr,
"WARNING: increasing the data segment length (using the --seglen) option.\n");
1337 hplus->
data->
data + waveStartIndex,
1338 bufWaveLength*
sizeof(
REAL8));
1340 hcross->
data->
data + waveStartIndex,
1341 bufWaveLength*
sizeof(
REAL8));
1414 static int sizeWarning = 0;
1432 XLALPrintError(
" ERROR in templateLALGenerateInspiral(): (INT4) \"LAL_APPROXIMANT\" parameter not provided!\n");
1441 XLALPrintError(
" ERROR in templateLALGenerateInspiral(): (INT4) \"LAL_PNORDER\" parameter not provided!\n");
1458 REAL8 f_ref = 100.0;
1461 REAL8 fTemp = f_ref;
1481 fprintf(stderr,
"No mass parameters found!");
1496 f_low = model->
fLow;
1520 REAL8 a_spin1 = 0.0;
1521 REAL8 a_spin2 = 0.0;
1561 &
inclination, &spin1x, &spin1y, &spin1z, &spin2x, &spin2y, &spin2z,
1562 thetaJN, phiJL,
tilt1,
tilt2,
phi12, a_spin1, a_spin2,
m1*
LAL_MSUN_SI,
m2*
LAL_MSUN_SI, fTemp, phi0), errnum);
1565 XLALPrintError(
" ERROR in XLALSimInspiralTransformPrecessingNewInitialConditions(): error converting angles. errnum=%d: %s\n",errnum,
XLALErrorString(errnum) );
1591 REAL8 dLambdaT = 0.;
1592 REAL8 sym_mass_ratio_eta = 0.;
1633 REAL8 SDgamma0 = 0.;
1634 REAL8 SDgamma1 = 0.;
1635 REAL8 SDgamma2 = 0.;
1636 REAL8 SDgamma3 = 0.;
1644 REAL8 gamma[] = {SDgamma0,SDgamma1,SDgamma2,SDgamma3};
1661 char PPEparam[64]=
"";
1662 const char *PPEnames[]= {
"aPPE",
"alphaPPE",
"bPPE",
"betaPPE",NULL};
1663 for(
UINT4 idx=0; PPEnames[idx]; idx++)
1665 for(
UINT4 ppeidx=0;; ppeidx++)
1667 sprintf(PPEparam,
"%s%d",PPEnames[idx],ppeidx);
1675 double mc_min=1.0/pow(2,0.2);
1699 errnum&=~XLAL_EFUNC;
1708 XLAL_ERROR_VOID(errnum,
"%s: Template generation failed in XLALSimInspiralChooseFDWaveformFromCache:\n\
1709XLALSimInspiralChooseFDWaveformFromCache(&hptilde, &hctilde, \
1710%g, %g, %g, %g, %g, %g, %g, %g, %g, %g, %g, %g, %g, %g, \
1711model->LALpars,%d,model->waveformCache)\n",__func__,
1717 if (hptilde==NULL || hptilde->
data==NULL || hptilde->
data->
data==NULL ) {
1718 XLALPrintError(
" ERROR in LALInferenceTemplateXLALSimInspiralChooseWaveform(): encountered unallocated 'hptilde'.\n");
1721 if (hctilde==NULL || hctilde->data==NULL || hctilde->data->data==NULL ) {
1722 XLALPrintError(
" ERROR in LALInferenceTemplateXLALSimInspiralChooseWaveform(): encountered unallocated 'hctilde'.\n");
1738 spin2x, spin2y, spin2z,
f_start, f_ref, distance,
1749 errnum&=~XLAL_EFUNC;
1758 XLAL_ERROR_VOID(errnum,
"%s: Template generation failed in XLALSimInspiralChooseTDWaveformFromCache",__func__);
1810 size_t maxShift = (size_t)lround(4.255e-2/
deltaT);
1814 size_t taperLength = (size_t)lround(0.4/
deltaT);
1818 size_t unsafeLength = taperLength + maxShift;
1824 if (desiredTc < tStart || desiredTc >
tEnd) {
1843 size_t wavePostTc = waveLength - waveTcSample;
1845 size_t bufStartIndex = (tcSample >= waveTcSample ? tcSample - waveTcSample : 0);
1846 size_t bufEndIndex = (wavePostTc + tcSample <= bufLength ? wavePostTc + tcSample : bufLength);
1847 size_t bufWaveLength = bufEndIndex - bufStartIndex;
1848 size_t waveStartIndex = (tcSample >= waveTcSample ? 0 : waveTcSample - tcSample);
1850 if (bufStartIndex < unsafeLength || (bufLength - bufEndIndex) <= unsafeLength) {
1855 fprintf(stderr,
"WARNING: Generated template is too long to guarantee that it will not\n");
1856 fprintf(stderr,
"WARNING: (a) lie in a tapered region of the time-domain buffer\n");
1857 fprintf(stderr,
"WARNING: (b) wrap periodically when timeshifted in likelihood computation\n");
1858 fprintf(stderr,
"WARNING: Either of these may cause differences between the template and the\n");
1859 fprintf(stderr,
"WARNING: correct GW waveform in each detector.\n");
1860 fprintf(stderr,
"WARNING: Parameter estimation will continue, but you should consider\n");
1861 fprintf(stderr,
"WARNING: increasing the data segment length (using the --seglen) option.\n");
1872 hplus->
data->
data + waveStartIndex,
1873 bufWaveLength*
sizeof(
REAL8));
1875 hcross->
data->
data + waveStartIndex,
1876 bufWaveLength*
sizeof(
REAL8));
1908 static int sizeWarning = 0;
1923 polar_ecc=1.0,polar_angle=
LAL_PI/2.;
1929 XLALPrintError(
" ERROR in LALInferenceTemplateXLALSimBurstChooseWaveform(): (INT4) \"LAL_APPROXIMANT\" parameter not provided!\n");
1973 XLALPrintError(
" ERROR in LALInferenceTemplateXLALSimInspiralChooseWaveform(): encountered unallocated 'timeData'.\n");
1980 XLALPrintError(
" ERROR in LALInferenceTemplateXLALSimInspiralChooseWaveform(): encountered unallocated 'freqhCross'.\n");
1991 XLAL_TRY(ret=
XLALSimBurstChooseFDWaveformFromCache(&hptilde, &hctilde,
deltaF,
deltaT,freq,quality,
duration,f_low,
f_max,corrected_hrss,polar_angle,polar_ecc,extraParams,
approximant,model->
burstWaveformCache), errnum);
1998 if (hptilde==NULL || hptilde->
data==NULL || hptilde->
data->
data==NULL ) {
1999 XLALPrintError(
" ERROR in LALInferenceTemplateXLALSimBurstChooseWaveform: encountered unallocated 'hptilde'.\n");
2002 if (hctilde==NULL || hctilde->data==NULL || hctilde->data->data==NULL ) {
2003 XLALPrintError(
" ERROR in LALInferenceTemplateXLALSimBurstChooseWaveform: encountered unallocated 'hctilde'.\n");
2011 if(i < hptilde->
data->length){
2018 dataPtr = hctilde->data->data;
2019 if(i < hctilde->
data->length){
2036 XLAL_TRY(ret=
XLALSimBurstChooseTDWaveformFromCache(&hplus, &hcross,
deltaT,freq,quality,
duration,f_low,
f_max,
hrss,polar_angle,polar_ecc,extraParams,
approximant,model->
burstWaveformCache), errnum);
2038 if (ret ==
XLAL_FAILURE || hplus == NULL || hcross == NULL)
2096 size_t maxShift = (size_t)lround(4.255e-2/hplus->
deltaT);
2101 size_t taperLength = (size_t)lround(
pad/hplus->
deltaT);
2105 size_t unsafeLength = taperLength + maxShift;
2111 if (desiredTc < tStart || desiredTc >
tEnd) {
2130 size_t wavePostTc = waveLength - waveTcSample;
2132 size_t bufStartIndex = (tcSample >= waveTcSample ? tcSample - waveTcSample : 0);
2133 size_t bufEndIndex = (wavePostTc + tcSample <= bufLength ? wavePostTc + tcSample : bufLength);
2134 size_t bufWaveLength = bufEndIndex - bufStartIndex;
2135 size_t waveStartIndex = (tcSample >= waveTcSample ? 0 : waveTcSample - tcSample);
2137 if (bufStartIndex < unsafeLength || (bufLength - bufEndIndex) <= unsafeLength) {
2142 fprintf(stderr,
"WARNING: Generated template is too long to guarantee that it will not\n");
2143 fprintf(stderr,
"WARNING: (a) lie in a tapered region of the time-domain buffer\n");
2144 fprintf(stderr,
"WARNING: (b) wrap periodically when timeshifted in likelihood computation\n");
2145 fprintf(stderr,
"WARNING: Either of these may cause differences between the template and the\n");
2146 fprintf(stderr,
"WARNING: correct GW waveform in each detector.\n");
2147 fprintf(stderr,
"WARNING: Parameter estimation will continue, but you should consider\n");
2148 fprintf(stderr,
"WARNING: increasing the data segment length (using the --seglen) option.\n");
2160 hplus->
data->
data + waveStartIndex,
2161 bufWaveLength*
sizeof(
REAL8));
2163 hcross->
data->
data + waveStartIndex,
2164 bufWaveLength*
sizeof(
REAL8));
2207 quality=0.0,tau=0.0,
2222 XLALPrintError(
" ERROR in LALInferenceTemplateXLALSimInspiralChooseWaveform(): encountered unallocated 'timeData'.\n");
2228 XLALPrintError(
" ERROR in LALInferenceTemplateXLALSimInspiralChooseWaveform(): encountered unallocated 'freqhCross'.\n");
2242 if (hptilde==NULL || hptilde->
data==NULL || hptilde->
data->
data==NULL ) {
2243 XLALPrintError(
" ERROR in LALInferenceTemplateXLALInferenceBurstChooseWaveform: encountered unallocated 'hptilde'.\n");
2246 if (hctilde==NULL || hctilde->data==NULL || hctilde->data->data==NULL ) {
2247 XLALPrintError(
" ERROR in LALInferenceTemplateXLALInferenceBurstChooseWaveform: encountered unallocated 'hctilde'.\n");
2250 size_t lower =(size_t) ( hctilde->f0/hctilde->deltaF);
2251 size_t upper= (size_t) ( hctilde->data->length + lower);
2253 COMPLEX16 *dataPtrC = hctilde->data->data;
2254 for (
i=0;
i<lower; ++
i) {
2267 for (
i=lower;
i<upper; ++
i) {
2305 fprintf(
outfile,
"\"f\",\"signalPlusRe\",\"signalPlusIm\",\"signalCrossRe\",\"signalCrossIm\"\n");
2316 fprintf(stdout,
" wrote (frequency-domain) template to CSV file \"%s\".\n",
filename);
2348 fprintf(stdout,
" wrote (time-domain) template to CSV file \"%s\".\n",
filename);
LALDictEntry * XLALDictIterNext(LALDictIter *iter)
int XLALDictInsert(LALDict *dict, const char *key, const void *data, size_t size, LALTYPECODE type)
LALDict * XLALCreateDict(void)
void XLALDictIterInit(LALDictIter *iter, LALDict *dict)
int XLALDictInsertValue(LALDict *dict, const char *key, const LALValue *value)
const char * XLALDictEntryGetKey(const LALDictEntry *entry)
const LALValue * XLALDictEntryGetValue(const LALDictEntry *entry)
int XLALSimBurstChooseFDWaveformFromCache(COMPLEX16FrequencySeries **hptilde, COMPLEX16FrequencySeries **hctilde, REAL8 deltaF, REAL8 deltaT, REAL8 f0, REAL8 q, REAL8 tau, REAL8 f_min, REAL8 f_max, REAL8 hrss, REAL8 polar_angle, REAL8 polar_ecc, LALSimBurstExtraParam *extraParams, BurstApproximant approximant, LALSimBurstWaveformCache *cache)
Chooses between different approximants when requesting a waveform to be generated Returns the wavefor...
void XLALSimBurstDestroyExtraParam(LALSimBurstExtraParam *parameter)
Function that destroys the whole burst extra params linked list.
int XLALInferenceBurstSineGaussianFFast(COMPLEX16FrequencySeries **hplus, COMPLEX16FrequencySeries **hcross, REAL8 Q, REAL8 centre_frequency, REAL8 hrss, REAL8 eccentricity, REAL8 phase, REAL8 deltaF, REAL8 deltaT)
int XLALSimBurstChooseTDWaveformFromCache(REAL8TimeSeries **hplus, REAL8TimeSeries **hcross, REAL8 deltaT, REAL8 f0, REAL8 q, REAL8 tau, REAL8 f_min, REAL8 f_max, REAL8 hrss, REAL8 polar_angle, REAL8 polar_ecc, LALSimBurstExtraParam *extraParams, BurstApproximant approximant, LALSimBurstWaveformCache *cache)
Chooses between different approximants when requesting a waveform to be generated Returns the wavefor...
BurstApproximant
Enum that specifies the PN approximant to be used in computing the waveform.
REAL8Sequence * LALInferenceMultibandFrequencies(int NBands, double f_min, double f_max, double deltaF0, double mc)
Create a list of frequencies to use in multiband template generation, between f_min and f_max mc is m...
const char list_extra_parameters[78][16]
static int InterpolateWaveform(REAL8Vector *freqs, COMPLEX16FrequencySeries *src, COMPLEX16FrequencySeries *dest)
const char list_FTA_parameters[26][16]
static REAL8 dquadmon_from_lambda(REAL8 lambdav)
static void mc2masses(double mc, double eta, double *m1, double *m2)
const UINT4 N_extra_params
static void q2masses(double mc, double q, double *m1, double *m2)
LALInferenceVariables currentParams
REAL8 XLALSimInspiralfLow2fStart(REAL8 fLow, INT4 ampOrder, INT4 approximant)
const char * XLALSimInspiralGetStringFromApproximant(Approximant approximant)
int XLALSimInspiralTestingGRCorrections(COMPLEX16FrequencySeries *htilde, const UINT4 l, const UINT4 m, const REAL8 m1_SI, const REAL8 m2_SI, const REAL8 chi1z, const REAL8 chi2z, const REAL8 f_low, const REAL8 f_ref, const REAL8 f_window_div_f_Peak, const REAL8 NCyclesStep, LALDict *LALpars)
struct tagLALSimNeutronStarFamily LALSimNeutronStarFamily
COMPLEX16FrequencySeries * XLALCreateCOMPLEX16FrequencySeries(const CHAR *name, const LIGOTimeGPS *epoch, REAL8 f0, REAL8 deltaF, const LALUnit *sampleUnits, size_t length)
COMPLEX16FrequencySeries * XLALResizeCOMPLEX16FrequencySeries(COMPLEX16FrequencySeries *series, int first, size_t length)
void XLALDestroyCOMPLEX16FrequencySeries(COMPLEX16FrequencySeries *series)
void LALInferencedQuadMonSdQuadMonA(REAL8 dQuadMonS, REAL8 dQuadMonA, REAL8 *dQuadMon1, REAL8 *dQuadMon2)
Convert from dQuadMonS, dQuadMonA to dQuadMon1, dQuadMon2.
void LALInferenceAddVariable(LALInferenceVariables *vars, const char *name, const void *value, LALInferenceVariableType type, LALInferenceParamVaryType vary)
Add a variable named name to vars with initial value referenced by value.
void LALInferenceLogp1GammasMasses2Lambdas(REAL8 logp1, REAL8 gamma1, REAL8 gamma2, REAL8 gamma3, REAL8 mass1, REAL8 mass2, REAL8 *lambda1, REAL8 *lambda2)
Calculate lambda1,2(m1,2|eos(logp1,gamma1,gamma2,gamma3))
REAL8 LALInferenceGetREAL8Variable(LALInferenceVariables *vars, const char *name)
void LALInferenceExecuteFT(LALInferenceModel *model)
Execute FFT for data in IFOdata.
void LALInferenceLambdaTsEta2Lambdas(REAL8 lambdaT, REAL8 dLambdaT, REAL8 eta, REAL8 *lambda1, REAL8 *lambda2)
Convert from lambdaT, dLambdaT, and eta to lambda1 and lambda2.
void LALInferenceCopyVariables(LALInferenceVariables *origin, LALInferenceVariables *target)
Deep copy the variables from one to another LALInferenceVariables structure.
void * LALInferenceGetVariable(const LALInferenceVariables *vars, const char *name)
Return a pointer to the memory the variable vars is stored in specified by name User must cast this p...
void LALInferenceSDGammasMasses2Lambdas(REAL8 gamma[], REAL8 mass1, REAL8 mass2, REAL8 *lambda1, REAL8 *lambda2, int size)
Convert from spectral parameters to lambda1, lambda2.
void LALInferenceBinaryLove(LALInferenceVariables *vars, REAL8 *lambda1, REAL8 *lambda2)
Compute Tidal deformabilities following BinaryLove Universal relations.
void LALInferenceExecuteInvFT(LALInferenceModel *model)
Execute Inverse FFT for data in IFOdata.
int LALInferenceCheckVariable(LALInferenceVariables *vars, const char *name)
Checks for name being present in vars returns 1(==true) or 0.
void LALInferenceSetVariable(LALInferenceVariables *vars, const char *name, const void *value)
Set a variable named name in vars with a value.
@ LALINFERENCE_PARAM_OUTPUT
A parameter that never changes, functions should respect this.
void LALInferenceROQWrapperForXLALSimInspiralChooseFDWaveformSequence(LALInferenceModel *model)
void LALInferenceTemplateXLALSimBurstSineGaussianF(LALInferenceModel *model)
void LALInferenceTemplateASinOmegaT(LALInferenceModel *model)
Trivial h(t) = A*sin(Omega*t) template.
void LALInferenceTemplateNullFreqdomain(LALInferenceModel *model)
Returns a frequency-domain 'null' template (all zeroes, implying no signal present).
void LALInferenceTemplateXLALSimInspiralChooseWaveformPhaseInterpolated(LALInferenceModel *model)
void LALInferenceDumptemplateFreqDomain(LALInferenceVariables *currentParams, LALInferenceModel *model, const char *filename)
De-bugging function writing a (frequency-domain) signal template to a CSV file.
void LALInferenceDumptemplateTimeDomain(LALInferenceVariables *currentParams, LALInferenceModel *model, const char *filename)
De-bugging function writing a (time-domain) signal template to a CSV file.
void LALInferenceTemplateSineGaussian(LALInferenceModel *model)
Sine-Gaussian (burst) template.
void LALInferenceTemplateXLALSimBurstChooseWaveform(LALInferenceModel *model)
void LALInferenceTemplateXLALSimInspiralChooseWaveform(LALInferenceModel *model)
"XLALSimInspiralChooseWaveform{TD,FD}" wrapper.
void LALInferenceTemplateSinc(LALInferenceModel *model)
Sinc function (burst) template.
void LALInferenceTemplateNullTimedomain(LALInferenceModel *model)
Returns a time-domain 'null' template (all zeroes, implying no signal present).
void LALInferenceTemplateDampedSinusoid(LALInferenceModel *model)
Damped Sinusoid template.
SphHarmFrequencySeries * XLALSimInspiralChooseFDModes(REAL8 m1, REAL8 m2, REAL8 S1x, REAL8 S1y, REAL8 S1z, REAL8 S2x, REAL8 S2y, REAL8 S2z, REAL8 deltaF, REAL8 f_min, REAL8 f_max, REAL8 f_ref, REAL8 phiRef, REAL8 distance, REAL8 inclination, LALDict *params, Approximant approximant)
double XLALSimNeutronStarLoveNumberK2(double m, LALSimNeutronStarFamily *fam)
double XLALSimNeutronStarRadius(double m, LALSimNeutronStarFamily *fam)
double XLALSimNeutronStarFamMinimumMass(LALSimNeutronStarFamily *fam)
double XLALSimNeutronStarMaximumMass(LALSimNeutronStarFamily *fam)
int XLALSimAddModeFD(COMPLEX16FrequencySeries *hptilde, COMPLEX16FrequencySeries *hctilde, COMPLEX16FrequencySeries *hlmtilde, REAL8 theta, REAL8 phi, INT4 l, INT4 m, INT4 sym)
COMPLEX16FrequencySeries * XLALSphHarmFrequencySeriesGetMode(SphHarmFrequencySeries *ts, UINT4 l, INT4 m)
void XLALDestroySphHarmFrequencySeries(SphHarmFrequencySeries *ts)
void XLALDestroyREAL8TimeSeries(REAL8TimeSeries *series)
#define XLAL_ERROR_VOID(...)
const char * XLALErrorString(int errnum)
int XLALSetErrno(int errnum)
#define XLAL_TRY(statement, errnum)
int XLALPrintError(const char *fmt,...) _LAL_GCC_PRINTF_FORMAT_(1
#define XLAL_PRINT_ERROR(...)
REAL8 XLALGPSGetREAL8(const LIGOTimeGPS *epoch)
int XLALSimInspiralTransformPrecessingNewInitialConditions(REAL8 *incl, REAL8 *S1x, REAL8 *S1y, REAL8 *S1z, REAL8 *S2x, REAL8 *S2y, REAL8 *S2z, const REAL8 thetaJN, const REAL8 phiJL, const REAL8 theta1, const REAL8 theta2, const REAL8 phi12, const REAL8 chi1, const REAL8 chi2, const REAL8 m1_SI, const REAL8 m2_SI, const REAL8 fRef, const REAL8 phiRef)
def Omega(v, m1, m2, S1, S2, Ln)
Preccesion frequency spins Eqs.
Structure to constain a model and its parameters.
COMPLEX16FrequencySeries * freqhPlus
Time series model buffers.
LALSimNeutronStarFamily * eos_fam
Is ROQ enabled.
REAL8 fHigh
Start frequency for waveform generation.
REAL8TimeSeries * timehCross
LALSimBurstWaveformCache * burstWaveformCache
Waveform cache.
LALSimInspiralWaveformCache * waveformCache
REAL8TimeSeries * timehPlus
LALInferenceVariables * params
REAL8 deltaT
End frequency for waveform generation.
COMPLEX16FrequencySeries * freqhCross
LALDict * LALpars
Projected freq series model buffers.
REAL8Window * window
Pre-calculated FFT plans for forward and reverse FFTs.
REAL8 fLow
Array of single-IFO SNRs at params
struct tagLALInferenceROQModel * roq
The padding of the above window.
LALInferenceTemplateFunction templt
Domain of model.
LALSimulationDomain domain
IFO-dependent parameters and buffers.
The LALInferenceVariables structure to contain a set of parameters Implemented as a linked list of LA...
struct tagSphHarmFrequencySeries * next
COMPLEX16FrequencySeries * mode