27#include <lal/LALAdaptiveRungeKuttaIntegrator.h>
28#include <lal/LALConstants.h>
29#include <lal/FindRoot.h>
30#include <lal/SeqFactories.h>
31#include <lal/LALSimInspiral.h>
32#include <lal/LALSimIMR.h>
34#include <lal/LALSimNoise.h>
35#include <lal/ComplexFFT.h>
37#include <lal/ComplexFFT.h>
38#include <gsl/gsl_errno.h>
39#include <gsl/gsl_spline.h>
40#include <gsl/gsl_math.h>
44#define MYUNUSED(expr) do { (void)(expr); } while (0)
48 printf(
"%s: %g + I %g\n",
name, creal(
x), cimag(
x));
59 int len1 = (*htilde1)->data->length;
60 int len2 = (*htilde1)->data->length;
74 int iStart = (int)(fMin / df);
75 int iStop = (int)(fMax / df);
76 iStart = (iStart < 1) ? 1 : iStart;
77 iStop = (iStop > n) ? n : iStop;
78 for (
int i=iStart;
i<iStop;
i++) {
81 h1 = ((*htilde1)->data->data)[
i];
82 h2 = ((*htilde2)->data->data)[
i];
83 integrand->
data[
i] = h1 * conj(h2) * tableS;
84 norm1 +=
sqr(cabs(h1)) * tableS;
85 norm2 +=
sqr(cabs(h2)) * tableS;
100 for (
int i=0;
i<zpf*n;
i++)
101 array_in->
data[
i] = 0.0;
102 for (
int i=zpf*n;
i<(zpf*n + n);
i++)
103 array_in->
data[
i] = integrand->
data[iStart +
i-zpf*n];
104 for (
int i=zpf*n + n;
i<
m;
i++)
105 array_in->
data[
i] = 0.0;
110 for (
int i=0;
i<
m;
i++) {
111 val = cabs(array_out->
data[
i]);
120 return match / sqrt(norm1*norm2);
129 REAL8 f_max_prime = 0;
133 for (
int i=1;
i<wflen;
i++) {
137 if (!(creal(hp) == 0 && cimag(hp) == 0 && creal(hc) == 0 && cimag(hc) == 0)) {
138 f_max_prime = (f > f_max_prime) ? f : f_max_prime;
139 fprintf(out,
"%.15g\t%.15g\t%.15g\t%.15g\t%.15g\n", f*
LAL_MTSUN_SI*
M, creal(hp), cimag(hp), creal(hc), cimag(hc));
149 return !gsl_fcmp(
a, b, epsilon);
158 printf(
"%-8s: %-20.17g\t%-20.17g\t%-20.17g\n",
name,
u, u_expected,
u - u_expected);
163 printf(
"\n** Test_alpha_epsilon: **\n");
164 const REAL8 f = 0.01;
166 const REAL8 chil = 0.5625;
167 const REAL8 chip = 0.18;
173 const REAL8 logomega = log(omega);
174 const REAL8 omega_cbrt = cbrt(omega);
175 const REAL8 omega_cbrt2 = omega_cbrt*omega_cbrt;
188 const REAL8 alpha_expected = -11.8195574;
189 const REAL8 epsilon_expected = -11.9359726;
199 &&
"Test_alpha_epsilon()"
205 printf(
"\n** Test_XLALSimIMRPhenomPCalculateModelParameters: **\n");
207 REAL8 chi1_l, chi2_l, chi_eff, chip, thetaJ, alpha0;
217 REAL8 lnhatx = sin(0.4);
219 REAL8 lnhatz = cos(0.4);
244 chi_eff = (m1_SI*chi1_l + m2_SI*chi2_l) / (m1_SI + m2_SI);
246 REAL8 chi_eff_expected = 0.4378425478398173;
247 REAL8 chip_expected = 0.1752382540388927;
248 REAL8 thetaJ_expected = 0.29197409372473093;
263 &&
"Test_XLALSimIMRPhenomPCalculateModelParameters()"
269static void Test_PhenomC(
void);
270static void Test_PhenomC(
void) {
271 printf(
"\n** Test_PhenomC: **\n");
272 const REAL8 fHz = 40.6051;
273 const REAL8 eta = 0.16;
276 const REAL8 chi = 0.45;
277 const REAL8 chip = 0.18;
280 const REAL8 phic = 0;
281 REAL8 phPhenomC = 0.0;
282 REAL8 aPhenomC = 0.0;
294 phPhenomC -= 2.*phic;
296 printf(
"test %g\n",
M* LAL_MRSUN_SI *
M* LAL_MTSUN_SI / distance);
297 COMPLEX16 hPC = amp0 * aPhenomC * cexp(-I*phPhenomC);
298 printf(
"phPhenomC: %g\n", phPhenomC);
299 printf(
"aPhenomC: %g\tamp0: %g\n", aPhenomC, amp0);
300 printf(
"LAL_MRSUN_SI, LAL_MTSUN_SI, LAL_PC_SI: %g\t%g\t%g\n",LAL_MRSUN_SI, LAL_MTSUN_SI, LAL_PC_SI);
303 COMPLEX16 hPC_expected = -4.08291e-23 - I * 8.89596e-23;
315static void Test_PhenomPCore(
void);
316static void Test_PhenomPCore(
void) {
317 printf(
"\n** Test_PhenomPCore: **\n");
320 REAL8 chi_eff = 0.45;
321 const REAL8 chil = (1.0+
q)/
q * chi_eff;
322 printf(
"chil %g\n", chil);
328 const REAL8 omega_ref = piM * 20;
329 const REAL8 logomega_ref = log(omega_ref);
330 const REAL8 omega_ref_cbrt = cbrt(omega_ref);
331 const REAL8 omega_ref_cbrt2 = omega_ref_cbrt*omega_ref_cbrt;
337 printf(
"alphaNNLOoffset %g\n", alphaNNLOoffset);
340 const REAL8 ytheta = 0.279523;
341 const REAL8 yphi = alphaNNLOoffset - 0.0234206;
342 printf(
"yphi %g\n", alphaNNLOoffset - 0.0234206);
364 100 * 1e6 * LAL_PC_SI,
386 COMPLEX16 hp_expected = 2.06975e-23 - I * 9.29353e-23;
387 COMPLEX16 hc_expected = -9.29441e-23 - I * 2.06616e-23;
393 &&
"Test_PhenomPCore()"
400 printf(
"\n** Test_XLALSimIMRPhenomP: **\n");
402 REAL8 chi1_l, chi2_l, chip, thetaJ, alpha0;
414 REAL8 lnhatx = sin(0.4);
416 REAL8 lnhatz = cos(0.4);
469 dump_file(
"PhenomP_Test1.dat", hptilde, hctilde, m1+m2);
476 COMPLEX16 hp_expected = -5.17642e-23 + I * 2.60463e-23;
477 COMPLEX16 hc_expected = 2.6046e-23 + I * 5.17592e-23;
483 &&
"XLALSimIMRPhenomP()"
489static void Test_PhenomC_PhenomP(
void);
490static void Test_PhenomC_PhenomP(
void) {
491 printf(
"\n** Test_PhenomC_PhenomP: **\n");
494 REAL8 q = (1 + sqrt(1 - 4*eta) - 2*eta)/(2.*eta);
502 REAL8 m1_SI =
M *
q/(1+
q) * LAL_MSUN_SI;
503 REAL8 m2_SI =
M * 1.0/(1+
q) * LAL_MSUN_SI;
520 REAL8 chi1_l, chi2_l, chip, thetaJ, alpha0;
522 XLALSimIMRPhenomPCalculateModelParameters(
542 printf(
"chip = %g\n", chip);
543 printf(
"eta = %g\n", eta);
544 printf(
"thetaJ = %g\n", thetaJ);
566 REAL8 f_max_prime = 0;
568 out = fopen(
"XLALSimIMRPhenomP.dat",
"w");
569 for (
int i=1;
i<wflen;
i++) {
573 if (!(creal(hp) == 0 && cimag(hp) == 0 && creal(hc) == 0 && cimag(hc) == 0)) {
574 f_max_prime = (f > f_max_prime) ? f : f_max_prime;
575 fprintf(out,
"%.15g\t%.15g\t%.15g\t%.15g\t%.15g\n", f*LAL_MTSUN_SI*
M, creal(hp), cimag(hp), creal(hc), cimag(hc));
579 printf(
"f_max_prime = %g\n", f_max_prime);
596 out = fopen(
"XLALSimIMRPhenomC.dat",
"w");
598 for (
int i=1;
i<wflen;
i++) {
601 if (!(creal(hp) == 0 && cimag(hp) == 0))
602 fprintf(out,
"%.15g\t%.15g\t%.15g\n", f*LAL_MTSUN_SI*
M, creal(hp), cimag(hp));
608 REAL8 match_expected = 0.999465;
614 &&
"Test_PhenomC_PhenomP()"
617 printf(
"match(PhenomP_aligned, PhenomC) = %g\n", match);
625 printf(
"\n** Test_XLALSimIMRPhenomP_f_ref: **\n");
627 REAL8 chi1_l, chi2_l, chip, thetaJ, alpha0;
633 REAL8 s1x = 0.45*sin(0.4);
635 REAL8 s1z = 0.45*cos(0.4);
636 REAL8 s2x = 0.45*sin(0.4);
638 REAL8 s2z = 0.45*cos(0.4);
639 REAL8 lnhatx = sin(0.4);
641 REAL8 lnhatz = cos(0.4);
694 dump_file(
"PhenomP_Test_f_ref1.dat", hptilde, hctilde, m1+m2);
698 printf(
"f_ref = %g\n", f_ref);
749 dump_file(
"PhenomP_Test_f_ref2.dat", hptilde2, hctilde2, m1+m2);
753 printf(
"f_ref = %g\n", f_ref);
762 &&
"XLALSimIMRPhenomP_f_ref()"
766int main(
int argc,
char *argv[]) {
788 printf(
"\nAll done!\n");
static int IMRPhenomCGenerateAmpPhase(REAL8 *amplitude, REAL8 *phasing, REAL8 f, REAL8 eta, const BBHPhenomCParams *params)
static void ComputeNNLOanglecoeffs(NNLOanglecoeffs *angcoeffs, const REAL8 q, const REAL8 chil, const REAL8 chip)
Next-to-next-to-leading order PN coefficients for Euler angles and .
static int PhenomPCoreOneFrequency(const REAL8 fHz, const REAL8 eta, const REAL8 distance, const REAL8 M, const REAL8 phic, IMRPhenomDAmplitudeCoefficients *pAmp, IMRPhenomDPhaseCoefficients *pPhi, BBHPhenomCParams *PCparams, PNPhasingSeries *PNparams, COMPLEX16 *hPhenom, REAL8 *phasing, IMRPhenomP_version_type IMRPhenomP_version, AmpInsPrefactors *amp_prefactors, PhiInsPrefactors *phi_prefactors)
static UNUSED BBHPhenomCParams * ComputeIMRPhenomCParamsRDmod(const REAL8 m1, const REAL8 m2, const REAL8 chi, const REAL8 chip, LALDict *extraParams)
PhenomC parameters for modified ringdown, uses final spin formula of:
bool approximatelyEqual(REAL8 a, REAL8 b, REAL8 epsilon)
int main(int argc, char *argv[])
static void Test_alpha_epsilon(void)
void print_difference(const char *name, REAL8 u, REAL8 u_expected)
REAL8 MatchSI(COMPLEX16FrequencySeries **htilde1, COMPLEX16FrequencySeries **htilde2, REAL8 fMin, REAL8 fMax, REAL8 df)
static void Test_XLALSimIMRPhenomP(void)
void prC(const char *name, COMPLEX16 x)
static void Test_XLALSimIMRPhenomP_f_ref(void)
void dump_file(const char *filename, COMPLEX16FrequencySeries *hptilde, COMPLEX16FrequencySeries *hctilde, REAL8 M)
static void Test_XLALSimIMRPhenomPCalculateModelParameters(void)
bool approximatelyEqualC(COMPLEX16 a, COMPLEX16 b, REAL8 epsilon)
COMPLEX16FFTPlan * XLALCreateForwardCOMPLEX16FFTPlan(UINT4 size, int measurelvl)
void XLALDestroyCOMPLEX16FFTPlan(COMPLEX16FFTPlan *plan)
int XLALCOMPLEX16VectorFFT(COMPLEX16Vector *_LAL_RESTRICT_ output, const COMPLEX16Vector *_LAL_RESTRICT_ input, const COMPLEX16FFTPlan *plan)
@ IMRPhenomPv2_V
version 2: based on IMRPhenomD
@ NoNRT_V
special case for PhenomPv2 BBH baseline
int XLALSimIMRPhenomP(COMPLEX16FrequencySeries **hptilde, COMPLEX16FrequencySeries **hctilde, const REAL8 chi1_l, const REAL8 chi2_l, const REAL8 chip, const REAL8 thetaJ, const REAL8 m1_SI, const REAL8 m2_SI, const REAL8 distance, const REAL8 alpha0, const REAL8 phic, const REAL8 deltaF, const REAL8 f_min, const REAL8 f_max, const REAL8 f_ref, IMRPhenomP_version_type IMRPhenomP_version, NRTidal_version_type NRTidal_version, LALDict *extraParams)
Driver routine to compute the precessing inspiral-merger-ringdown phenomenological waveform IMRPhenom...
int XLALSimIMRPhenomPCalculateModelParametersOld(REAL8 *chi1_l, REAL8 *chi2_l, REAL8 *chip, REAL8 *thetaJ, REAL8 *alpha0, const REAL8 m1_SI, const REAL8 m2_SI, const REAL8 f_ref, const REAL8 lnhatx, const REAL8 lnhaty, const REAL8 lnhatz, const REAL8 s1x, const REAL8 s1y, const REAL8 s1z, const REAL8 s2x, const REAL8 s2y, const REAL8 s2z, IMRPhenomP_version_type IMRPhenomP_version)
Deprecated : used the old convention (view frame for the spins) Function to map LAL parameters (masse...
int XLALSimIMRPhenomCGenerateFD(COMPLEX16FrequencySeries **htilde, const REAL8 phiPeak, const REAL8 deltaF, const REAL8 m1_SI, const REAL8 m2_SI, const REAL8 chi, const REAL8 f_min, const REAL8 f_max, const REAL8 distance, LALDict *extraParams)
Driver routine to compute the spin-aligned, inspiral-merger-ringdown phenomenological waveform IMRPhe...
double XLALSimNoisePSDaLIGOZeroDetHighPower(double f)
Provides the noise power spectrum for aLIGO under the high-power broad-band signal recycling (no detu...
COMPLEX16 XLALSpinWeightedSphericalHarmonic(REAL8 theta, REAL8 phi, int s, int l, int m)
COMPLEX16Vector * XLALCreateCOMPLEX16Vector(UINT4 length)
int XLALPrintError(const char *fmt,...) _LAL_GCC_PRINTF_FORMAT_(1
#define XLAL_CHECK_EXIT(assertion)
used to cache the recurring (frequency-independent) prefactors of AmpInsAnsatz.
Structure holding all coefficients for the amplitude.
Structure holding all coefficients for the phase.
Linked list of any number of parameters for testing GR.
used to cache the recurring (frequency-independent) prefactors of PhiInsAnsatzInt.