LALSimulation  5.4.0.1-fe68b98
LALSimInspiralGeneratorLegacy.c
Go to the documentation of this file.
1 #include <lal/LALStdlib.h>
2 #include <lal/LALSimInspiral.h>
3 #include <lal/LALDict.h>
5 #include <lal/LALSimIMR.h>
6 #include "check_series_macros.h"
9 #include "rotation_macros.h"
11 
12 #include <lal/FrequencySeries.h>
13 #include <lal/AVFactories.h>
14 
15 #ifdef __GNUC__
16 #define UNUSED __attribute__ ((unused))
17 #else
18 #define UNUSED
19 #endif
20 
21 
23  REAL8TimeSeries **hplus,
24  REAL8TimeSeries **hcross,
25  REAL8 m1,
26  REAL8 m2,
27  REAL8 S1x,
28  REAL8 S1y,
29  REAL8 S1z,
30  REAL8 S2x,
31  REAL8 S2y,
32  REAL8 S2z,
33  REAL8 distance,
34  REAL8 inclination,
35  REAL8 phiRef,
36  REAL8 longAscNodes,
37  REAL8 eccentricity,
38  REAL8 meanPerAno,
39  REAL8 deltaT,
40  REAL8 f_min,
41  REAL8 f_ref,
42  LALDict *params,
44 );
45 
47  COMPLEX16FrequencySeries ** hptilde,
48  COMPLEX16FrequencySeries ** hctilde,
49  REAL8 m1,
50  REAL8 m2,
51  REAL8 S1x,
52  REAL8 S1y,
53  REAL8 S1z,
54  REAL8 S2x,
55  REAL8 S2y,
56  REAL8 S2z,
57  REAL8 distance,
58  REAL8 inclination,
59  REAL8 phiRef,
60  REAL8 longAscNodes,
61  REAL8 eccentricity,
62  REAL8 meanPerAno,
63  REAL8 deltaF,
64  REAL8 f_min,
65  REAL8 f_max,
66  REAL8 f_ref,
67  LALDict * params,
69 );
70 
72  REAL8 phiRef,
73  REAL8 deltaT,
74  REAL8 m1,
75  REAL8 m2,
76  REAL8 S1x,
77  REAL8 S1y,
78  REAL8 S1z,
79  REAL8 S2x,
80  REAL8 S2y,
81  REAL8 S2z,
82  REAL8 f_min,
83  REAL8 f_ref,
84  REAL8 r,
85  LALDict * LALpars,
86  int lmax,
88 );
89 
91  REAL8 m1,
92  REAL8 m2,
93  REAL8 S1x,
94  REAL8 S1y,
95  REAL8 S1z,
96  REAL8 S2x,
97  REAL8 S2y,
98  REAL8 S2z,
99  REAL8 deltaF,
100  REAL8 f_min,
101  REAL8 f_max,
102  REAL8 f_ref,
103  REAL8 phiRef,
104  REAL8 distance,
105  REAL8 inclination,
106  LALDict * params,
108 );
109 
110 /**
111  * Method to initialize generator. This activates the conditioning for proper Fourier transform in the option `condition` is on in the LALDict
112  */
113 
114 static int initialize(LALSimInspiralGenerator * myself, LALDict *params)
115 {
116  if (params && XLALDictContains(params, "condition")) {
117  int condition;
118  int errnum;
119  XLAL_TRY(condition = XLALDictLookupINT4Value(params, "condition"), errnum);
120  if (errnum)
121  XLAL_ERROR(errnum);
122  if (condition) {
123  Approximant approximant = *(Approximant *)myself->internal_data;
125  }
126  }
127  return 0;
128 }
129 
130 /**
131  * Define waveform generator methods to generate polarizations or modes in time or Fourier domain for legacy approximants
132  */
133 
134 /** Fourier domain modes */
135 static int generate_fd_modes(
137  LALDict *params,
138  LALSimInspiralGenerator *myself
139 )
140 {
141  REAL8 m1, m2, S1x, S1y, S1z, S2x, S2y, S2z, deltaF, f_min, f_max, f_ref, phiRef, distance, inclination;
143 
144  /* approximant for this generator */
145  approximant = *(Approximant *)myself->internal_data;
146 
147  XLALSimInspiralParseDictionaryToChooseFDModes(&m1, &m2, &S1x, &S1y, &S1z, &S2x, &S2y, &S2z, &deltaF, &f_min, &f_max, &f_ref, &phiRef, &distance, &inclination, params);
148 
149  *hlm = XLALSimInspiralChooseFDModes_legacy(m1, m2, S1x, S1y, S1z, S2x, S2y, S2z, deltaF, f_min, f_max, f_ref, phiRef, distance, inclination, params, approximant);
150 
151  return 0;
152 }
153 
154 /** Fourier domain polarizations */
156  COMPLEX16FrequencySeries **hplus,
157  COMPLEX16FrequencySeries **hcross,
158  LALDict *params,
159  LALSimInspiralGenerator *myself
160 )
161 {
162  REAL8 m1, m2, S1x, S1y, S1z, S2x, S2y, S2z, distance, inclination, phiRef, longAscNodes, eccentricity, meanPerAno, deltaF, f_min, f_max, f_ref;
164 
165  /* approximant for this generator */
166  approximant = *(Approximant *)myself->internal_data;
167 
168  XLALSimInspiralParseDictionaryToChooseFDWaveform(&m1, &m2, &S1x, &S1y, &S1z, &S2x, &S2y, &S2z, &distance, &inclination, &phiRef, &longAscNodes, &eccentricity, &meanPerAno, &deltaF, &f_min, &f_max, &f_ref, params);
169 
170  return XLALSimInspiralChooseFDWaveform_legacy(hplus, hcross, m1, m2, S1x, S1y, S1z, S2x, S2y, S2z, distance, inclination, phiRef, longAscNodes, eccentricity, meanPerAno, deltaF, f_min, f_max, f_ref, params, approximant);
171 }
172 
173 /** Time domain modes */
174 static int generate_td_modes(
175  SphHarmTimeSeries **hlm,
176  LALDict *params,
177  LALSimInspiralGenerator *myself
178 )
179 {
180  REAL8 phiRef, deltaT, m1, m2, S1x, S1y, S1z, S2x, S2y, S2z, f_min, f_ref, distance;
181  INT4 lmax;
183 
184  /* approximant for this generator */
185  approximant = *(Approximant *)myself->internal_data;
186 
187  XLALSimInspiralParseDictionaryToChooseTDModes(&phiRef, &deltaT, &m1, &m2, &S1x, &S1y, &S1z, &S2x, &S2y, &S2z, &f_min, &f_ref, &distance, &lmax, params);
188 
189  *hlm = XLALSimInspiralChooseTDModes_legacy(phiRef, deltaT, m1, m2, S1x, S1y, S1z, S2x, S2y, S2z, f_min, f_ref, distance, params, lmax, approximant);
190 
191  return 0;
192 }
193 
194 /** Time domain polarizations */
196  REAL8TimeSeries **hplus,
197  REAL8TimeSeries **hcross,
198  LALDict *params,
199  LALSimInspiralGenerator *myself
200 )
201 {
202  REAL8 m1, m2, S1x, S1y, S1z, S2x, S2y, S2z, distance, inclination, phiRef, longAscNodes, eccentricity, meanPerAno, deltaT, f_min, f_ref;
204 
205  /* approximant for this generator */
206  approximant = *(Approximant *)myself->internal_data;
207 
208  /* read parameters needed for ChooseTDWaveform from lal dictionary */
209  XLALSimInspiralParseDictionaryToChooseTDWaveform(&m1, &m2, &S1x, &S1y, &S1z, &S2x, &S2y, &S2z, &distance, &inclination, &phiRef, &longAscNodes, &eccentricity, &meanPerAno, &deltaT, &f_min, &f_ref, params);
210 
211  return XLALSimInspiralChooseTDWaveform_legacy(hplus, hcross, m1, m2, S1x, S1y, S1z, S2x, S2y, S2z, distance, inclination, phiRef, longAscNodes, eccentricity, meanPerAno, deltaT, f_min, f_ref, params, approximant);
212 }
213 
214 /**
215  * Define which methods are supported by every legacy approximant
216  */
217 
218 #define DEFINE_GENERATOR_TEMPLATE(approx, fd_modes, fd_waveform, td_modes, td_waveform) \
219  static Approximant _lal ## approx ## GeneratorInternalData = approx; \
220  const LALSimInspiralGenerator lal ## approx ## GeneratorTemplate = { \
221  .name = #approx, \
222  .initialize = initialize, \
223  .finalize = NULL, \
224  .generate_fd_modes = fd_modes, \
225  .generate_fd_waveform = fd_waveform, \
226  .generate_td_modes = td_modes, \
227  .generate_td_waveform = td_waveform, \
228  .internal_data = &_lal ## approx ## GeneratorInternalData \
229  };
230 
231 /* TD POLARIZATIONS ONLY */
255 
256 /* TD POLARIZATIONS AND MODES ONLY */
275 
276 /* FD POLARIZATIONS ONLY */
301 
302 /* FD POLARIZATIONS AND MODES ONLY */
305 
306 /* TD AND FD POLARIZATIONS ONLY */
324 
325 /* TD POLARIZATIONS AND FD POLARIZATIONS AND MODES ONLY */
331 
332 
333 /**
334  * Copy of the old code of XLALSimInspiralChooseTDWaveform(). The new version of XLALSimInspiralChooseTDWaveform() is just a wrapper over XLALSimInspiralGenerateTDWaveform().
335  * XLALSimInspiralGenerateTDWaveform() internally calls this function for legacy approximants.
336  */
338  REAL8TimeSeries **hplus, /* +-polarization waveform */
339  REAL8TimeSeries **hcross, /* x-polarization waveform */
340  REAL8 m1, /* mass of companion 1 (kg) */
341  REAL8 m2, /* mass of companion 2 (kg) */
342  REAL8 S1x, /* x-component of the dimensionless spin of object 1 */
343  REAL8 S1y, /* y-component of the dimensionless spin of object 1 */
344  REAL8 S1z, /* z-component of the dimensionless spin of object 1 */
345  REAL8 S2x, /* x-component of the dimensionless spin of object 2 */
346  REAL8 S2y, /* y-component of the dimensionless spin of object 2 */
347  REAL8 S2z, /* z-component of the dimensionless spin of object 2 */
348  REAL8 distance, /* distance of source (m) */
349  REAL8 inclination, /* inclination of source (rad) */
350  REAL8 phiRef, /* reference orbital phase (rad) */
351  REAL8 longAscNodes, /* longitude of ascending nodes, degenerate with the polarization angle, Omega in documentation */
352  REAL8 eccentricity, /* eccentrocity at reference epoch */
353  REAL8 meanPerAno, /* mean anomaly of periastron */
354  REAL8 deltaT, /* sampling interval (s) */
355  REAL8 f_min, /* starting GW frequency (Hz) */
356  REAL8 f_ref, /* reference GW frequency (Hz) */
357  LALDict *params, /* LAL dictionary containing accessory parameters */
358  Approximant approximant /* post-Newtonian approximant to use for waveform production */
359 
360 )
361 {
362  REAL8 LNhatx, LNhaty, LNhatz, E1x, E1y, E1z;
363  //REAL8 tmp1, tmp2;
364  int ret;
365  /* N.B. the quadrupole of a spinning compact body labeled by A is
366  * Q_A = - quadparam_A chi_A^2 m_A^3 (see gr-qc/9709032)
367  * where quadparam = 1 for BH ~= 4-8 for NS.
368  * This affects the quadrupole-monopole interaction.
369  */
370  REAL8 v0 = 1.;
371  /* Note: approximant SEOBNRv2T/v4T will by default compute dQuadMon1, dQuadMon2 */
372  /* from TidalLambda1, TidalLambda2 using universal relations, */
373  /* or use the input value if it is present in the dictionary params */
380  /* Tidal parameters to be computed, if required, by universal relations */
381  REAL8 lambda3A_UR = 0.;
382  REAL8 omega2TidalA_UR = 0.;
383  REAL8 omega3TidalA_UR = 0.;
384  REAL8 lambda3B_UR = 0.;
385  REAL8 omega2TidalB_UR = 0.;
386  REAL8 omega3TidalB_UR = 0.;
387  REAL8 quadparam1_UR = 0.;
388  REAL8 quadparam2_UR = 0.;
389 
390  /* General sanity checks that will abort
391  *
392  * If non-GR approximants are added, include them in
393  * XLALSimInspiralApproximantAcceptTestGRParams()
394  */
396  XLALPrintError("XLAL Error - %s: Passed in non-NULL pointer to LALSimInspiralTestGRParam for an approximant that does not use LALSimInspiralTestGRParam\n", __func__);
398  }
399  /* Support variables for precessing wfs */
400  REAL8 incl;
401 
402 
403  /* SEOBNR flag for spin aligned model version. 1 for SEOBNRv1, 2 for SEOBNRv2 */
404  UINT4 SpinAlignedEOBversion;
405  REAL8 spin1x, spin1y, spin1z;
406  REAL8 spin2x, spin2y, spin2z;
407  REAL8 polariz = longAscNodes;
408 
409  /* SEOBNR flag for precessing model version. 3 for SEOBNRv3, 300 for SEOBNRv3_opt, 401 for SEOBNRv4P, 402 for SEOBNRv4PHM */
410  UINT4 PrecEOBversion;
411  REAL8 spin1[3], spin2[3];
412 
413  REAL8 maxamp = 0;
414  INT4 loopi = 0;
415  INT4 maxind = 0;
416 
417  //LIGOTimeGPS epoch = LIGOTIMEGPSZERO;
418 
419  /* General sanity check the input parameters - only give warnings! */
420  if (deltaT > 1.)
421  XLALPrintWarning("XLAL Warning - %s: Large value of deltaT = %e requested.\nPerhaps sample rate and time step size were swapped?\n", __func__, deltaT);
422  if (deltaT < 1. / 16385.)
423  XLALPrintWarning("XLAL Warning - %s: Small value of deltaT = %e requested.\nCheck for errors, this could create very large time series.\n", __func__, deltaT);
424  if (m1 < 0.09 * LAL_MSUN_SI)
425  XLALPrintWarning("XLAL Warning - %s: Small value of m1 = %e (kg) = %e (Msun) requested.\nPerhaps you have a unit conversion error?\n", __func__, m1, m1 / LAL_MSUN_SI);
426  if (m2 < 0.09 * LAL_MSUN_SI)
427  XLALPrintWarning("XLAL Warning - %s: Small value of m2 = %e (kg) = %e (Msun) requested.\nPerhaps you have a unit conversion error?\n", __func__, m2, m2 / LAL_MSUN_SI);
428  if (m1 + m2 > 1000. * LAL_MSUN_SI)
429  XLALPrintWarning("XLAL Warning - %s: Large value of total mass m1+m2 = %e (kg) = %e (Msun) requested.\nSignal not likely to be in band of ground-based detectors.\n", __func__, m1 + m2, (m1 + m2) / LAL_MSUN_SI);
430  if (S1x * S1x + S1y * S1y + S1z * S1z > 1.000001)
431  XLALPrintWarning("XLAL Warning - %s: S1 = (%e,%e,%e) with norm > 1 requested.\nAre you sure you want to violate the Kerr bound?\n", __func__, S1x, S1y, S1z);
432  if (S2x * S2x + S2y * S2y + S2z * S2z > 1.000001)
433  XLALPrintWarning("XLAL Warning - %s: S2 = (%e,%e,%e) with norm > 1 requested.\nAre you sure you want to violate the Kerr bound?\n", __func__, S2x, S2y, S2z);
434  if (f_min < 1.)
435  XLALPrintWarning("XLAL Warning - %s: Small value of fmin = %e requested.\nCheck for errors, this could create a very long waveform.\n", __func__, f_min);
436  if (f_min > 40.000001)
437  XLALPrintWarning("XLAL Warning - %s: Large value of fmin = %e requested.\nCheck for errors, the signal will start in band.\n", __func__, f_min);
438 
439  /* adjust the reference frequency for certain precessing approximants:
440  * if that approximate interprets f_ref==0 to be f_min, set f_ref=f_min;
441  * otherwise do nothing */
443 
444  switch (approximant) {
445  /* non-spinning inspiral-only models */
446  case TaylorEt:
447  /* Waveform-specific sanity checks */
449  XLAL_ERROR(XLAL_EINVAL, "Non-default flags given, but this approximant does not support this case.");
450  if (!checkSpinsZero(S1x, S1y, S1z, S2x, S2y, S2z))
451  XLAL_ERROR(XLAL_EINVAL, "Non-zero spins were given, but this is a non-spinning approximant.");
452  if (!checkTidesZero(lambda1, lambda2))
453  XLAL_ERROR(XLAL_EINVAL, "Non-zero tidal parameters were given, but this is approximant doe not have tidal corrections.");
454  if (f_ref != 0.)
455  XLALPrintWarning("XLAL Warning - %s: This approximant does use f_ref. The reference phase will be defined at coalescence.\n", __func__);
456  /* Call the waveform driver routine */
457  ret = XLALSimInspiralTaylorEtPNGenerator(hplus, hcross, phiRef, v0, deltaT, m1, m2, f_min, distance, inclination, amplitudeO, phaseO);
458  break;
459 
460  case TaylorT1:
461  /* Waveform-specific sanity checks */
463  XLAL_ERROR(XLAL_EINVAL, "Non-default LALSimInspiralFrameAxis provided, but this approximant does not use that flag.");
465  XLAL_ERROR(XLAL_EINVAL, "Non-default LALSimInspiralModesChoice provided, but this approximant does not use that flag.");
467  XLAL_ERROR(XLAL_EINVAL, "Non-default LALSimInspiralSpinOrder provided, but this approximant does not use that flag.");
468  if (!checkSpinsZero(S1x, S1y, S1z, S2x, S2y, S2z))
469  XLAL_ERROR(XLAL_EINVAL, "Non-zero spins were given, but this is a non-spinning approximant.");
470  /* Call the waveform driver routine */
471  ret = XLALSimInspiralTaylorT1PNGenerator(hplus, hcross, phiRef, v0, deltaT, m1, m2, f_min, f_ref, distance, inclination, lambda1, lambda2, XLALSimInspiralWaveformParamsLookupPNTidalOrder(params), amplitudeO, phaseO);
472  break;
473 
474  case TaylorT2:
475  /* Waveform-specific sanity checks */
477  XLAL_ERROR(XLAL_EINVAL, "Non-default LALSimInspiralFrameAxis provided, but this approximant does not use that flag.");
479  XLAL_ERROR(XLAL_EINVAL, "Non-default LALSimInspiralModesChoice provided, but this approximant does not use that flag.");
481  XLAL_ERROR(XLAL_EINVAL, "Non-default LALSimInspiralSpinOrder provided, but this approximant does not use that flag.");
482  if (!checkSpinsZero(S1x, S1y, S1z, S2x, S2y, S2z))
483  XLAL_ERROR(XLAL_EINVAL, "Non-zero spins were given, but this is a non-spinning approximant.");
484  /* Call the waveform driver routine */
485  ret = XLALSimInspiralTaylorT2PNGenerator(hplus, hcross, phiRef, v0, deltaT, m1, m2, f_min, f_ref, distance, inclination, lambda1, lambda2, XLALSimInspiralWaveformParamsLookupPNTidalOrder(params), amplitudeO, phaseO);
486  break;
487 
488  case TaylorT3:
489  /* Waveform-specific sanity checks */
491  XLAL_ERROR(XLAL_EINVAL, "Non-default LALSimInspiralFrameAxis provided, but this approximant does not use that flag.");
493  XLAL_ERROR(XLAL_EINVAL, "Non-default LALSimInspiralModesChoice provided, but this approximant does not use that flag.");
495  XLAL_ERROR(XLAL_EINVAL, "Non-default LALSimInspiralSpinOrder provided, but this approximant does not use that flag.");
496  if (!checkSpinsZero(S1x, S1y, S1z, S2x, S2y, S2z))
497  XLAL_ERROR(XLAL_EINVAL, "Non-zero spins were given, but this is a non-spinning approximant.");
498  /* Call the waveform driver routine */
499  ret = XLALSimInspiralTaylorT3PNGenerator(hplus, hcross, phiRef, v0, deltaT, m1, m2, f_min, f_ref, distance, inclination, lambda1, lambda2, XLALSimInspiralWaveformParamsLookupPNTidalOrder(params), amplitudeO, phaseO);
500  break;
501 
502  case TaylorT4:
503  /* Waveform-specific sanity checks */
505  XLAL_ERROR(XLAL_EINVAL, "Non-default LALSimInspiralFrameAxis provided, but this approximant does not use that flag.");
507  XLAL_ERROR(XLAL_EINVAL, "Non-default LALSimInspiralModesChoice provided, but this approximant does not use that flag.");
509  XLAL_ERROR(XLAL_EINVAL, "Non-default LALSimInspiralSpinOrder provided, but this approximant does not use that flag.");
510  if (!checkSpinsZero(S1x, S1y, S1z, S2x, S2y, S2z))
511  XLAL_ERROR(XLAL_EINVAL, "Non-zero spins were given, but this is a non-spinning approximant.");
512  /* Call the waveform driver routine */
513  ret = XLALSimInspiralTaylorT4PNGenerator(hplus, hcross, phiRef, v0, deltaT, m1, m2, f_min, f_ref, distance, inclination, lambda1, lambda2, XLALSimInspiralWaveformParamsLookupPNTidalOrder(params), amplitudeO, phaseO);
514  break;
515 
516  case TEOBResum_ROM:
517  /* Waveform-specific sanity checks */
519  XLAL_ERROR(XLAL_EINVAL, "Non-default LALSimInspiralFrameAxis provided, but this approximant does not use that flag.");
521  XLAL_ERROR(XLAL_EINVAL, "Non-default LALSimInspiralModesChoice provided, but this approximant does not use that flag.");
523  XLAL_ERROR(XLAL_EINVAL, "Non-default LALSimInspiralSpinOrder provided, but this approximant does not use that flag.");
524  if (!checkSpinsZero(S1x, S1y, S1z, S2x, S2y, S2z))
525  XLAL_ERROR(XLAL_EINVAL, "Non-zero spins were given, but this is a non-spinning approximant.");
526  /* Call the waveform driver routine */
527  ret = XLALSimInspiralTEOBResumROM(hplus, hcross, phiRef, deltaT, f_min, f_ref, distance, inclination, m1, m2, lambda1, lambda2);
528  break;
529 
530  case TEOBResumS:
531  /* Waveform-specific sanity checks */
533  XLAL_ERROR(XLAL_EINVAL, "Non-default LALSimInspiralFrameAxis provided, but this approximant does not use that flag.");
535  XLAL_ERROR(XLAL_EINVAL, "Non-default LALSimInspiralSpinOrder provided, but this approximant does not use that flag.");
536  if (!checkTransverseSpinsZero(S1x, S1y, S2x, S2y))
537  XLAL_ERROR(XLAL_EINVAL, "Non-zero transverse spins were given, but this is a non-precessing approximant.");
538  if (f_ref != 0.)
539  XLALPrintWarning("XLAL Warning - %s: This approximant does not use f_ref. The reference phase will be defined at coalescence.\n", __func__);
540  /* Comply with master convention on orientation angles */
541  polariz += LAL_PI_2;
542  /* Call the waveform driver routine */
543  // MA: TODO if( something about modes choice )
544 
545  /* Make sure params exists (otherwise segfault) */
546  if (!params)
548  ret = XLALSimIMRTEOBResumS(hplus, hcross, phiRef, deltaT, m1, m2, S1x, S1y, S1z, S2x, S2y, S2z, lambda1, lambda2, distance, inclination, longAscNodes, params, eccentricity, meanPerAno, f_min, f_ref);
549  break;
550 
551 
552  case EccentricTD:
553  /* Waveform-specific sanity checks */
555  XLAL_ERROR(XLAL_EINVAL, "Non-default LALSimInspiralFrameAxis provided, but this approximant does not use that flag.");
557  XLAL_ERROR(XLAL_EINVAL, "Non-default LALSimInspiralModesChoice provided, but this approximant does not use that flag.");
559  XLAL_ERROR(XLAL_EINVAL, "Non-default LALSimInspiralSpinOrder provided, but this approximant does not use that flag.");
560  if (!checkSpinsZero(S1x, S1y, S1z, S2x, S2y, S2z))
561  XLAL_ERROR(XLAL_EINVAL, "Non-zero spins were given, but this is a non-spinning approximant.");
562  if (!checkTidesZero(lambda1, lambda2))
563  XLAL_ERROR(XLAL_EINVAL, "Non-zero tidal parameters were given, but this is approximant doe not have tidal corrections.");
564  /* Call the waveform driver routine */
565  ret = XLALSimInspiralEccentricTDPNGenerator(hplus, hcross, phiRef, deltaT, m1, m2, f_min, f_ref, distance, inclination, eccentricity, amplitudeO, phaseO);
566  if (ret == XLAL_FAILURE)
568  break;
569 
570  /* non-spinning inspiral-merger-ringdown models */
571  case IMRPhenomA:
572  /* Waveform-specific sanity checks */
574  XLAL_ERROR(XLAL_EINVAL, "Non-default flags given, but this approximant does not support this case.");
575  if (!checkSpinsZero(S1x, S1y, S1z, S2x, S2y, S2z))
576  XLAL_ERROR(XLAL_EINVAL, "Non-zero spins were given, but this is a non-spinning approximant.");
577  if (!checkTidesZero(lambda1, lambda2))
578  XLAL_ERROR(XLAL_EINVAL, "Non-zero tidal parameters were given, but this is approximant doe not have tidal corrections.");
579  if (f_ref != 0.)
580  XLALPrintWarning("XLAL Warning - %s: This approximant does use f_ref. The reference phase will be defined at coalescence.\n", __func__);
581  /* Call the waveform driver routine */
582  // NB: f_max = 0 will generate up to the ringdown cut-off frequency
583  ret = XLALSimIMRPhenomAGenerateTD(hplus, hcross, phiRef, deltaT, m1, m2, f_min, 0., distance, inclination);
584  break;
585 
586  case EOBNRv2HM:
587  /* Waveform-specific sanity checks */
589  XLAL_ERROR(XLAL_EINVAL, "Non-default flags given, but this approximant does not support this case.");
590  if (!checkSpinsZero(S1x, S1y, S1z, S2x, S2y, S2z))
591  XLAL_ERROR(XLAL_EINVAL, "Non-zero spins were given, but this is a non-spinning approximant.");
592  if (!checkTidesZero(lambda1, lambda2))
593  XLAL_ERROR(XLAL_EINVAL, "Non-zero tidal parameters were given, but this is approximant doe not have tidal corrections.");
594  if (f_ref != 0.)
595  XLALPrintWarning("XLAL Warning - %s: This approximant does use f_ref. The reference phase will be defined at coalescence.\n", __func__);
596  /* Call the waveform driver routine */
597  // FIXME: need to create a function to take in different modes or produce an error if all modes not given
598  ret = XLALSimIMREOBNRv2AllModes(hplus, hcross, phiRef, deltaT, m1, m2, f_min, distance, inclination);
599  break;
600 
601  case EOBNRv2:
602  /* Waveform-specific sanity checks */
604  XLAL_ERROR(XLAL_EINVAL, "Non-default flags given, but this approximant does not support this case.");
605  if (!checkSpinsZero(S1x, S1y, S1z, S2x, S2y, S2z))
606  XLAL_ERROR(XLAL_EINVAL, "Non-zero spins were given, but this is a non-spinning approximant.");
607  if (!checkTidesZero(lambda1, lambda2))
608  XLAL_ERROR(XLAL_EINVAL, "Non-zero tidal parameters were given, but this is approximant doe not have tidal corrections.");
609  if (f_ref != 0.)
610  XLALPrintWarning("XLAL Warning - %s: This approximant does use f_ref. The reference phase will be defined at coalescence.\n", __func__);
611  /* Call the waveform driver routine */
612  ret = XLALSimIMREOBNRv2DominantMode(hplus, hcross, phiRef, deltaT, m1, m2, f_min, distance, inclination);
613  break;
614 
615  /* spinning inspiral-only models */
616  case SpinTaylorT5:
617  /* Waveform-specific sanity checks */
618  //if( !checkTransverseSpinsZero(S1x, S1y, S2x, S2y) && (XLALSimInspiralWaveformParamsLookupPNSpinOrder(params)>5) )
619  //XLAL_ERROR(XLAL_EINVAL, "Non-zero transverse spins were given with spinOrder %d, but this spins dynamics is not implemented to this order for precessing spins.", XLALSimInspiralWaveformParamsLookupPNSpinOrder);
620  XLALSimInspiralInitialConditionsPrecessingApproxs(&incl, &spin1x, &spin1y, &spin1z, &spin2x, &spin2y, &spin2z, inclination, S1x, S1y, S1z, S2x, S2y, S2z, m1, m2, f_ref, phiRef, XLALSimInspiralWaveformParamsLookupFrameAxis(params));
621  LNhatx = sin(incl);
622  LNhaty = 0.;
623  LNhatz = cos(incl);
624  E1x = 0.;
625  E1y = 1.;
626  E1z = 0.;
627  polariz += LAL_PI / 2.;
628  /* Call the waveform driver routine */
629  ret = XLALSimInspiralSpinTaylorT5(hplus, hcross, phiRef, deltaT, m1, m2, f_min, f_ref, distance, spin1x, spin1y, spin1z, spin2x, spin2y, spin2z, LNhatx, LNhaty, LNhatz, E1x, E1y, E1z, params);
630  break;
631 
632  // need to make a consistent choice for SpinTaylorT4 and PSpinInspiralRD waveform inputs
633  // proposal: TotalJ frame of PSpinInspiralRD
634  // inclination denotes the angle between the view direction
635  // and J (J is constant during the evolution, J//z, both N and initial
636  // L are in the x-z plane) and the spin coordinates are given wrt
637  // initial ** L **.
638  case SpinTaylorT4:
639  /* Waveform-specific sanity checks */
640  //if( !checkTransverseSpinsZero(S1x, S1y, S2x, S2y) && (XLALSimInspiralWaveformParamsLookupPNSpinOrder(params)>5) )
641  // XLAL_ERROR(XLAL_EINVAL, "Non-zero transverse spins were given with spinOrder %d, but this spins dynamics is not implemented to this order for precessing spins.", XLALSimInspiralWaveformParamsLookupPNSpinOrder);
642  XLALSimInspiralInitialConditionsPrecessingApproxs(&incl, &spin1x, &spin1y, &spin1z, &spin2x, &spin2y, &spin2z, inclination, S1x, S1y, S1z, S2x, S2y, S2z, m1, m2, f_ref, phiRef, XLALSimInspiralWaveformParamsLookupFrameAxis(params));
643  LNhatx = sin(incl);
644  LNhaty = 0.;
645  LNhatz = cos(incl);
646  E1x = 0.;
647  E1y = 1.;
648  E1z = 0.;
649  polariz += LAL_PI / 2.;
650  /* Call the waveform driver routine */
651  ret = XLALSimInspiralSpinTaylorT4(hplus, hcross, phiRef, deltaT, m1, m2, f_min, f_ref, distance, spin1x, spin1y, spin1z, spin2x, spin2y, spin2z, LNhatx, LNhaty, LNhatz, E1x, E1y, E1z, params);
652  break;
653 
654  case SpinTaylorT1:
655  /* Waveform-specific sanity checks */
656  /* Waveform-specific sanity checks */
657  //if( !checkTransverseSpinsZero(S1x, S1y, S2x, S2y) && (XLALSimInspiralWaveformParamsLookupPNSpinOrder(params)>5) )
658  // XLAL_ERROR(XLAL_EINVAL, "Non-zero transverse spins were given with spinOrder %d, but this spins dynamics is not implemented to this order for precessing spins.", XLALSimInspiralWaveformParamsLookupPNSpinOrder);
659  XLALSimInspiralInitialConditionsPrecessingApproxs(&incl, &spin1x, &spin1y, &spin1z, &spin2x, &spin2y, &spin2z, inclination, S1x, S1y, S1z, S2x, S2y, S2z, m1, m2, f_ref, phiRef, XLALSimInspiralWaveformParamsLookupFrameAxis(params));
660  LNhatx = sin(incl);
661  LNhaty = 0.;
662  LNhatz = cos(incl);
663  E1x = 0.;
664  E1y = 1.;
665  E1z = 0.;
666  polariz += LAL_PI / 2.;
667  /* Call the waveform driver routine */
668  ret = XLALSimInspiralSpinTaylorT1(hplus, hcross, phiRef, deltaT, m1, m2, f_min, f_ref, distance, spin1x, spin1y, spin1z, spin2x, spin2y, spin2z, LNhatx, LNhaty, LNhatz, E1x, E1y, E1z, params);
669  break;
670 
671  case SpinDominatedWf:
672  // waveform specific sanity checks
673  if (S2x != 0. || S2y != 0. || S2z != 0.) {
674  XLALPrintError("XLAL Error : The spindominatedwf approximant is only for 1 spin case.\n");
676  }
677  /*Maximal PN amplitude order is 1.5, maximal phase order is 2 PN */
678  if (amplitudeO > 3) {
679  XLALPrintError("XLAL Error : Foe the spindominatedwf approximant maximal amplitude correction is 1.5 PN\n");
681  }
682  if (phaseO > 4) {
683  XLALPrintError("XLAL Error : For the spindominatedwf approximant maximal phase correction is 2 PN\n");
685  }
686  incl = inclination;
687  LNhatx = 0.;
688  LNhaty = 0.;
689  LNhatz = 1.;
690  /* Call the waveform driver routine */
691  ret = XLALSimInspiralSpinDominatedWaveformInterfaceTD(hplus, hcross, deltaT, m1, m2, f_min, f_ref, distance, S1x, S1y, S1z, LNhatx, LNhaty, LNhatz, incl, phaseO, amplitudeO, phiRef);
692  break;
693 
694  /* spin aligned inspiral-merger-ringdown models */
695  case IMRPhenomB:
696  /* Waveform-specific sanity checks */
698  XLAL_ERROR(XLAL_EINVAL, "Non-default flags given, but this approximant does not support this case.");
699  if (!checkTransverseSpinsZero(S1x, S1y, S2x, S2y))
700  XLAL_ERROR(XLAL_EINVAL, "Non-zero transverse spins were given, but this is a non-precessing approximant.");
701  if (!checkTidesZero(lambda1, lambda2))
702  XLAL_ERROR(XLAL_EINVAL, "Non-zero tidal parameters were given, but this is approximant doe not have tidal corrections.");
703  if (f_ref != 0.)
704  XLALPrintWarning("XLAL Warning - %s: This approximant does use f_ref. The reference phase will be defined at coalescence.\n", __func__);
705  /* Call the waveform driver routine */
706  // NB: f_max = 0 will generate up to the ringdown cut-off frequency
707  ret = XLALSimIMRPhenomBGenerateTD(hplus, hcross, phiRef, deltaT, m1, m2, XLALSimIMRPhenomBComputeChi(m1, m2, S1z, S2z), f_min, 0., distance, inclination);
708  break;
709 
710  case PhenSpinTaylor:
711  /* Waveform-specific sanity checks */
712 
713  /* Call the waveform driver routine */
714  XLALSimInspiralInitialConditionsPrecessingApproxs(&incl, &spin1x, &spin1y, &spin1z, &spin2x, &spin2y, &spin2z, inclination, S1x, S1y, S1z, S2x, S2y, S2z, m1, m2, f_ref, phiRef, XLALSimInspiralWaveformParamsLookupFrameAxis(params));
715  polariz += LAL_PI / 2.;
716 
717  ret = XLALSimSpinInspiralGenerator(hplus, hcross, phiRef, deltaT, m1, m2, f_min, f_ref, distance, incl, spin1x, spin1y, spin1z, spin2x, spin2y, spin2z, phaseO, amplitudeO, lambda1, lambda2, quadparam1, quadparam2, params);
718  break;
719 
720  case IMRPhenomC:
721  /* Waveform-specific sanity checks */
723  XLAL_ERROR(XLAL_EINVAL, "Non-default flags given, but this approximant does not support this case.");
724  if (!checkTransverseSpinsZero(S1x, S1y, S2x, S2y))
725  XLAL_ERROR(XLAL_EINVAL, "Non-zero transverse spins were given, but this is a non-precessing approximant.");
726  if (!checkTidesZero(lambda1, lambda2))
727  XLAL_ERROR(XLAL_EINVAL, "Non-zero tidal parameters were given, but this is approximant doe not have tidal corrections.");
728  if (f_ref != 0.)
729  XLALPrintWarning("XLAL Warning - %s: This approximant does use f_ref. The reference phase will be defined at coalescence.\n", __func__);
730  /* Call the waveform driver routine */
731  // NB: f_max = 0 will generate up to the ringdown cut-off frequency
732  ret = XLALSimIMRPhenomCGenerateTD(hplus, hcross, phiRef, deltaT, m1, m2, XLALSimIMRPhenomBComputeChi(m1, m2, S1z, S2z), f_min, 0., distance, inclination, params);
733  break;
734 
735  case IMRPhenomD:
737  XLAL_ERROR(XLAL_EINVAL, "Non-default flags given, but this approximant does not support this case.");
738  if (!checkTransverseSpinsZero(S1x, S1y, S2x, S2y))
739  XLAL_ERROR(XLAL_EINVAL, "Non-zero transverse spins were given, but this is a non-precessing approximant.");
740  if (!checkTidesZero(lambda1, lambda2))
741  XLAL_ERROR(XLAL_EINVAL, "Non-zero tidal parameters were given, but this is approximant doe not have tidal corrections.");
742  // generate TD waveforms with zero inclincation so that amplitude can be
743  // calculated from hplus and hcross, apply inclination-dependent factors
744  // in loop below
745  ret = XLALSimInspiralTDFromFD(hplus, hcross, m1, m2, S1x, S1y, S1z, S2x, S2y, S2z, distance, 0., phiRef, longAscNodes, eccentricity, meanPerAno, deltaT, f_min, f_ref, params, approximant);
746  maxamp = 0;
747  REAL8TimeSeries *hp = *hplus;
748  REAL8TimeSeries *hc = *hcross;
749  maxind = hp->data->length - 1;
750  const REAL8 cfac = cos(inclination);
751  const REAL8 pfac = 0.5 * (1. + cfac * cfac);
752  for (loopi = hp->data->length - 1; loopi > -1; loopi--) {
753  REAL8 ampsqr = (hp->data->data[loopi]) * (hp->data->data[loopi]) + (hc->data->data[loopi]) * (hc->data->data[loopi]);
754  if (ampsqr > maxamp) {
755  maxind = loopi;
756  maxamp = ampsqr;
757  }
758  hp->data->data[loopi] *= pfac;
759  hc->data->data[loopi] *= cfac;
760  }
761  XLALGPSSetREAL8(&(hp->epoch), (-1.) * deltaT * maxind);
762  XLALGPSSetREAL8(&(hc->epoch), (-1.) * deltaT * maxind);
763  break;
764 
765  case IMRPhenomHM:
767  XLAL_ERROR(XLAL_EINVAL, "Non-default flags given, but this approximant does not support this case.");
768  if (!checkTransverseSpinsZero(S1x, S1y, S2x, S2y))
769  XLAL_ERROR(XLAL_EINVAL, "Non-zero transverse spins were given, but this is a non-precessing approximant.");
770  if (!checkTidesZero(lambda1, lambda2))
771  XLAL_ERROR(XLAL_EINVAL, "Non-zero tidal parameters were given, but this is approximant doe not have tidal corrections.");
772 
773  ret = XLALSimInspiralTDFromFD(hplus, hcross, m1, m2, S1x, S1y, S1z, S2x, S2y, S2z, distance, inclination, phiRef, longAscNodes, eccentricity, meanPerAno, deltaT, f_min, f_ref, params, approximant);
774  /*
775  * NOTE: We enforce that the hp**2 + hx**2 peaks at t=0
776  * see the wiki page from phenomHM review
777  * https://git.ligo.org/waveforms/reviews/phenomhm/wikis/time-domain-behaviour
778  */
779  maxamp = 0;
780  maxind = (*hplus)->data->length - 1;
781  for (loopi = (*hplus)->data->length - 1; loopi > -1; loopi--) {
782  REAL8 ampsqr = ((*hplus)->data->data[loopi]) * ((*hplus)->data->data[loopi]) + ((*hcross)->data->data[loopi]) * ((*hcross)->data->data[loopi]);
783  if (ampsqr > maxamp) {
784  maxind = loopi;
785  maxamp = ampsqr;
786  }
787  }
788  XLALGPSSetREAL8(&((*hplus)->epoch), (-1.) * deltaT * maxind);
789  XLALGPSSetREAL8(&((*hcross)->epoch), (-1.) * deltaT * maxind);
790  break;
791 
792  case IMRPhenomPv2:
793  ret = XLALSimInspiralTDFromFD(hplus, hcross, m1, m2, S1x, S1y, S1z, S2x, S2y, S2z, distance, inclination, phiRef, longAscNodes, eccentricity, meanPerAno, deltaT, f_min, f_ref, params, approximant);
794  break;
795 
796  case IMRPhenomPv3:
797  ret = XLALSimInspiralTDFromFD(hplus, hcross, m1, m2, S1x, S1y, S1z, S2x, S2y, S2z, distance, inclination, phiRef, longAscNodes, eccentricity, meanPerAno, deltaT, f_min, f_ref, params, approximant);
798  break;
799 
800  case IMRPhenomPv3HM:
801  ret = XLALSimInspiralTDFromFD(hplus, hcross, m1, m2, S1x, S1y, S1z, S2x, S2y, S2z, distance, inclination, phiRef, longAscNodes, eccentricity, meanPerAno, deltaT, f_min, f_ref, params, approximant);
802  break;
803 
805  ret = XLALSimInspiralTDFromFD(hplus, hcross, m1, m2, S1x, S1y, S1z, S2x, S2y, S2z, distance, inclination, phiRef, longAscNodes, eccentricity, meanPerAno, deltaT, f_min, f_ref, params, approximant);
806  break;
807 
809  ret = XLALSimInspiralTDFromFD(hplus, hcross, m1, m2, S1x, S1y, S1z, S2x, S2y, S2z, distance, inclination, phiRef, longAscNodes, eccentricity, meanPerAno, deltaT, f_min, f_ref, params, approximant);
810  break;
811 
813  ret = XLALSimInspiralTDFromFD(hplus, hcross, m1, m2, S1x, S1y, S1z, S2x, S2y, S2z, distance, inclination, phiRef, longAscNodes, eccentricity, meanPerAno, deltaT, f_min, f_ref, params, approximant);
814  break;
815 
817  ret = XLALSimInspiralTDFromFD(hplus, hcross, m1, m2, S1x, S1y, S1z, S2x, S2y, S2z, distance, inclination, phiRef, longAscNodes, eccentricity, meanPerAno, deltaT, f_min, f_ref, params, approximant);
818  break;
819 
820  case IMRPhenomNSBH:
821  ret = XLALSimInspiralTDFromFD(hplus, hcross, m1, m2, S1x, S1y, S1z, S2x, S2y, S2z, distance, inclination, phiRef, longAscNodes, eccentricity, meanPerAno, deltaT, f_min, f_ref, params, approximant);
822  break;
823 
825  ret = XLALSimInspiralTDFromFD(hplus, hcross, m1, m2, S1x, S1y, S1z, S2x, S2y, S2z, distance, inclination, phiRef, longAscNodes, eccentricity, meanPerAno, deltaT, f_min, f_ref, params, approximant);
826  break;
827 
828  case SEOBNRv5HM_ROM:
829  ret = XLALSimInspiralTDFromFD(hplus, hcross, m1, m2, S1x, S1y, S1z, S2x, S2y, S2z, distance, inclination, phiRef, longAscNodes, eccentricity, meanPerAno, deltaT, f_min, f_ref, params, approximant);
830  break;
831 
832  case PhenSpinTaylorRD:
833  /* Waveform-specific sanity checks */
834  if (!checkTidesZero(lambda1, lambda2))
835  XLAL_ERROR(XLAL_EINVAL, "Non-zero tidal parameters were given, but this is approximant doe not have tidal corrections.");
836  if (f_ref != 0.)
837  XLALPrintWarning("XLAL Warning - %s: This approximant does use f_ref. The reference phase will be defined at the start.\n", __func__);
838  /* Call the waveform driver routine */
839  XLALSimInspiralInitialConditionsPrecessingApproxs(&incl, &spin1x, &spin1y, &spin1z, &spin2x, &spin2y, &spin2z, inclination, S1x, S1y, S1z, S2x, S2y, S2z, m1, m2, f_ref, phiRef, XLALSimInspiralWaveformParamsLookupFrameAxis(params));
840  polariz += LAL_PI / 2.;
841  ret = XLALSimIMRPhenSpinInspiralRDGenerator(hplus, hcross, phiRef, deltaT, m1, m2, f_min, f_ref, distance, incl, spin1x, spin1y, spin1z, spin2x, spin2y, spin2z, phaseO, amplitudeO, lambda1, lambda2, quadparam1, quadparam2, params);
842  break;
843 
844  case SEOBNRv1:
845  case SEOBNRv2_opt:
846  case SEOBNRv2:
847  case SEOBNRv4_opt:
848  case SEOBNRv4:
849  case SEOBNRv4HM:
850  /* Waveform-specific sanity checks */
852  XLAL_ERROR(XLAL_EINVAL, "Non-default flags given, but this approximant does not support this case.");
853  if (!checkTransverseSpinsZero(S1x, S1y, S2x, S2y))
854  XLAL_ERROR(XLAL_EINVAL, "Non-zero transverse spins were given, but this is a non-precessing approximant.");
855  if (!checkTidesZero(lambda1, lambda2))
856  XLAL_ERROR(XLAL_EINVAL, "Non-zero tidal parameters were given, but this is approximant doe not have tidal corrections.");
857  if (f_ref != 0.)
858  XLALPrintWarning("XLAL Warning - %s: This approximant does not use f_ref. The reference phase will be defined at coalescence.\n", __func__);
859  /* Call the waveform driver routine */
860  polariz += -LAL_PI / 2.;
861  //R.C. this rotation of -pi/2 is needed to go from the EOB wave frame to the LAL wave frame, see slide 9 of https://git.ligo.org/waveforms/reviews/SEOBNRv4HM/blob/master/tests/conventions/conventions.pdf
862  if (approximant == SEOBNRv1)
863  SpinAlignedEOBversion = 1;
864  if (approximant == SEOBNRv2)
865  SpinAlignedEOBversion = 2;
866  if (approximant == SEOBNRv2_opt)
867  SpinAlignedEOBversion = 200;
868  if (approximant == SEOBNRv4)
869  SpinAlignedEOBversion = 4;
870  if (approximant == SEOBNRv4_opt)
871  SpinAlignedEOBversion = 400;
872  if (approximant == SEOBNRv4HM)
873  SpinAlignedEOBversion = 41;
874  ret = XLALSimIMRSpinAlignedEOBWaveform(hplus, hcross, phiRef, deltaT, m1, m2, f_min, distance, inclination, S1z, S2z, SpinAlignedEOBversion, params);
875  break;
876 
877  case SEOBNRv4HM_PA:
878  case pSEOBNRv4HM_PA:
880  XLAL_ERROR(XLAL_EINVAL, "Non-default flags given, but this approximant does not support this case.");
881  if( !checkTransverseSpinsZero(S1x, S1y, S2x, S2y) )
882  XLAL_ERROR(XLAL_EINVAL, "Non-zero transverse spins were given, but this is a non-precessing approximant.");
883  if( !checkTidesZero(lambda1, lambda2) )
884  XLAL_ERROR(XLAL_EINVAL, "Non-zero tidal parameters were given, but this is approximant does not have tidal corrections.");
885  if( f_ref != 0.)
886  XLALPrintWarning("XLAL Warning - %s: This approximant does not use f_ref. The reference phase will be defined at coalescence.\n", __func__);
887  /* Call the waveform driver routine */
888  polariz+=-LAL_PI/2.;
889  //R.C. this rotation of -pi/2 is needed to go from the EOB wave frame to the LAL wave frame, see slide 9 of https://git.ligo.org/waveforms/reviews/SEOBNRv4HM/blob/master/tests/conventions/con \ventions.pdf
890  if(approximant == SEOBNRv4HM_PA) SpinAlignedEOBversion = 4111;
891  if(approximant == pSEOBNRv4HM_PA) SpinAlignedEOBversion = 4112;
892 
894  hplus, hcross,
895  phiRef, deltaT,
896  m1, m2,
897  f_min,
898  distance, inclination,
899  S1z, S2z,
900  SpinAlignedEOBversion, params
901  );
902  break;
903 
904  case SEOBNRv3_opt_rk4:
905  case SEOBNRv3_opt:
906  case SEOBNRv3_pert:
907  case SEOBNRv3:
908  /* Waveform-specific sanity checks */
910  XLAL_ERROR(XLAL_EINVAL, "Non-default flags given, but this approximant does not support this case.");
911  if (!checkTidesZero(lambda1, lambda2))
912  XLAL_ERROR(XLAL_EINVAL, "Non-zero tidal parameters were given, but this is approximant doe not have tidal corrections.");
913  if (f_ref != 0.)
914  XLALPrintWarning("XLAL Warning - %s: This approximant does use f_ref. The reference phase will be defined at coalescence.\n", __func__);
915  /* Call the waveform driver routine */
916  //REAL8 spin1[3], spin2[3];
917  spin1[0] = S1x;
918  spin1[1] = S1y;
919  spin1[2] = S1z;
920  spin2[0] = S2x;
921  spin2[1] = S2y;
922  spin2[2] = S2z;
923  polariz += -LAL_PI / 2.;
924  PrecEOBversion = 3;
925  if (approximant == SEOBNRv3_pert) {
926  const double m1pert = m1 * (1.0 + 1e-15);
927  ret = XLALSimIMRSpinEOBWaveform(hplus, hcross, /*&epoch, */ phiRef,
928  deltaT, m1pert, m2, f_min, distance, inclination, spin1, spin2, PrecEOBversion);
929 
930  } else {
931  if (approximant == SEOBNRv3_opt)
932  PrecEOBversion = 300;
934  PrecEOBversion = 304;
935  ret = XLALSimIMRSpinEOBWaveform(hplus, hcross, /*&epoch, */ phiRef,
936  deltaT, m1, m2, f_min, distance, inclination, spin1, spin2, PrecEOBversion);
937  }
938  break;
939 
940  case SEOBNRv4P:
941  /* Waveform-specific sanity checks */
943  XLAL_ERROR(XLAL_EINVAL, "Non-default flags given, but this approximant does not support this case.");
944  if (!checkTidesZero(lambda1, lambda2))
945  XLAL_ERROR(XLAL_EINVAL, "Non-zero tidal parameters were given, but this is approximant doe not have tidal corrections.");
946  if (f_ref != 0.)
947  XLALPrintWarning("XLAL Warning - %s: This approximant does use f_ref. The reference phase will be defined at coalescence.\n", __func__);
948 
949  spin1[0] = S1x;
950  spin1[1] = S1y;
951  spin1[2] = S1z;
952  spin2[0] = S2x;
953  spin2[1] = S2y;
954  spin2[2] = S2z;
955  polariz += -LAL_PI / 2.;
956  PrecEOBversion = 401;
957  ret = XLALSimIMRSpinPrecEOBWaveform(hplus, hcross, phiRef, deltaT, m1, m2, f_min, distance, inclination, spin1, spin2, PrecEOBversion, params);
958  break;
959  case SEOBNRv4PHM:
960  /* Waveform-specific sanity checks */
962  XLAL_ERROR(XLAL_EINVAL, "Non-default flags given, but this approximant does not support this case.");
963  if (!checkTidesZero(lambda1, lambda2))
964  XLAL_ERROR(XLAL_EINVAL, "Non-zero tidal parameters were given, but this is approximant doe not have tidal corrections.");
965  if (f_ref != 0.)
966  XLALPrintWarning("XLAL Warning - %s: This approximant does use f_ref. The reference phase will be defined at coalescence.\n", __func__);
967 
968  spin1[0] = S1x;
969  spin1[1] = S1y;
970  spin1[2] = S1z;
971  spin2[0] = S2x;
972  spin2[1] = S2y;
973  spin2[2] = S2z;
974  polariz += -LAL_PI / 2.;
975  PrecEOBversion = 402;
976  ret = XLALSimIMRSpinPrecEOBWaveform(hplus, hcross, phiRef, deltaT, m1, m2, f_min, distance, inclination, spin1, spin2, PrecEOBversion, params);
977  break;
978 
979  case SEOBNRv2T:
980  case SEOBNRv4T:
981  /* Waveform-specific sanity checks */
983  XLAL_ERROR(XLAL_EINVAL, "Non-default flags given, but this approximant does not support this case.");
984  if (!checkTransverseSpinsZero(S1x, S1y, S2x, S2y))
985  XLAL_ERROR(XLAL_EINVAL, "Non-zero transverse spins were given, but this is a non-precessing approximant.");
986  if (f_ref != 0.)
987  XLALPrintWarning("XLAL Warning - %s: This approximant does not use f_ref. The reference phase will be defined at coalescence.\n", __func__);
988  /* If tides-related parameter was not input by the user, use universal relations to compute it from quadrupolar lambda (or from octupolar lambda, itself either input or computed, for omega03) - else use the input value given by the user */
989  if (!XLALDictContains(params, "TidalOctupolarLambda1")) {
992  }
993  if (!XLALDictContains(params, "TidalOctupolarLambda2")) {
996  }
997  if (!XLALDictContains(params, "TidalQuadrupolarFMode1")) {
998  omega2TidalA_UR = XLALSimUniversalRelationomega02TidalVSlambda2Tidal(lambda1);
1000  }
1001  if (!XLALDictContains(params, "TidalQuadrupolarFMode2")) {
1002  omega2TidalB_UR = XLALSimUniversalRelationomega02TidalVSlambda2Tidal(lambda2);
1004  }
1005  if (!XLALDictContains(params, "TidalOctupolarFMode1")) {
1006  omega3TidalA_UR = XLALSimUniversalRelationomega03TidalVSlambda3Tidal(lambda3A_UR);
1008  }
1009  if (!XLALDictContains(params, "TidalOctupolarFMode2")) {
1010  omega3TidalB_UR = XLALSimUniversalRelationomega03TidalVSlambda3Tidal(lambda3B_UR);
1012  }
1013  if (!XLALDictContains(params, "dQuadMon1")) {
1014  quadparam1_UR = XLALSimUniversalRelationQuadMonVSlambda2Tidal(lambda1);
1016  }
1017  if (!XLALDictContains(params, "dQuadMon2")) {
1018  quadparam2_UR = XLALSimUniversalRelationQuadMonVSlambda2Tidal(lambda2);
1020  }
1021  /* Call the waveform driver routine */
1022  if (approximant == SEOBNRv2T)
1023  SpinAlignedEOBversion = 201;
1024  if (approximant == SEOBNRv4T)
1025  SpinAlignedEOBversion = 401;
1026  ret = XLALSimIMRSpinAlignedEOBWaveform(hplus, hcross, phiRef, deltaT, m1, m2, f_min, distance, inclination, S1z, S2z, SpinAlignedEOBversion, params);
1027  break;
1028 
1029  case HGimri:
1030  /* Waveform-specific sanity checks */
1031  if (!checkTidesZero(lambda1, lambda2))
1032  XLAL_ERROR(XLAL_EINVAL, "Non-zero tidal parameters were given, but this is approximant doe not have tidal corrections.");
1033  if (!checkCOSpinZero(S2x, S2y, S2z))
1034  XLAL_ERROR(XLAL_EINVAL, "Non-zero CO spin given, but this approximant does not support this case.");
1035  /* Call the waveform driver */
1036  ret = XLALHGimriGenerator(hplus, hcross, phiRef, deltaT, m1, m2, f_min, distance, inclination, S1z);
1037  break;
1038 
1039  case NR_hdf5:
1040  /* Waveform-specific sanity checks */
1041  /* Call the waveform driver routine */
1042  ret = XLALSimInspiralNRWaveformGetHplusHcross(hplus, hcross,
1043  phiRef, inclination, deltaT, m1, m2, distance, f_min, f_ref, S1x, S1y, S1z,
1045  break;
1046 
1047  case NRSur7dq2:
1048  /* Waveform-specific sanity checks */
1050  XLAL_ERROR(XLAL_EINVAL, "Non-default flags given, but this approximant does not support this case.");
1051  if (!checkTidesZero(lambda1, lambda2))
1052  XLAL_ERROR(XLAL_EINVAL, "Non-zero tidal parameters were given, but this is approximant doe not have tidal corrections.");
1053  /* Call the waveform driver routine */
1054  ret = XLALSimInspiralPrecessingNRSurPolarizations(hplus, hcross, phiRef, inclination, deltaT, m1, m2, distance, f_min, f_ref, S1x, S1y, S1z, S2x, S2y, S2z, params, approximant);
1055  break;
1056 
1057  case NRSur7dq4:
1058  /* Waveform-specific sanity checks */
1060  XLAL_ERROR(XLAL_EINVAL, "Non-default flags given, but this approximant does not support this case.");
1061  if (!checkTidesZero(lambda1, lambda2))
1062  XLAL_ERROR(XLAL_EINVAL, "Non-zero tidal parameters were given, but this is approximant doe not have tidal corrections.");
1063  /* Call the waveform driver routine */
1064  ret = XLALSimInspiralPrecessingNRSurPolarizations(hplus, hcross, phiRef, inclination, deltaT, m1, m2, distance, f_min, f_ref, S1x, S1y, S1z, S2x, S2y, S2z, params, approximant);
1065  break;
1066 
1067  case NRHybSur3dq8:
1068  /* Waveform-specific sanity checks */
1070  XLAL_ERROR(XLAL_EINVAL, "Non-default flags given, but this approximant does not support this case.");
1071  if (!checkTransverseSpinsZero(S1x, S1y, S2x, S2y))
1072  XLAL_ERROR(XLAL_EINVAL, "Non-zero transverse spins were given, but this is a non-precessing approximant.");
1073  if (!checkTidesZero(lambda1, lambda2))
1074  XLAL_ERROR(XLAL_EINVAL, "Non-zero tidal parameters were given, but this is approximant doe not have tidal corrections.");
1075 
1076  /* Call the waveform driver routine */
1077  ret = XLALSimIMRNRHybSur3dq8Polarizations(hplus, hcross, phiRef, inclination, deltaT, m1, m2, distance, f_min, f_ref, S1z, S2z, params);
1078  break;
1079 
1080  case IMRPhenomXAS:
1082  XLAL_ERROR(XLAL_EINVAL, "Non-default flags given, but this approximant does not support this case.");
1083  if (!checkTransverseSpinsZero(S1x, S1y, S2x, S2y))
1084  XLAL_ERROR(XLAL_EINVAL, "Non-zero transverse spins were given, but this is a non-precessing approximant.");
1085  if (!checkTidesZero(lambda1, lambda2))
1086  XLAL_ERROR(XLAL_EINVAL, "Non-zero tidal parameters were given, but this is approximant doe not have tidal corrections.");
1087  // generate TD waveforms with zero inclincation so that amplitude can be
1088  // calculated from hplus and hcross, apply inclination-dependent factors
1089  // in loop below
1090  polariz = 0;
1091 
1092  ret = XLALSimInspiralTDFromFD(hplus, hcross, m1, m2, S1x, S1y, S1z, S2x, S2y, S2z, distance, inclination, phiRef, longAscNodes, eccentricity, meanPerAno, deltaT, f_min, f_ref, params, approximant);
1093 
1094  if (ret == XLAL_FAILURE)
1096 
1097  // The Fourier domain model is built such that the TD transformation peakds approximately at zero.
1098  // Here we force an exact alignment at zero by computing the maximum of hp^2 + hc^2.
1099  maxamp = 0;
1100  maxind = (*hplus)->data->length - 1;
1101  for (loopi = (*hplus)->data->length - 1; loopi > -1; loopi--) {
1102  REAL8 ampsqr = ((*hplus)->data->data[loopi]) * ((*hplus)->data->data[loopi]) + ((*hcross)->data->data[loopi]) * ((*hcross)->data->data[loopi]);
1103  if (ampsqr > maxamp) {
1104  maxind = loopi;
1105  maxamp = ampsqr;
1106  }
1107  }
1108  // Shift peak to t=0.
1109  XLALGPSSetREAL8(&((*hplus)->epoch), (-1.) * deltaT * maxind);
1110  XLALGPSSetREAL8(&((*hcross)->epoch), (-1.) * deltaT * maxind);
1111  break;
1112 
1115  XLAL_ERROR(XLAL_EINVAL, "Non-default flags given, but this approximant does not support this case.");
1116  if( !checkTransverseSpinsZero(S1x, S1y, S2x, S2y) )
1117  XLAL_ERROR(XLAL_EINVAL, "Non-zero transverse spins were given, but this is a non-precessing approximant.");
1118 
1119  // generate TD waveforms with zero inclincation so that amplitude can be
1120  // calculated from hplus and hcross, apply inclination-dependent factors
1121  // in loop below
1122  polariz = 0;
1123 
1124  ret = XLALSimInspiralTDFromFD(hplus, hcross, m1, m2, S1x, S1y, S1z, S2x, S2y, S2z, distance, inclination, phiRef,
1125  longAscNodes, eccentricity, meanPerAno, deltaT, f_min, f_ref, params, approximant);
1126 
1127  if (ret == XLAL_FAILURE) XLAL_ERROR(XLAL_EFUNC);
1128 
1129  break;
1130 
1131  case IMRPhenomXHM:
1133  XLAL_ERROR(XLAL_EINVAL, "Non-default flags given, but this approximant does not support this case.");
1134  if (!checkTransverseSpinsZero(S1x, S1y, S2x, S2y))
1135  XLAL_ERROR(XLAL_EINVAL, "Non-zero transverse spins were given, but this is a non-precessing approximant.");
1136  if (!checkTidesZero(lambda1, lambda2))
1137  XLAL_ERROR(XLAL_EINVAL, "Non-zero tidal parameters were given, but this is approximant doe not have tidal corrections.");
1138  polariz = 0;
1139 
1140  ret = XLALSimInspiralTDFromFD(hplus, hcross, m1, m2, S1x, S1y, S1z, S2x, S2y, S2z, distance, inclination, phiRef, longAscNodes, eccentricity, meanPerAno, deltaT, f_min, f_ref, params, approximant);
1141 
1142  if (ret == XLAL_FAILURE)
1144 
1145  // The Fourier domain model is built such that the TD transformation peakds approximately at zero.
1146  // Here we force an exact alignment at zero by computing the maximum of hp^2 + hc^2.
1147  maxamp = 0;
1148  maxind = (*hplus)->data->length - 1;
1149  for (loopi = (*hplus)->data->length - 1; loopi > -1; loopi--) {
1150  REAL8 ampsqr = ((*hplus)->data->data[loopi]) * ((*hplus)->data->data[loopi]) + ((*hcross)->data->data[loopi]) * ((*hcross)->data->data[loopi]);
1151  if (ampsqr > maxamp) {
1152  maxind = loopi;
1153  maxamp = ampsqr;
1154  }
1155  }
1156  // Shift peak to t=0.
1157  XLALGPSSetREAL8(&((*hplus)->epoch), (-1.) * deltaT * maxind);
1158  XLALGPSSetREAL8(&((*hcross)->epoch), (-1.) * deltaT * maxind);
1159  break;
1160 
1161  case IMRPhenomXP:
1162  polariz = 0;
1163  ret = XLALSimInspiralTDFromFD(hplus, hcross, m1, m2, S1x, S1y, S1z, S2x, S2y, S2z, distance, inclination, phiRef, longAscNodes, eccentricity, meanPerAno, deltaT, f_min, f_ref, params, approximant);
1164  break;
1165  case IMRPhenomXP_NRTidalv2:
1166  polariz = 0;
1167  ret = XLALSimInspiralTDFromFD(hplus, hcross, m1, m2, S1x, S1y, S1z, S2x, S2y, S2z, distance, inclination, phiRef, longAscNodes, eccentricity, meanPerAno, deltaT, f_min, f_ref, params, approximant);
1168  break;
1169 
1170  case IMRPhenomXPHM:
1171  polariz = 0;
1172  ret = XLALSimInspiralTDFromFD(hplus, hcross, m1, m2, S1x, S1y, S1z, S2x, S2y, S2z, distance, inclination, phiRef, longAscNodes, eccentricity, meanPerAno, deltaT, f_min, f_ref, params, approximant);
1173  break;
1174 
1175  case IMRPhenomT:
1176  /* Waveform-specific sanity checks */
1178  XLAL_ERROR(XLAL_EINVAL, "Non-default flags given, but this approximant does not support this case.");
1179  if (!checkTransverseSpinsZero(S1x, S1y, S2x, S2y))
1180  XLAL_ERROR(XLAL_EINVAL, "Non-zero transverse spins were given, but this is a non-precessing approximant.");
1181  if (!checkTidesZero(lambda1, lambda2))
1182  XLAL_ERROR(XLAL_EINVAL, "Non-zero tidal parameters were given, but this is approximant doe not have tidal corrections.");
1183 
1184  ret = XLALSimIMRPhenomT(hplus, hcross, m1, m2, S1z, S2z, distance, inclination, deltaT, f_min, f_ref, phiRef, params);
1185  break;
1186 
1187 
1188  case IMRPhenomTHM:
1189  /* Waveform-specific sanity checks */
1191  XLAL_ERROR(XLAL_EINVAL, "Non-default flags given, but this approximant does not support this case.");
1192  if (!checkTransverseSpinsZero(S1x, S1y, S2x, S2y))
1193  XLAL_ERROR(XLAL_EINVAL, "Non-zero transverse spins were given, but this is a non-precessing approximant.");
1194  if (!checkTidesZero(lambda1, lambda2))
1195  XLAL_ERROR(XLAL_EINVAL, "Non-zero tidal parameters were given, but this is approximant doe not have tidal corrections.");
1196 
1197  ret = XLALSimIMRPhenomTHM(hplus, hcross, m1, m2, S1z, S2z, distance, inclination, deltaT, f_min, f_ref, phiRef, params);
1198  break;
1199 
1200  case IMRPhenomTP:
1201  /* Waveform-specific sanity checks */
1202  /* FIXME: CHECK ADDITIONAL CHECKS OF XP */
1204  XLAL_ERROR(XLAL_EINVAL, "Non-default flags given, but this approximant does not support this case.");
1205  if (!checkTidesZero(lambda1, lambda2))
1206  XLAL_ERROR(XLAL_EINVAL, "Non-zero tidal parameters were given, but this is approximant doe not have tidal corrections.");
1207 
1208  ret = XLALSimIMRPhenomTP(hplus, hcross, m1, m2, S1x, S1y, S1z, S2x, S2y, S2z, distance, inclination, deltaT, f_min, f_ref, phiRef, params);
1209  break;
1210 
1211  case IMRPhenomTPHM:
1212  /* Waveform-specific sanity checks */
1213  /* FIXME: CHECK ADDITIONAL CHECKS OF XPHM */
1215  XLAL_ERROR(XLAL_EINVAL, "Non-default flags given, but this approximant does not support this case.");
1216  if (!checkTidesZero(lambda1, lambda2))
1217  XLAL_ERROR(XLAL_EINVAL, "Non-zero tidal parameters were given, but this is approximant doe not have tidal corrections.");
1218 
1219  ret = XLALSimIMRPhenomTPHM(hplus, hcross, m1, m2, S1x, S1y, S1z, S2x, S2y, S2z, distance, inclination, deltaT, f_min, f_ref, phiRef, params);
1220  break;
1221 
1222  case IMRPhenomXO4a:
1223  polariz = 0;
1224  ret = XLALSimInspiralTDFromFD(hplus, hcross, m1, m2, S1x, S1y, S1z, S2x, S2y, S2z, distance, inclination, phiRef, longAscNodes, eccentricity, meanPerAno, deltaT, f_min, f_ref, params, approximant);
1225  break;
1226 
1227  default:
1228  XLALPrintError("TD version of approximant not implemented in lalsimulation\n");
1230  }
1231  //R.C.: here's the reference explaining why we perform this rotation https://dcc.ligo.org/LIGO-G1900275
1232  if (polariz && (*hplus) && (*hcross)) {
1233  REAL8 tmpP, tmpC;
1234  REAL8 cp = cos(2. * polariz);
1235  REAL8 sp = sin(2. * polariz);
1236  for (UINT4 idx = 0; idx < (*hplus)->data->length; idx++) {
1237  tmpP = (*hplus)->data->data[idx];
1238  tmpC = (*hcross)->data->data[idx];
1239  (*hplus)->data->data[idx] = cp * tmpP + sp * tmpC;
1240  (*hcross)->data->data[idx] = cp * tmpC - sp * tmpP;
1241  }
1242  }
1243 
1244  if (ret == XLAL_FAILURE)
1246 
1247  return ret;
1248 }
1249 
1250 /**
1251  * Copy of the old code of XLALSimInspiralChooseFDWaveform(). The new version of XLALSimInspiralChooseFDWaveform() is just a wrapper over XLALSimInspiralGenerateFDWaveform.
1252  * XLALSimInspiralGenerateFDWaveform() internally calls this function for legacy approximants.
1253  */
1255  COMPLEX16FrequencySeries **hptilde, /* FD plus polarization */
1256  COMPLEX16FrequencySeries **hctilde, /* FD cross polarization */
1257  REAL8 m1, /* mass of companion 1 (kg) */
1258  REAL8 m2, /* mass of companion 2 (kg) */
1259  REAL8 S1x, /* x-component of the dimensionless spin of object 1 */
1260  REAL8 S1y, /* y-component of the dimensionless spin of object 1 */
1261  REAL8 S1z, /* z-component of the dimensionless spin of object 1 */
1262  REAL8 S2x, /* x-component of the dimensionless spin of object 2 */
1263  REAL8 S2y, /* y-component of the dimensionless spin of object 2 */
1264  REAL8 S2z, /* z-component of the dimensionless spin of object 2 */
1265  REAL8 distance, /* distance of source (m) */
1266  REAL8 inclination, /* inclination of source (rad) */
1267  REAL8 phiRef, /* reference orbital phase (rad) */
1268  REAL8 longAscNodes, /* longitude of ascending nodes, degenerate with the polarization angle, Omega in documentation */
1269  REAL8 eccentricity, /* eccentricity at reference epoch */
1270  REAL8 UNUSED meanPerAno, /* mean anomaly of periastron */
1271  // frequency sampling parameters, no default value
1272  REAL8 deltaF, /* sampling interval (Hz) */
1273  REAL8 f_min, /* starting GW frequency (Hz) */
1274  REAL8 f_max, /* ending GW frequency (Hz) */
1275  REAL8 f_ref, /* Reference frequency (Hz) */
1276  LALDict *params, /* LAL dictionary containing accessory parameters */
1277  Approximant approximant /* post-Newtonian approximant to use for waveform production */
1278 )
1279 {
1280  REAL8 LNhatx, LNhaty, LNhatz;
1281  REAL8 tmp1, tmp2;
1282  REAL8 E1x, E1y, E1z;
1283  REAL8 kMax;
1284  REAL8 v0, fStart;
1285  int ret;
1286  unsigned int j;
1287  REAL8 pfac, cfac;
1288  INT4 phiRefAtEnd;
1291 
1296 
1297  /* Support variables for precessing wfs */
1298  REAL8 spin1x, spin1y, spin1z;
1299  REAL8 spin2x, spin2y, spin2z;
1300 
1301  /* Variables for IMRPhenomP and IMRPhenomPv2 */
1302  REAL8 chi1_l, chi2_l, chip, thetaJN, alpha0, phi_aligned, zeta_polariz;
1303  COMPLEX16 PhPpolp, PhPpolc;
1304 
1305  /* General sanity checks that will abort
1306  *
1307  * If non-GR approximants are added, include them in
1308  * XLALSimInspiralApproximantAcceptTestGRParams()
1309  */
1311  XLALPrintError("XLAL Error - %s: Passed in non-NULL pointer to LALSimInspiralTestGRParam for an approximant that does not use LALSimInspiralTestGRParam\n", __func__);
1313  }
1314 
1315  /* General sanity check the input parameters - only give warnings! */
1316  if (deltaF > 1.)
1317  XLALPrintWarning("XLAL Warning - %s: Large value of deltaF = %e requested...This corresponds to a very short TD signal (with padding). Consider a smaller value.\n", __func__, deltaF);
1318  if (deltaF < 1. / 4096.)
1319  XLALPrintWarning("XLAL Warning - %s: Small value of deltaF = %e requested...This corresponds to a very long TD signal. Consider a larger value.\n", __func__, deltaF);
1320  if (m1 < 0.09 * LAL_MSUN_SI)
1321  XLALPrintWarning("XLAL Warning - %s: Small value of m1 = %e (kg) = %e (Msun) requested...Perhaps you have a unit conversion error?\n", __func__, m1, m1 / LAL_MSUN_SI);
1322  if (m2 < 0.09 * LAL_MSUN_SI)
1323  XLALPrintWarning("XLAL Warning - %s: Small value of m2 = %e (kg) = %e (Msun) requested...Perhaps you have a unit conversion error?\n", __func__, m2, m2 / LAL_MSUN_SI);
1324  if (m1 + m2 > 1000. * LAL_MSUN_SI)
1325  XLALPrintWarning("XLAL Warning - %s: Large value of total mass m1+m2 = %e (kg) = %e (Msun) requested...Signal not likely to be in band of ground-based detectors.\n", __func__, m1 + m2, (m1 + m2) / LAL_MSUN_SI);
1326  if (S1x * S1x + S1y * S1y + S1z * S1z > 1.000001)
1327  XLALPrintWarning("XLAL Warning - %s: S1 = (%e,%e,%e) with norm > 1 requested...Are you sure you want to violate the Kerr bound?\n", __func__, S1x, S1y, S1z);
1328  if (S2x * S2x + S2y * S2y + S2z * S2z > 1.000001)
1329  XLALPrintWarning("XLAL Warning - %s: S2 = (%e,%e,%e) with norm > 1 requested...Are you sure you want to violate the Kerr bound?\n", __func__, S2x, S2y, S2z);
1330  if (f_min < 1.)
1331  XLALPrintWarning("XLAL Warning - %s: Small value of fmin = %e requested...Check for errors, this could create a very long waveform.\n", __func__, f_min);
1332  if (f_min > 40.000001)
1333  XLALPrintWarning("XLAL Warning - %s: Large value of fmin = %e requested...Check for errors, the signal will start in band.\n", __func__, f_min);
1334 
1335  /* adjust the reference frequency for certain precessing approximants:
1336  * if that approximate interprets f_ref==0 to be f_min, set f_ref=f_min;
1337  * otherwise do nothing */
1339 
1340  /* The non-precessing waveforms return h(f) for optimal orientation
1341  * (i=0, Fp=1, Fc=0; Lhat pointed toward the observer)
1342  * To get generic polarizations we multiply by inclination dependence
1343  * and note hc(f) \propto -I * hp(f)
1344  * Non-precessing waveforms multiply hp by pfac, hc by -I*cfac
1345  */
1346  cfac = cos(inclination);
1347  pfac = 0.5 * (1. + cfac * cfac);
1348 
1349  switch (approximant) {
1350  /* inspiral-only models */
1351  case EccentricFD:
1352  /* Waveform-specific sanity checks */
1354  XLAL_ERROR(XLAL_EINVAL, "Non-default LALSimInspiralFrameAxis provided, but this approximant does not use that flag.");
1356  XLAL_ERROR(XLAL_EINVAL, "Non-default LALSimInspiralModesChoice provided, but this approximant does not use that flag.");
1357  if (!checkTransverseSpinsZero(S1x, S1y, S2x, S2y))
1358  XLAL_ERROR(XLAL_EINVAL, "Non-zero transverse spins were given, but this is a non-precessing approximant.");
1359  /* Call the waveform driver routine */
1360  /* Note that for generic inclined eccentric waveforms
1361  * * it is not possible to decompose hc(f) \propto I * hp(f)
1362  * * we call both polarizations independently
1363  * */
1364  /*ret = XLALSimInspiralEFD(hptilde, hctilde, phiRef, deltaF, m1, m2,
1365  * f_min, f_max, i, r, lambda1, lambda2, phaseO);*/
1366  // IMPORTANT CHECK: verify that inclination_azimuth is the longitude of ascending nodes
1367  ret = XLALSimInspiralEFD(hptilde, hctilde, phiRef, deltaF, m1, m2, f_min, f_max, inclination, distance, longAscNodes, eccentricity, phaseO);
1368  if (ret == XLAL_FAILURE)
1370  break;
1371 
1372  case TaylorF2:
1373  /* Waveform-specific sanity checks */
1375  XLAL_ERROR(XLAL_EINVAL, "Non-default LALSimInspiralFrameAxis provided, but this approximant does not use that flag.");
1377  XLAL_ERROR(XLAL_EINVAL, "Non-default LALSimInspiralModesChoice provided, but this approximant does not use that flag.");
1378  if (!checkTransverseSpinsZero(S1x, S1y, S2x, S2y))
1379  XLAL_ERROR(XLAL_EINVAL, "Non-zero transverse spins were given, but this is a non-precessing approximant.");
1380 
1381  /* Call the waveform driver routine */
1382  ret = XLALSimInspiralTaylorF2(hptilde, phiRef, deltaF, m1, m2, S1z, S2z, f_min, f_max, f_ref, distance, params);
1383  if (ret == XLAL_FAILURE)
1385  /* Produce both polarizations */
1386  *hctilde = XLALCreateCOMPLEX16FrequencySeries("FD hcross", &((*hptilde)->epoch), (*hptilde)->f0, (*hptilde)->deltaF, &((*hptilde)->sampleUnits), (*hptilde)->data->length);
1387  for (j = 0; j < (*hptilde)->data->length; j++) {
1388  (*hctilde)->data->data[j] = -I * cfac * (*hptilde)->data->data[j];
1389  (*hptilde)->data->data[j] *= pfac;
1390  }
1391  break;
1392 
1393  case TaylorF2Ecc:
1394  /* Waveform-specific sanity checks */
1396  XLAL_ERROR(XLAL_EINVAL, "Non-default LALSimInspiralFrameAxis provided, but this approximant does not use that flag.");
1398  XLAL_ERROR(XLAL_EINVAL, "Non-default LALSimInspiralModesChoice provided, but this approximant does not use that flag.");
1399  if (!checkTransverseSpinsZero(S1x, S1y, S2x, S2y))
1400  XLAL_ERROR(XLAL_EINVAL, "Non-zero transverse spins were given, but this is a non-precessing approximant.");
1402  if (eccentricity > 0.0 && eccentricity < 1.0 && f_ecc < 0.0) {
1403  /* we set f_ecc to be f_ref for correct eccentricity but not specifying f_ecc. */
1404  f_ecc = f_ref;
1405  if (f_ecc == 0)
1406  f_ecc = f_min;
1408  XLAL_PRINT_WARNING("Warning... The reference frequency for eccentricity was set as default value(%f). This might be not optimal case for you.\n", f_ecc);
1409  }
1410 
1411  /* Call the waveform driver routine */
1412  ret = XLALSimInspiralTaylorF2Ecc(hptilde, phiRef, deltaF, m1, m2, S1z, S2z, f_min, f_max, f_ref, distance, eccentricity, params);
1413  if (ret == XLAL_FAILURE)
1415  /* Produce both polarizations */
1416  *hctilde = XLALCreateCOMPLEX16FrequencySeries("FD hcross", &((*hptilde)->epoch), (*hptilde)->f0, (*hptilde)->deltaF, &((*hptilde)->sampleUnits), (*hptilde)->data->length);
1417  for (j = 0; j < (*hptilde)->data->length; j++) {
1418  (*hctilde)->data->data[j] = -I * cfac * (*hptilde)->data->data[j];
1419  (*hptilde)->data->data[j] *= pfac;
1420  }
1421  break;
1422 
1423  case TaylorF2NLTides:
1424  /* Waveform-specific sanity checks */
1426  XLAL_ERROR(XLAL_EINVAL, "Non-default LALSimInspiralFrameAxis provided, but this approximant does not use that flag.");
1428  XLAL_ERROR(XLAL_EINVAL, "Non-default LALSimInspiralModesChoice provided, but this approximant does not use that flag.");
1429  if (!checkTransverseSpinsZero(S1x, S1y, S2x, S2y))
1430  XLAL_ERROR(XLAL_EINVAL, "Non-zero transverse spins were given, but this is a non-precessing approximant.");
1431 
1432  // FIXME : add checks for NL tidal parameters?
1433 
1434  /* Call the waveform driver routine */
1435  ret = XLALSimInspiralTaylorF2NLTides(hptilde, phiRef, deltaF, m1, m2, S1z, S2z, f_min, f_max, f_ref, distance, params);
1436  if (ret == XLAL_FAILURE)
1438  /* Produce both polarizations */
1439  *hctilde = XLALCreateCOMPLEX16FrequencySeries("FD hcross", &((*hptilde)->epoch), (*hptilde)->f0, (*hptilde)->deltaF, &((*hptilde)->sampleUnits), (*hptilde)->data->length);
1440  for (j = 0; j < (*hptilde)->data->length; j++) {
1441  (*hctilde)->data->data[j] = -I * cfac * (*hptilde)->data->data[j];
1442  (*hptilde)->data->data[j] *= pfac;
1443  }
1444  break;
1445 
1446  /* non-spinning inspiral-merger-ringdown models */
1447  case IMRPhenomA:
1448  /* Waveform-specific sanity checks */
1450  XLAL_ERROR(XLAL_EINVAL, "Non-default flags given, but this approximant does not support this case.");
1451  if (!checkSpinsZero(S1x, S1y, S1z, S2x, S2y, S2z))
1452  XLAL_ERROR(XLAL_EINVAL, "Non-zero spins were given, but this is a non-spinning approximant.");
1453  if (!checkTidesZero(lambda1, lambda2))
1454  XLAL_ERROR(XLAL_EINVAL, "Non-zero tidal parameters were given, but this is approximant doe not have tidal corrections.");
1455  /* Call the waveform driver routine */
1456  ret = XLALSimIMRPhenomAGenerateFD(hptilde, phiRef, deltaF, m1, m2, f_min, f_max, distance);
1457  if (ret == XLAL_FAILURE)
1459  /* Produce both polarizations */
1460  *hctilde = XLALCreateCOMPLEX16FrequencySeries("FD hcross", &((*hptilde)->epoch), (*hptilde)->f0, (*hptilde)->deltaF, &((*hptilde)->sampleUnits), (*hptilde)->data->length);
1461  for (j = 0; j < (*hptilde)->data->length; j++) {
1462  (*hctilde)->data->data[j] = -I * cfac * (*hptilde)->data->data[j];
1463  (*hptilde)->data->data[j] *= pfac;
1464  }
1465  break;
1466 
1467  /* spinning inspiral-only models */
1468  case SpinTaylorF2:
1469  /* Waveform-specific sanity checks */
1470  /* Sanity check unused fields of params */
1472  XLAL_ERROR(XLAL_EINVAL, "Non-default LALSimInspiralFrameAxis provided, but this approximant does not use that flag.");
1474  XLAL_ERROR(XLAL_EINVAL, "Non-default LALSimInspiralModesChoice provided, but this approximant does not use that flag.");
1475  if (!checkCOSpinZero(S2x, S2y, S2z)) // This is a single-spin model
1476  XLAL_ERROR(XLAL_EINVAL, "Non-zero CO spin given, but this approximant does not support this case.");
1477  spin1x = S1x;
1478  spin1y = S1y;
1479  spin1z = S1z;
1480  ROTATEY(inclination, spin1x, spin1y, spin1z);
1481  LNhatx = sin(inclination);
1482  LNhaty = 0.;
1483  LNhatz = cos(inclination);
1484  /* Maximum PN amplitude order for precessing waveforms is
1485  * MAX_PRECESSING_AMP_PN_ORDER */
1486  amplitudeO = 0; /* amplitudeO <= MAX_PRECESSING_AMP_PN_ORDER ?
1487  amplitudeO : MAX_PRECESSING_AMP_PN_ORDER */ ;
1488  /* Call the waveform driver routine */
1489  ret = XLALSimInspiralSpinTaylorF2(hptilde, hctilde, phiRef, deltaF, m1, m2, spin1x, spin1y, spin1z, LNhatx, LNhaty, LNhatz, f_min, f_max, f_ref, distance, params, phaseO, amplitudeO);
1490  if (ret == XLAL_FAILURE)
1492  break;
1493 
1494  /* FIXME: Comment out this case, as I don't have its source code */
1495  //case TaylorR2F4:
1496  // /* Waveform-specific sanity checks */
1497  // if( !XLALSimInspiralWaveformParamsFlagsAreDefault(params) )
1498  // XLAL_ERROR(XLAL_EINVAL, "Non-default flags given, but this approximant does not support this case.");
1499  // if( !checkTransverseSpinsZero(S1x, S1y, S2x, S2y) )
1500  // XLAL_ERROR(XLAL_EINVAL, "Non-zero transverse spins were given, but this is a non-precessing approximant.");
1501  // /* Call the waveform driver routine */
1502  // ret = XLALSimInspiralTaylorR2F4(hptilde, phiRef, deltaF, m1, m2,
1503  // S1z, S2z, f_min, r, phaseO, amplitudeO);
1504  // break;
1505 
1506  case TaylorF2RedSpin:
1507  /* Waveform-specific sanity checks */
1509  XLAL_ERROR(XLAL_EINVAL, "Non-default flags given, but this approximant does not support this case.");
1510  if (!checkTransverseSpinsZero(S1x, S1y, S2x, S2y))
1511  XLAL_ERROR(XLAL_EINVAL, "Non-zero transverse spins were given, but this is a non-precessing approximant.");
1512  if (!checkTidesZero(lambda1, lambda2))
1513  XLAL_ERROR(XLAL_EINVAL, "Non-zero tidal parameters were given, but this is approximant doe not have tidal corrections.");
1514  /* Call the waveform driver routine */
1515  ret = XLALSimInspiralTaylorF2ReducedSpin(hptilde, phiRef, deltaF, m1, m2, XLALSimInspiralTaylorF2ReducedSpinComputeChi(m1, m2, S1z, S2z), f_min, f_max, distance, phaseO, amplitudeO);
1516  if (ret == XLAL_FAILURE)
1518  /* Produce both polarizations */
1519  *hctilde = XLALCreateCOMPLEX16FrequencySeries("FD hcross", &((*hptilde)->epoch), (*hptilde)->f0, (*hptilde)->deltaF, &((*hptilde)->sampleUnits), (*hptilde)->data->length);
1520  for (j = 0; j < (*hptilde)->data->length; j++) {
1521  (*hctilde)->data->data[j] = -I * cfac * (*hptilde)->data->data[j];
1522  (*hptilde)->data->data[j] *= pfac;
1523  }
1524  break;
1525 
1526  case TaylorF2RedSpinTidal:
1527  /* Waveform-specific sanity checks */
1529  XLAL_ERROR(XLAL_EINVAL, "Non-default flags given, but this approximant does not support this case.");
1530  if (!checkTransverseSpinsZero(S1x, S1y, S2x, S2y))
1531  XLAL_ERROR(XLAL_EINVAL, "Non-zero transverse spins were given, but this is a non-precessing approximant.");
1532  /* Call the waveform driver routine */
1533  ret = XLALSimInspiralTaylorF2ReducedSpinTidal(hptilde, phiRef, deltaF, m1, m2, XLALSimIMRPhenomBComputeChi(m1, m2, S1z, S2z), lambda1, lambda2, f_min, f_max, distance, phaseO, amplitudeO);
1534  if (ret == XLAL_FAILURE)
1536  /* Produce both polarizations */
1537  *hctilde = XLALCreateCOMPLEX16FrequencySeries("FD hcross", &((*hptilde)->epoch), (*hptilde)->f0, (*hptilde)->deltaF, &((*hptilde)->sampleUnits), (*hptilde)->data->length);
1538  for (j = 0; j < (*hptilde)->data->length; j++) {
1539  (*hctilde)->data->data[j] = -I * cfac * (*hptilde)->data->data[j];
1540  (*hptilde)->data->data[j] *= pfac;
1541  }
1542  break;
1543 
1544  /* spinning inspiral-merger-ringdown models */
1545  case IMRPhenomB:
1546  /* Waveform-specific sanity checks */
1548  XLAL_ERROR(XLAL_EINVAL, "Non-default flags given, but this approximant does not support this case.");
1549  if (!checkTransverseSpinsZero(S1x, S1y, S2x, S2y))
1550  XLAL_ERROR(XLAL_EINVAL, "Non-zero transverse spins were given, but this is a non-precessing approximant.");
1551  if (!checkTidesZero(lambda1, lambda2))
1552  XLAL_ERROR(XLAL_EINVAL, "Non-zero tidal parameters were given, but this is approximant doe not have tidal corrections.");
1553  /* Call the waveform driver routine */
1554  ret = XLALSimIMRPhenomBGenerateFD(hptilde, phiRef, deltaF, m1, m2, XLALSimIMRPhenomBComputeChi(m1, m2, S1z, S2z), f_min, f_max, distance);
1555  if (ret == XLAL_FAILURE)
1557  /* Produce both polarizations */
1558  *hctilde = XLALCreateCOMPLEX16FrequencySeries("FD hcross", &((*hptilde)->epoch), (*hptilde)->f0, (*hptilde)->deltaF, &((*hptilde)->sampleUnits), (*hptilde)->data->length);
1559  for (j = 0; j < (*hptilde)->data->length; j++) {
1560  (*hctilde)->data->data[j] = -I * cfac * (*hptilde)->data->data[j];
1561  (*hptilde)->data->data[j] *= pfac;
1562  }
1563  break;
1564 
1565  case IMRPhenomC:
1566  /* Waveform-specific sanity checks */
1568  XLAL_ERROR(XLAL_EINVAL, "Non-default flags given, but this approximant does not support this case.");
1569  if (!checkTransverseSpinsZero(S1x, S1y, S2x, S2y))
1570  XLAL_ERROR(XLAL_EINVAL, "Non-zero transverse spins were given, but this is a non-precessing approximant.");
1571  if (!checkTidesZero(lambda1, lambda2))
1572  XLAL_ERROR(XLAL_EINVAL, "Non-zero tidal parameters were given, but this is approximant doe not have tidal corrections.");
1573  /* Call the waveform driver routine */
1574  ret = XLALSimIMRPhenomCGenerateFD(hptilde, phiRef, deltaF, m1, m2, XLALSimIMRPhenomBComputeChi(m1, m2, S1z, S2z), f_min, f_max, distance, params);
1575  if (ret == XLAL_FAILURE)
1577  /* Produce both polarizations */
1578  *hctilde = XLALCreateCOMPLEX16FrequencySeries("FD hcross", &((*hptilde)->epoch), (*hptilde)->f0, (*hptilde)->deltaF, &((*hptilde)->sampleUnits), (*hptilde)->data->length);
1579  for (j = 0; j < (*hptilde)->data->length; j++) {
1580  (*hctilde)->data->data[j] = -I * cfac * (*hptilde)->data->data[j];
1581  (*hptilde)->data->data[j] *= pfac;
1582  }
1583  break;
1584 
1585  case IMRPhenomD:
1586  /* Waveform-specific sanity checks */
1588  XLAL_ERROR(XLAL_EINVAL, "Non-default flags given, but this approximant does not support this case.");
1589  if (!checkTransverseSpinsZero(S1x, S1y, S2x, S2y))
1590  XLAL_ERROR(XLAL_EINVAL, "Non-zero transverse spins were given, but this is a non-precessing approximant.");
1591  if (!checkTidesZero(lambda1, lambda2))
1592  XLAL_ERROR(XLAL_EINVAL, "Non-zero tidal parameters were given, but this is approximant doe not have tidal corrections.");
1593  /* Call the waveform driver routine */
1594 
1595  ret = XLALSimIMRPhenomDGenerateFD(hptilde, phiRef, f_ref, deltaF, m1, m2, S1z, S2z, f_min, f_max, distance, params, NoNRT_V);
1596  if (ret == XLAL_FAILURE)
1598  /* Produce both polarizations */
1599  *hctilde = XLALCreateCOMPLEX16FrequencySeries("FD hcross", &((*hptilde)->epoch), (*hptilde)->f0, (*hptilde)->deltaF, &((*hptilde)->sampleUnits), (*hptilde)->data->length);
1600  for (j = 0; j < (*hptilde)->data->length; j++) {
1601  (*hctilde)->data->data[j] = -I * cfac * (*hptilde)->data->data[j];
1602  (*hptilde)->data->data[j] *= pfac;
1603  }
1604  break;
1605 
1606  case IMRPhenomD_NRTidal:
1607  /* Waveform-specific sanity checks */
1609  XLAL_ERROR(XLAL_EINVAL, "Non-default flags given, but this approximant does not support this case.");
1610  if (!checkTransverseSpinsZero(S1x, S1y, S2x, S2y))
1611  XLAL_ERROR(XLAL_EINVAL, "Non-zero transverse spins were given, but this is a non-precessing approximant.");
1612  if (lambda1 < 0 || lambda2 < 0)
1613  XLAL_ERROR(XLAL_EFUNC, "lambda1 = %f, lambda2 = %f. Both should be greater than zero for IMRPhenomD_NRTidal", lambda1, lambda2);
1614  /* Call the waveform driver routine */
1615  ret = XLALSimIMRPhenomDNRTidal(hptilde, phiRef, deltaF, f_min, f_max, f_ref, distance, m1, m2, S1z, S2z, lambda1, lambda2, params, NRTidal_V);
1616  if (ret == XLAL_FAILURE)
1618  /* Produce both polarizations */
1619  *hctilde = XLALCreateCOMPLEX16FrequencySeries("FD hcross", &((*hptilde)->epoch), (*hptilde)->f0, (*hptilde)->deltaF, &((*hptilde)->sampleUnits), (*hptilde)->data->length);
1620  for (j = 0; j < (*hptilde)->data->length; j++) {
1621  (*hctilde)->data->data[j] = -I * cfac * (*hptilde)->data->data[j];
1622  (*hptilde)->data->data[j] *= pfac;
1623  }
1624  break;
1625 
1626  case IMRPhenomD_NRTidalv2:
1627  /* Waveform-specific sanity checks */
1629  XLAL_ERROR(XLAL_EINVAL, "Non-default flags given, but this approximant does not support this case.");
1630  if (!checkTransverseSpinsZero(S1x, S1y, S2x, S2y))
1631  XLAL_ERROR(XLAL_EINVAL, "Non-zero transverse spins were given, but this is a non-precessing approximant.");
1632  if (lambda1 < 0 || lambda2 < 0)
1633  XLAL_ERROR(XLAL_EFUNC, "lambda1 = %f, lambda2 = %f. Both should be greater than zero for IMRPhenomD_NRTidalv2", lambda1, lambda2);
1635  XLAL_CHECK(XLAL_SUCCESS == ret, ret, "Failed to set QuadMon from Lambdas for IMRPhenomD_NRTidalv2");
1636  /* Call the waveform driver routine */
1637  ret = XLALSimIMRPhenomDNRTidal(hptilde, phiRef, deltaF, f_min, f_max, f_ref, distance, m1, m2, S1z, S2z, lambda1, lambda2, params, NRTidalv2_V);
1638  if (ret == XLAL_FAILURE)
1640  /* Produce both polarizations */
1641  *hctilde = XLALCreateCOMPLEX16FrequencySeries("FD hcross", &((*hptilde)->epoch), (*hptilde)->f0, (*hptilde)->deltaF, &((*hptilde)->sampleUnits), (*hptilde)->data->length);
1642  for (j = 0; j < (*hptilde)->data->length; j++) {
1643  (*hctilde)->data->data[j] = -I * cfac * (*hptilde)->data->data[j];
1644  (*hptilde)->data->data[j] *= pfac;
1645  }
1646  break;
1647 
1648  case IMRPhenomNSBH:
1649  /* Waveform-specific sanity checks */
1650  if (!checkTransverseSpinsZero(S1x, S1y, S2x, S2y))
1651  XLAL_ERROR(XLAL_EINVAL, "Non-zero transverse spins were given, but this is a non-precessing approximant.");
1652  if (lambda1 != 0 || lambda2 < 0)
1653  XLAL_ERROR(XLAL_EDOM, "lambda1 = %f, lambda2 = %f. lambda1 should be equal to zero and lambda2 should be greater than or equal to zero for IMRPhenomNSBH", lambda1, lambda2);
1654  /* Call the waveform driver routine */
1655  ret = XLALSimIMRPhenomNSBH(hptilde, phiRef, deltaF, f_min, f_max, f_ref, distance, m1, m2, S1z, S2z, params);
1656  if (ret == XLAL_FAILURE)
1658  /* Produce both polarizations */
1659  *hctilde = XLALCreateCOMPLEX16FrequencySeries("FD hcross", &((*hptilde)->epoch), (*hptilde)->f0, (*hptilde)->deltaF, &((*hptilde)->sampleUnits), (*hptilde)->data->length);
1660  for (j = 0; j < (*hptilde)->data->length; j++) {
1661  (*hctilde)->data->data[j] = -I * cfac * (*hptilde)->data->data[j];
1662  (*hptilde)->data->data[j] *= pfac;
1663  }
1664  break;
1665 
1666  case IMRPhenomHM:
1667  /* Waveform-specific sanity checks */
1668  // if( !XLALSimInspiralWaveformParamsFlagsAreDefault(params) )
1669  // XLAL_ERROR(XLAL_EINVAL, "Non-default flags given, but this approximant does not support this case.");
1670  if (!checkTransverseSpinsZero(S1x, S1y, S2x, S2y))
1671  XLAL_ERROR(XLAL_EINVAL, "Non-zero transverse spins were given, but this is a non-precessing approximant.");
1672  if (!checkTidesZero(lambda1, lambda2))
1673  XLAL_ERROR(XLAL_EINVAL, "Non-zero tidal parameters were given, but this is approximant doe not have tidal corrections.");
1674  /* Call the waveform driver routine */
1675 
1677  freqs->data[0] = f_min;
1678  freqs->data[1] = f_max;
1679  ret = XLALSimIMRPhenomHM(hptilde, hctilde, freqs, m1, m2, S1z, S2z, distance, inclination, phiRef, deltaF, f_ref, params);
1680  if (ret == XLAL_FAILURE)
1682  XLALDestroyREAL8Sequence(freqs);
1683  break;
1684 
1685  case EOBNRv2_ROM:
1686  /* Waveform-specific sanity checks */
1688  XLAL_ERROR(XLAL_EINVAL, "Non-default flags given, but this approximant does not support this case.");
1689  if (!checkSpinsZero(S1x, S1y, S1z, S2x, S2y, S2z))
1690  XLAL_ERROR(XLAL_EINVAL, "Non-zero spins were given, but this is a non-spinning approximant.");
1691  if (!checkTidesZero(lambda1, lambda2))
1692  XLAL_ERROR(XLAL_EINVAL, "Non-zero tidal parameters were given, but this is approximant doe not have tidal corrections.");
1693 
1694  ret = XLALSimIMREOBNRv2HMROM(hptilde, hctilde, phiRef, deltaF, f_min, f_max, f_ref, distance, inclination, m1, m2, 0);
1695  break;
1696 
1697  case EOBNRv2HM_ROM:
1698  /* Waveform-specific sanity checks */
1700  XLAL_ERROR(XLAL_EINVAL, "Non-default flags given, but this approximant does not support this case.");
1701  if (!checkSpinsZero(S1x, S1y, S1z, S2x, S2y, S2z))
1702  XLAL_ERROR(XLAL_EINVAL, "Non-zero spins were given, but this is a non-spinning approximant.");
1703  if (!checkTidesZero(lambda1, lambda2))
1704  XLAL_ERROR(XLAL_EINVAL, "Non-zero tidal parameters were given, but this is approximant doe not have tidal corrections.");
1705 
1706  ret = XLALSimIMREOBNRv2HMROM(hptilde, hctilde, phiRef, deltaF, f_min, f_max, f_ref, distance, inclination, m1, m2, 1);
1707  break;
1708 
1710  /* Waveform-specific sanity checks */
1712  XLAL_ERROR(XLAL_EINVAL, "Non-default flags given, but this approximant does not support this case.");
1713  if (!checkTransverseSpinsZero(S1x, S1y, S2x, S2y))
1714  XLAL_ERROR(XLAL_EINVAL, "Non-zero transverse spins were given, but this is a non-precessing approximant.");
1715  if (!checkTidesZero(lambda1, lambda2))
1716  XLAL_ERROR(XLAL_EINVAL, "Non-zero tidal parameters were given, but this is approximant doe not have tidal corrections.");
1717  if (!checkAlignedSpinsEqual(S1z, S2z)) {
1718  XLALPrintError("XLAL Error - %s: SEOBNRv1ROM Effective Spin model called with unequal aligned spins: %lf, %lf.\n", __func__, S1z, S2z);
1720  }
1721 
1722  ret = XLALSimIMRSEOBNRv1ROMEffectiveSpin(hptilde, hctilde, phiRef, deltaF, f_min, f_max, f_ref, distance, inclination, m1, m2, XLALSimIMRPhenomBComputeChi(m1, m2, S1z, S2z));
1723  break;
1724 
1726  /* Waveform-specific sanity checks */
1728  XLAL_ERROR(XLAL_EINVAL, "Non-default flags given, but this approximant does not support this case.");
1729  if (!checkTransverseSpinsZero(S1x, S1y, S2x, S2y))
1730  XLAL_ERROR(XLAL_EINVAL, "Non-zero transverse spins were given, but this is a non-precessing approximant.");
1731  if (!checkTidesZero(lambda1, lambda2))
1732  XLAL_ERROR(XLAL_EINVAL, "Non-zero tidal parameters were given, but this is approximant doe not have tidal corrections.");
1733 
1734  ret = XLALSimIMRSEOBNRv1ROMDoubleSpin(hptilde, hctilde, phiRef, deltaF, f_min, f_max, f_ref, distance, inclination, m1, m2, S1z, S2z);
1735  break;
1736 
1738  /* Waveform-specific sanity checks */
1740  XLAL_ERROR(XLAL_EINVAL, "Non-default flags given, but this approximant does not support this case.");
1741  if (!checkTransverseSpinsZero(S1x, S1y, S2x, S2y))
1742  XLAL_ERROR(XLAL_EINVAL, "Non-zero transverse spins were given, but this is a non-precessing approximant.");
1743  if (!checkTidesZero(lambda1, lambda2))
1744  XLAL_ERROR(XLAL_EINVAL, "Non-zero tidal parameters were given, but this is approximant doe not have tidal corrections.");
1745  if (!checkAlignedSpinsEqual(S1z, S2z)) {
1746  XLALPrintError("XLAL Error - %s: SEOBNRv2ROM Effective Spin model called with unequal aligned spins: %lf, %lf.\n", __func__, S1z, S2z);
1748  }
1749 
1750  ret = XLALSimIMRSEOBNRv2ROMEffectiveSpin(hptilde, hctilde, phiRef, deltaF, f_min, f_max, f_ref, distance, inclination, m1, m2, XLALSimIMRPhenomBComputeChi(m1, m2, S1z, S2z));
1751  break;
1752 
1754  /* Waveform-specific sanity checks */
1756  XLAL_ERROR(XLAL_EINVAL, "Non-default flags given, but this approximant does not support this case.");
1757  if (!checkTransverseSpinsZero(S1x, S1y, S2x, S2y))
1758  XLAL_ERROR(XLAL_EINVAL, "Non-zero transverse spins were given, but this is a non-precessing approximant.");
1759  if (!checkTidesZero(lambda1, lambda2))
1760  XLAL_ERROR(XLAL_EINVAL, "Non-zero tidal parameters were given, but this is approximant doe not have tidal corrections.");
1761 
1762  ret = XLALSimIMRSEOBNRv2ROMDoubleSpin(hptilde, hctilde, phiRef, deltaF, f_min, f_max, f_ref, distance, inclination, m1, m2, S1z, S2z);
1763  break;
1764 
1766  /* Waveform-specific sanity checks */
1768  XLAL_ERROR(XLAL_EINVAL, "Non-default flags given, but this approximant does not support this case.");
1769  if (!checkTransverseSpinsZero(S1x, S1y, S2x, S2y))
1770  XLAL_ERROR(XLAL_EINVAL, "Non-zero transverse spins were given, but this is a non-precessing approximant.");
1771  if (!checkTidesZero(lambda1, lambda2))
1772  XLAL_ERROR(XLAL_EINVAL, "Non-zero tidal parameters were given, but this is approximant doe not have tidal corrections.");
1773 
1774  ret = XLALSimIMRSEOBNRv2ROMDoubleSpinHI(hptilde, hctilde, phiRef, deltaF, f_min, f_max, f_ref, distance, inclination, m1, m2, S1z, S2z, -1);
1775  break;
1776 
1777  case SEOBNRv4_ROM:
1778  /* Waveform-specific sanity checks */
1780  XLAL_ERROR(XLAL_EINVAL, "Non-default flags given, but this approximant does not support this case.");
1781  if (!checkTransverseSpinsZero(S1x, S1y, S2x, S2y))
1782  XLAL_ERROR(XLAL_EINVAL, "Non-zero transverse spins were given, but this is a non-precessing approximant.");
1783  if (!checkTidesZero(lambda1, lambda2))
1784  XLAL_ERROR(XLAL_EINVAL, "Non-zero tidal parameters were given, but this is approximant doe not have tidal corrections.");
1785 
1786  ret = XLALSimIMRSEOBNRv4ROM(hptilde, hctilde, phiRef, deltaF, f_min, f_max, f_ref, distance, inclination, m1, m2, S1z, S2z, -1, params, NoNRT_V);
1787  break;
1788 
1789  case SEOBNRv4HM_ROM:
1790  /* Waveform-specific sanity checks */
1792  XLAL_ERROR(XLAL_EINVAL, "Non-default flags given, but this approximant does not support this case.");
1793  if (!checkTransverseSpinsZero(S1x, S1y, S2x, S2y))
1794  XLAL_ERROR(XLAL_EINVAL, "Non-zero transverse spins were given, but this is a non-precessing approximant.");
1795  if (!checkTidesZero(lambda1, lambda2))
1796  XLAL_ERROR(XLAL_EINVAL, "Non-zero tidal parameters were given, but this is approximant doe not have tidal corrections.");
1797 
1798  ret = XLALSimIMRSEOBNRv4HMROM(hptilde, hctilde, phiRef, deltaF, f_min, f_max, f_ref, distance, inclination, m1, m2, S1z, S2z, -1, 5, 1, params);
1799  break;
1800 
1801  case SEOBNRv5_ROM:
1802  /* Waveform-specific sanity checks */
1804  XLAL_ERROR(XLAL_EINVAL, "Non-default flags given, but this approximant does not support this case.");
1805  if( !checkTransverseSpinsZero(S1x, S1y, S2x, S2y) )
1806  XLAL_ERROR(XLAL_EINVAL, "Non-zero transverse spins were given, but this is a non-precessing approximant.");
1807  if( !checkTidesZero(lambda1, lambda2) )
1808  XLAL_ERROR(XLAL_EINVAL, "Non-zero tidal parameters were given, but this is approximant doe not have tidal corrections.");
1809 
1810  ret = XLALSimIMRSEOBNRv5HMROM(hptilde, hctilde,
1811  phiRef, deltaF, f_min, f_max, f_ref, distance, inclination, m1, m2, S1z, S2z, -1, 1, true, params);
1812  break;
1813 
1814  case SEOBNRv5HM_ROM:
1815  /* Waveform-specific sanity checks */
1817  XLAL_ERROR(XLAL_EINVAL, "Non-default flags given, but this approximant does not support this case.");
1818  if( !checkTransverseSpinsZero(S1x, S1y, S2x, S2y) )
1819  XLAL_ERROR(XLAL_EINVAL, "Non-zero transverse spins were given, but this is a non-precessing approximant.");
1820  if( !checkTidesZero(lambda1, lambda2) )
1821  XLAL_ERROR(XLAL_EINVAL, "Non-zero tidal parameters were given, but this is approximant doe not have tidal corrections.");
1822 
1823  LALValue *mode_arr = NULL;
1824  LALDict *pars_aux;
1825  INT2Sequence *modeseq = NULL;
1826  UINT4 nmodes = 7;
1827  UINT2 eobmodesv5hm = 7;
1828 
1829  if(params == NULL){
1830  pars_aux = XLALCreateDict();
1831  }
1832  else{
1833  pars_aux = XLALDictDuplicate(params);
1834  }
1835  mode_arr = XLALSimInspiralWaveformParamsLookupModeArray(pars_aux);
1836 
1837  if(mode_arr != NULL)
1838  {
1839  modeseq = XLALSimInspiralModeArrayReadModes(mode_arr);
1840  nmodes = modeseq->length/2;
1841  if (
1842  nmodes == 2 &&
1843  modeseq->data[0] == 2 && abs(modeseq->data[1]) == 2 &&
1844  modeseq->data[2] == 3 && abs(modeseq->data[3]) == 3)
1845  {
1846  eobmodesv5hm = 2;
1847  }
1848  if (
1849  nmodes == 3 &&
1850  modeseq->data[0] == 2 && abs(modeseq->data[1]) == 2 &&
1851  modeseq->data[4] == 3 && abs(modeseq->data[5]) == 3 &&
1852  modeseq->data[2] == 2 && abs(modeseq->data[3]) == 1)
1853  {
1854  eobmodesv5hm = 3;
1855  }
1856  if (
1857  nmodes == 4 &&
1858  modeseq->data[0] == 2 && abs(modeseq->data[1]) == 2 &&
1859  modeseq->data[4] == 3 && abs(modeseq->data[5]) == 3 &&
1860  modeseq->data[2] == 2 && abs(modeseq->data[3]) == 1 &&
1861  modeseq->data[6] == 4 && abs(modeseq->data[7]) == 4)
1862  {
1863  eobmodesv5hm = 4;
1864  }
1865  if (
1866  nmodes == 5 &&
1867  modeseq->data[0] == 2 && abs(modeseq->data[1]) == 2 &&
1868  modeseq->data[4] == 3 && abs(modeseq->data[5]) == 3 &&
1869  modeseq->data[2] == 2 && abs(modeseq->data[3]) == 1 &&
1870  modeseq->data[6] == 4 && abs(modeseq->data[7]) == 4 &&
1871  modeseq->data[8] == 5 && abs(modeseq->data[9]) == 5)
1872  {
1873  eobmodesv5hm = 5;
1874  }
1875  if (
1876  nmodes == 6 &&
1877  modeseq->data[0] == 2 && abs(modeseq->data[1]) == 2 &&
1878  modeseq->data[4] == 3 && abs(modeseq->data[5]) == 3 &&
1879  modeseq->data[2] == 2 && abs(modeseq->data[3]) == 1 &&
1880  modeseq->data[8] == 4 && abs(modeseq->data[9]) == 4 &&
1881  modeseq->data[10] == 5 && abs(modeseq->data[11]) == 5 &&
1882  modeseq->data[6] == 3 && abs(modeseq->data[7]) == 2)
1883  {
1884  eobmodesv5hm = 6;
1885  }
1886  }
1887  ret = XLALSimIMRSEOBNRv5HMROM(hptilde, hctilde,
1888  phiRef, deltaF, f_min, f_max, f_ref, distance, inclination, m1, m2, S1z, S2z, -1, eobmodesv5hm, true, params);
1889  XLALDestroyINT2Sequence(modeseq);
1890  XLALDestroyValue(mode_arr);
1891  XLALDestroyDict(pars_aux);
1892  break;
1893 
1894  case SEOBNRv4_ROM_NRTidal:
1895 
1896  /* Waveform-specific sanity checks */
1898  XLAL_ERROR(XLAL_EINVAL, "Non-default flags given, but this approximant does not support this case.");
1899  if (!checkTransverseSpinsZero(S1x, S1y, S2x, S2y))
1900  XLAL_ERROR(XLAL_EINVAL, "Non-zero transverse spins were given, but this is a non-precessing approximant.");
1901  if (lambda1 < 0 || lambda2 < 0)
1902  XLAL_ERROR(XLAL_EFUNC, "lambda1 = %f, lambda2 = %f. Both should be greater than zero for SEOBNRv4_ROM_NRTidal", lambda1, lambda2);
1904  XLAL_CHECK(XLAL_SUCCESS == ret, ret, "Failed to set QuadMon from Lambdas for SEOBNRv4_ROM_NRTidal");
1905  ret = XLALSimIMRSEOBNRv4ROMNRTidal(hptilde, hctilde, phiRef, deltaF, f_min, f_max, f_ref, distance, inclination, m1, m2, S1z, S2z, lambda1, lambda2, params, NRTidal_V);
1906  break;
1907 
1909  /* Waveform-specific sanity checks */
1911  XLAL_ERROR(XLAL_EINVAL, "Non-default flags given, but this approximant does not support this case.");
1912  if (!checkTransverseSpinsZero(S1x, S1y, S2x, S2y))
1913  XLAL_ERROR(XLAL_EINVAL, "Non-zero transverse spins were given, but this is a non-precessing approximant.");
1914  if (lambda1 < 0 || lambda2 < 0)
1915  XLAL_ERROR(XLAL_EFUNC, "lambda1 = %f, lambda2 = %f. Both should be greater than zero for SEOBNRv4_ROM_NRTidal", lambda1, lambda2);
1917  XLAL_CHECK(XLAL_SUCCESS == ret, ret, "Failed to set QuadMon from Lambdas for SEOBNRv4_ROM_NRTidalv2");
1918  ret = XLALSimIMRSEOBNRv4ROMNRTidal(hptilde, hctilde, phiRef, deltaF, f_min, f_max, f_ref, distance, inclination, m1, m2, S1z, S2z, lambda1, lambda2, params, NRTidalv2_V);
1919  break;
1920 
1922  /* Waveform-specific sanity checks */
1924  XLAL_ERROR(XLAL_EINVAL, "Non-default flags given, but this approximant does not support this case.");
1925  if (!checkTransverseSpinsZero(S1x, S1y, S2x, S2y))
1926  XLAL_ERROR(XLAL_EINVAL, "Non-zero transverse spins were given, but this is a non-precessing approximant.");
1927  if (m1 < m2)
1928  XLAL_ERROR(XLAL_EDOM, "m1 = %e, m2=%e. m1 should be greater than or equal to m2 for SEOBNRv4_ROM_NRTidalv2_NSBH", m1, m2);
1929  if (lambda1 != 0)
1930  XLAL_ERROR(XLAL_EDOM, "lambda1 = %f. lambda1 should be zero for SEOBNRv4_ROM_NRTidalv2_NSBH", lambda1);
1931  if (lambda2 < 0)
1932  XLAL_ERROR(XLAL_EDOM, "lambda2 = %f. lambda2 should be nonnegative for SEOBNRv4_ROM_NRTidalv2_NSBH", lambda2);
1933  if (lambda2 > 5000)
1934  XLAL_ERROR(XLAL_EDOM, "lambda2 = %f. lambda2 should be < 5000", lambda2);
1935  if (S2z != 0)
1936  XLAL_PRINT_WARNING("WARNING: S2z = %f. SEOBNRv4_ROM_NRTidalv2_NSBH is calibrated to NR data for which the NS spin is zero.", S2z);
1937  if (m2 < 1 * LAL_MSUN_SI)
1938  XLAL_PRINT_WARNING("WARNING: m2=%e MSun. SEOBNRv4_ROM_NRTidalv2_NSBH is calibrated to NR data for which the NS mass is >=1 solar mass.", m2 / LAL_MSUN_SI);
1939  if (m2 > 3 * LAL_MSUN_SI)
1940  XLAL_ERROR(XLAL_EDOM, "m2=%e Msun. NS Mass should be <=3 solar masses", m2 / LAL_MSUN_SI);
1941  if (m1 / m2 > 100)
1942  XLAL_ERROR(XLAL_EDOM, "m1/m2=%e mass ratio should be < 100", m1 / m2);
1943 
1944  ret = XLALSimIMRSEOBNRv4ROMNRTidal(hptilde, hctilde, phiRef, deltaF, f_min, f_max, f_ref, distance, inclination, m1, m2, S1z, S2z, lambda1, lambda2, params, NRTidalv2NSBH_V);
1945  break;
1946 
1947  case SEOBNRv4T_surrogate:
1948  /* Waveform-specific sanity checks */
1950  XLAL_ERROR(XLAL_EINVAL, "Non-default flags given, but this approximant does not support this case.");
1951  if (!checkTransverseSpinsZero(S1x, S1y, S2x, S2y))
1952  XLAL_ERROR(XLAL_EINVAL, "Non-zero transverse spins were given, but this is a non-precessing approximant.");
1953 
1954  ret = XLALSimIMRSEOBNRv4TSurrogate(hptilde, hctilde, phiRef, deltaF, f_min, f_max, f_ref, distance, inclination, m1, m2, S1z, S2z, lambda1, lambda2, SEOBNRv4TSurrogate_CUBIC);
1955  break;
1956 
1958  /* Waveform-specific sanity checks */
1960  XLAL_ERROR(XLAL_EINVAL, "Non-default flags given, but this approximant does not support this case.");
1961  if (!checkTransverseSpinsZero(S1x, S1y, S2x, S2y))
1962  XLAL_ERROR(XLAL_EINVAL, "Non-zero transverse spins were given, but this is a non-precessing approximant.");
1963  ret = XLALSimIMRLackeyTidal2013(hptilde, hctilde, phiRef, deltaF, f_min, f_max, f_ref, distance, inclination, m1, m2, S1z, lambda2);
1964  break;
1965 
1966  case IMRPhenomP:
1967  /* Waveform-specific sanity checks */
1969  XLAL_ERROR(XLAL_EINVAL, "Non-default LALSimInspiralFrameAxis provided, but this approximant does not use that flag."); /* Default is LAL_SIM_INSPIRAL_FRAME_AXIS_ORBITAL_L : z-axis along direction of orbital angular momentum. */
1970  if (!XLALSimInspiralWaveformParamsModesChoiceIsDefault( /* Default is (2,2) or l=2 modes. */ params))
1971  XLAL_ERROR(XLAL_EINVAL, "Non-default LALSimInspiralModesChoice provided, but this approximant does not use that flag.");
1972  if (!checkTidesZero(lambda1, lambda2))
1973  XLAL_ERROR(XLAL_EINVAL, "Non-zero tidal parameters were given, but this is approximant doe not have tidal corrections.");
1974  /* Tranform to model parameters */
1975  if (f_ref == 0.0)
1976  f_ref = f_min; /* Default reference frequency is minimum frequency */
1977  XLALSimIMRPhenomPCalculateModelParametersFromSourceFrame(&chi1_l, &chi2_l, &chip, &thetaJN, &alpha0, &phi_aligned, &zeta_polariz, m1, m2, f_ref, phiRef, inclination, S1x, S1y, S1z, S2x, S2y, S2z, IMRPhenomPv1_V);
1978  /* Call the waveform driver routine */
1979  ret = XLALSimIMRPhenomP(hptilde, hctilde, chi1_l, chi2_l, chip, thetaJN, m1, m2, distance, alpha0, phi_aligned, deltaF, f_min, f_max, f_ref, IMRPhenomPv1_V, NoNRT_V, params);
1980  if (ret == XLAL_FAILURE)
1982  for (UINT4 idx = 0; idx < (*hptilde)->data->length; idx++) {
1983  PhPpolp = (*hptilde)->data->data[idx];
1984  PhPpolc = (*hctilde)->data->data[idx];
1985  (*hptilde)->data->data[idx] = cos(2. * zeta_polariz) * PhPpolp + sin(2. * zeta_polariz) * PhPpolc;
1986  (*hctilde)->data->data[idx] = cos(2. * zeta_polariz) * PhPpolc - sin(2. * zeta_polariz) * PhPpolp;
1987  }
1988  break;
1989 
1990  case IMRPhenomPv2:
1991  /* Waveform-specific sanity checks */
1993  XLAL_ERROR(XLAL_EINVAL, "Non-default LALSimInspiralFrameAxis provided, but this approximant does not use that flag."); /* Default is LAL_SIM_INSPIRAL_FRAME_AXIS_ORBITAL_L : z-axis along direction of orbital angular momentum. */
1994  if (!XLALSimInspiralWaveformParamsModesChoiceIsDefault( /* Default is (2,2) or l=2 modes. */ params))
1995  XLAL_ERROR(XLAL_EINVAL, "Non-default LALSimInspiralModesChoice provided, but this approximant does not use that flag.");
1996  if (!checkTidesZero(lambda1, lambda2))
1997  XLAL_ERROR(XLAL_EINVAL, "Non-zero tidal parameters were given, but this is approximant doe not have tidal corrections.");
1998  /* Tranform to model parameters */
1999  if (f_ref == 0.0)
2000  f_ref = f_min; /* Default reference frequency is minimum frequency */
2001  XLALSimIMRPhenomPCalculateModelParametersFromSourceFrame(&chi1_l, &chi2_l, &chip, &thetaJN, &alpha0, &phi_aligned, &zeta_polariz, m1, m2, f_ref, phiRef, inclination, S1x, S1y, S1z, S2x, S2y, S2z, IMRPhenomPv2_V);
2002  /* Call the waveform driver routine */
2003  ret = XLALSimIMRPhenomP(hptilde, hctilde, chi1_l, chi2_l, chip, thetaJN, m1, m2, distance, alpha0, phi_aligned, deltaF, f_min, f_max, f_ref, IMRPhenomPv2_V, NoNRT_V, params);
2004  if (ret == XLAL_FAILURE)
2006  for (UINT4 idx = 0; idx < (*hptilde)->data->length; idx++) {
2007  PhPpolp = (*hptilde)->data->data[idx];
2008  PhPpolc = (*hctilde)->data->data[idx];
2009  (*hptilde)->data->data[idx] = cos(2. * zeta_polariz) * PhPpolp + sin(2. * zeta_polariz) * PhPpolc;
2010  (*hctilde)->data->data[idx] = cos(2. * zeta_polariz) * PhPpolc - sin(2. * zeta_polariz) * PhPpolp;
2011  }
2012  break;
2013 
2014  case IMRPhenomPv2_NRTidal:
2015  /* Waveform-specific sanity checks */
2017  XLAL_ERROR(XLAL_EINVAL, "Non-default LALSimInspiralFrameAxis provided, but this approximant does not use that flag."); /* Default is LAL_SIM_INSPIRAL_FRAME_AXIS_ORBITAL_L : z-axis along direction of orbital angular momentum. */
2018  if (!XLALSimInspiralWaveformParamsModesChoiceIsDefault( /* Default is (2,2) or l=2 modes. */ params))
2019  XLAL_ERROR(XLAL_EINVAL, "Non-default LALSimInspiralModesChoice provided, but this approximant does not use that flag.");
2020  /* Tranform to model parameters */
2021  if (f_ref == 0.0)
2022  f_ref = f_min; /* Default reference frequency is minimum frequency */
2023  XLALSimIMRPhenomPCalculateModelParametersFromSourceFrame(&chi1_l, &chi2_l, &chip, &thetaJN, &alpha0, &phi_aligned, &zeta_polariz, m1, m2, f_ref, phiRef, inclination, S1x, S1y, S1z, S2x, S2y, S2z, IMRPhenomPv2NRTidal_V);
2024  /* Call the waveform driver routine */
2025  ret = XLALSimIMRPhenomP(hptilde, hctilde, chi1_l, chi2_l, chip, thetaJN, m1, m2, distance, alpha0, phi_aligned, deltaF, f_min, f_max, f_ref, IMRPhenomPv2NRTidal_V, NRTidal_V, params);
2026  if (ret == XLAL_FAILURE)
2028  for (UINT4 idx = 0; idx < (*hptilde)->data->length; idx++) {
2029  PhPpolp = (*hptilde)->data->data[idx];
2030  PhPpolc = (*hctilde)->data->data[idx];
2031  (*hptilde)->data->data[idx] = cos(2. * zeta_polariz) * PhPpolp + sin(2. * zeta_polariz) * PhPpolc;
2032  (*hctilde)->data->data[idx] = cos(2. * zeta_polariz) * PhPpolc - sin(2. * zeta_polariz) * PhPpolp;
2033  }
2034  break;
2036  /* Waveform-specific sanity checks */
2038  XLAL_ERROR(XLAL_EINVAL, "Non-default LALSimInspiralFrameAxis provided, but this approximant does not use that flag."); /* Default is LAL_SIM_INSPIRAL_FRAME_AXIS_ORBITAL_L : z-axis along direction of orbital angular momentum. */
2039  if (!XLALSimInspiralWaveformParamsModesChoiceIsDefault( /* Default is (2,2) or l=2 modes. */ params))
2040  XLAL_ERROR(XLAL_EINVAL, "Non-default LALSimInspiralModesChoice provided, but this approximant does not use that flag.");
2041  /* Tranform to model parameters */
2042  if (f_ref == 0.0)
2043  f_ref = f_min; /* Default reference frequency is minimum frequency */
2044  XLALSimIMRPhenomPCalculateModelParametersFromSourceFrame(&chi1_l, &chi2_l, &chip, &thetaJN, &alpha0, &phi_aligned, &zeta_polariz, m1, m2, f_ref, phiRef, inclination, S1x, S1y, S1z, S2x, S2y, S2z, IMRPhenomPv2NRTidal_V);
2045  /* Call the waveform driver routine */
2046  ret = XLALSimIMRPhenomP(hptilde, hctilde, chi1_l, chi2_l, chip, thetaJN, m1, m2, distance, alpha0, phi_aligned, deltaF, f_min, f_max, f_ref, IMRPhenomPv2NRTidal_V, NRTidalv2_V, params);
2047  if (ret == XLAL_FAILURE)
2049  for (UINT4 idx = 0; idx < (*hptilde)->data->length; idx++) {
2050  PhPpolp = (*hptilde)->data->data[idx];
2051  PhPpolc = (*hctilde)->data->data[idx];
2052  (*hptilde)->data->data[idx] = cos(2. * zeta_polariz) * PhPpolp + sin(2. * zeta_polariz) * PhPpolc;
2053  (*hctilde)->data->data[idx] = cos(2. * zeta_polariz) * PhPpolc - sin(2. * zeta_polariz) * PhPpolp;
2054  }
2055  break;
2056 
2057  case IMRPhenomPv3:
2058  /* Waveform-specific sanity checks */
2060  XLAL_ERROR(XLAL_EINVAL, "Non-default LALSimInspiralFrameAxis provided, but this approximant does not use that flag."); /* Default is LAL_SIM_INSPIRAL_FRAME_AXIS_ORBITAL_L : z-axis along direction of orbital angular momentum. */
2061  if (!XLALSimInspiralWaveformParamsModesChoiceIsDefault( /* Default is (2,2) or l=2 modes. */ params))
2062  XLAL_ERROR(XLAL_EINVAL, "Non-default LALSimInspiralModesChoice provided, but this approximant does not use that flag.");
2063  if (!checkTidesZero(lambda1, lambda2))
2064  XLAL_ERROR(XLAL_EINVAL, "Non-zero tidal parameters were given, but this is approximant doe not have tidal corrections.");
2065  /* Tranform to model parameters */
2066  if (f_ref == 0.0)
2067  f_ref = f_min; /* Default reference frequency is minimum frequency */
2068  REAL8Sequence *freqspv3 = XLALCreateREAL8Sequence(2);
2069  freqspv3->data[0] = f_min;
2070  freqspv3->data[1] = f_max;
2071  ret = XLALSimIMRPhenomPv3(hptilde, hctilde, freqspv3, m1, m2, S1x, S1y, S1z, S2x, S2y, S2z, distance, inclination, phiRef, deltaF, f_ref, params);
2072  if (ret == XLAL_FAILURE)
2074  XLALDestroyREAL8Sequence(freqspv3);
2075  break;
2076 
2077  case IMRPhenomPv3HM:
2078  /* Waveform-specific sanity checks */
2080  XLAL_ERROR(XLAL_EINVAL, "Non-default LALSimInspiralFrameAxis provided, but this approximant does not use that flag."); /* Default is LAL_SIM_INSPIRAL_FRAME_AXIS_ORBITAL_L : z-axis along direction of orbital angular momentum. */
2081  if (!XLALSimInspiralWaveformParamsModesChoiceIsDefault( /* Default is (2,2) or l=2 modes. */ params))
2082  XLAL_ERROR(XLAL_EINVAL, "Non-default LALSimInspiralModesChoice provided, but this approximant does not use that flag.");
2083  if (!checkTidesZero(lambda1, lambda2))
2084  XLAL_ERROR(XLAL_EINVAL, "Non-zero tidal parameters were given, but this is approximant doe not have tidal corrections.");
2085  /* Tranform to model parameters */
2086  if (f_ref == 0.0)
2087  f_ref = f_min; /* Default reference frequency is minimum frequency */
2088 
2089  REAL8Sequence *freqspv3hm = XLALCreateREAL8Sequence(2);
2090  freqspv3hm->data[0] = f_min;
2091  freqspv3hm->data[1] = f_max;
2092  ret = XLALSimIMRPhenomPv3HMGetHplusHcross(hptilde, hctilde, freqspv3hm, m1, m2, S1x, S1y, S1z, S2x, S2y, S2z, distance, inclination, phiRef, deltaF, f_ref, params);
2093 
2094  if (ret == XLAL_FAILURE)
2096  XLALDestroyREAL8Sequence(freqspv3hm);
2097 
2098  break;
2099 
2100  case SpinTaylorT4Fourier:
2101  /* Waveform-specific sanity checks */
2103  XLAL_ERROR(XLAL_EINVAL, "Non-default LALSimInspiralFrameAxis provided, but this approximant does not use that flag.");
2105  XLAL_ERROR(XLAL_EINVAL, "Non-default LALSimInspiralModesChoice provided, but this approximant does not use that flag.");
2106  spin1x = S1x;
2107  spin1y = S1y;
2108  spin1z = S1z;
2109  spin2x = S2x;
2110  spin2y = S2y;
2111  spin2z = S2z;
2112  ROTATEY(inclination, spin1x, spin1y, spin1z);
2113  ROTATEY(inclination, spin2x, spin2y, spin2z);
2114  LNhatx = sin(inclination);
2115  LNhaty = 0.;
2116  LNhatz = cos(inclination);
2117  E1x = 0.;
2118  E1y = 1.;
2119  E1z = 0.;
2120  // default kMax = 3
2121  kMax = 3;
2122  // default v0 = 1
2123  v0 = 1.;
2124  // default fStart = 0.9*fMin
2125  fStart = 0.9 * f_min;
2126  phiRefAtEnd = 0;
2127  // if f_ref = 0, set it to f_min, and tell the driver routine that we came from there
2128  if (f_ref == 0) {
2129  f_ref = f_min;
2130  phiRefAtEnd = 1;
2131  }
2132  // default quadparams are for black holes. Replace by ~2-12 for neutron stars
2133  /* Call the waveform driver routine */
2134  ret = XLALSimInspiralSpinTaylorT4Fourier(hptilde, hctilde,
2135  f_min, f_max, deltaF, kMax, phiRef, v0, m1, m2, fStart, f_ref, distance, spin1x, spin1y, spin1z, spin2x, spin2y, spin2z, LNhatx, LNhaty, LNhatz, E1x, E1y, E1z, lambda1, lambda2, quadparam1, quadparam2,
2136  params, phaseO, amplitudeO, phiRefAtEnd);
2137  if (ret == XLAL_FAILURE)
2139  break;
2140 
2141  case SpinTaylorT5Fourier:
2142  /* Waveform-specific sanity checks */
2144  XLAL_ERROR(XLAL_EINVAL, "Non-default LALSimInspiralFrameAxis provided, but this approximant does not use that flag.");
2146  XLAL_ERROR(XLAL_EINVAL, "Non-default LALSimInspiralModesChoice provided, but this approximant does not use that flag.");
2147  spin1x = S1x;
2148  spin1y = S1y;
2149  spin1z = S1z;
2150  spin2x = S2x;
2151  spin2y = S2y;
2152  spin2z = S2z;
2153  ROTATEY(inclination, spin1x, spin1y, spin1z);
2154  ROTATEY(inclination, spin2x, spin2y, spin2z);
2155  LNhatx = sin(inclination);
2156  LNhaty = 0.;
2157  LNhatz = cos(inclination);
2158  E1x = 0.;
2159  E1y = 1.;
2160  E1z = 0.;
2161  // default kMax = 3
2162  kMax = 3;
2163  // default v0 = 1
2164  v0 = 1.;
2165  // default fStart = 0.9*fMin
2166  fStart = 0.9 * f_min;
2167  phiRefAtEnd = 0;
2168  // if f_ref = 0, set it to f_min, and tell the driver routine that we came from there
2169  if (f_ref == 0) {
2170  f_ref = f_min;
2171  phiRefAtEnd = 1;
2172  }
2173  // default quadparams are for black holes. Replace by ~2-12 for neutron stars
2174  /* Call the waveform driver routine */
2175  ret = XLALSimInspiralSpinTaylorT5Fourier(hptilde, hctilde,
2176  f_min, f_max, deltaF, kMax, phiRef, v0, m1, m2, fStart, f_ref, distance, spin1x, spin1y, spin1z, spin2x, spin2y, spin2z, LNhatx, LNhaty, LNhatz, E1x, E1y, E1z, lambda1, lambda2, quadparam1, quadparam2,
2177  params, phaseO, amplitudeO, phiRefAtEnd);
2178  if (ret == XLAL_FAILURE)
2180  break;
2181 
2182 
2183  case NRSur4d2s:
2184 
2185  ret = XLALSimNRSur4d2s(hptilde, hctilde, phiRef, deltaF, f_min, f_max, distance, inclination, m1, m2, S1x, S1y, S1z, S2x, S2y, S2z);
2186  if (ret == XLAL_FAILURE)
2188  break;
2189 
2190  case IMRPhenomXAS:
2191  {
2192  /* Waveform-specific sanity checks */
2194  XLAL_ERROR(XLAL_EINVAL, "Non-default flags given, but this approximant does not support this case.");
2195  if (!checkTransverseSpinsZero(S1x, S1y, S2x, S2y))
2196  XLAL_ERROR(XLAL_EINVAL, "Non-zero transverse spins were given, but this is a non-precessing approximant.");
2197  if (!checkTidesZero(lambda1, lambda2))
2198  XLAL_ERROR(XLAL_EINVAL, "Non-zero tidal parameters were given, but this is approximant doe not have tidal corrections.");
2199 
2200  /* This is the factor that comes from Y_22star + (-1)^l * Y_2-2 without the dependence in inclination, that is included in pfac and cfac */
2201  /* Ylm(inclination, beta), with beta = PI/2 - phiRef. phiRef is included in the individual mode */
2202  COMPLEX16 Ylmfactor = 2.0 * sqrt(5.0 / (64.0 * LAL_PI)) * cexp(-I * 2 * (LAL_PI_2));
2203  /* The factor for hc is the same but opposite sign */
2204 
2205  /* Call the waveform driver routine. */
2206  /* It returns h_2-2(f) for positive frequencies. h_2-2 is zero for negative frequencies. */
2207  /* h_22(f) is zero for positive frequencies. For negatives frequencies h_22(f) = Conjugate[h_2-2(-f)] */
2208  /* We returns h2_-2 because it is the mode with the positive frequencies,
2209  and we need this mode because XLALSimInspiralTDFromFD assumes that the input array is in the positive frequencies regime. */
2210  ret = XLALSimIMRPhenomXASGenerateFD(hptilde, m1, m2, S1z, S2z, distance, f_min, f_max, deltaF, phiRef, f_ref, params);
2211  if (ret == XLAL_FAILURE)
2213 
2214  /* Produce both polarizations for positive frequencies */
2215  *hctilde = XLALCreateCOMPLEX16FrequencySeries("FD hcross", &((*hptilde)->epoch), (*hptilde)->f0, (*hptilde)->deltaF, &((*hptilde)->sampleUnits), (*hptilde)->data->length);
2216  for (j = 0; j < (*hptilde)->data->length; j++) {
2217  (*hctilde)->data->data[j] = -I * cfac * (*hptilde)->data->data[j] * Ylmfactor;
2218  (*hptilde)->data->data[j] *= pfac * Ylmfactor;
2219  }
2220  break;
2221  }
2222 
2224  {
2225  /* Waveform-specific sanity checks */
2227  XLAL_ERROR(XLAL_EINVAL, "Non-default flags given, but this approximant does not support this case.");
2228  if( !checkTransverseSpinsZero(S1x, S1y, S2x, S2y) )
2229  XLAL_ERROR(XLAL_EINVAL, "Non-zero transverse spins were given, but this is a non-precessing approximant.");
2230 
2231  LALDict *LALparams_aux;
2232  if (params == NULL)
2233  LALparams_aux = XLALCreateDict();
2234  else
2235  LALparams_aux = XLALDictDuplicate(params);
2236 
2237  /* PhenomXTidalFlag maps to the NRTidalv* version used: 2-> NRTidalv2 */
2239 
2240  /* to employ multibanding, we need to call XHM: hence, we activate a reduced mode array */
2241  LALValue *ModeArray = XLALSimInspiralCreateModeArray();
2242  XLALSimInspiralModeArrayActivateMode(ModeArray, 2, 2);
2243  XLALSimInspiralModeArrayActivateMode(ModeArray, 2, -2);
2244  XLALSimInspiralWaveformParamsInsertModeArray(LALparams_aux, ModeArray);
2245 
2246  ret = XLALSimIMRPhenomXHM(hptilde, hctilde, m1, m2, S1z, S2z, f_min, f_max, deltaF, distance, inclination, phiRef, f_ref, LALparams_aux);
2247 
2248  XLALDestroyValue(ModeArray);
2249 
2250  if (ret == XLAL_FAILURE)
2252 
2253  XLALDestroyDict(LALparams_aux);
2254 
2255  break;
2256  }
2257  case IMRPhenomXHM:
2258  /* Waveform-specific sanity checks */
2260  XLAL_ERROR(XLAL_EINVAL, "Non-default flags given, but this approximant does not support this case.");
2261  if (!checkTransverseSpinsZero(S1x, S1y, S2x, S2y))
2262  XLAL_ERROR(XLAL_EINVAL, "Non-zero transverse spins were given, but this is a non-precessing approximant.");
2263  if (!checkTidesZero(lambda1, lambda2))
2264  XLAL_ERROR(XLAL_EINVAL, "Non-zero tidal parameters were given, but this is approximant doe not have tidal corrections.");
2265 
2266  /* Activate or not the debug info. */
2267 #ifndef PHENOMXHMDEBUG // Defined at compilation time. ./configure --prefix=... CFLAGS='-g -D PHENOMXHMDEBUG'
2268 #define DEBUG 0
2269 #else
2270 #define DEBUG 1 //print debugging info
2271 #endif
2272 
2273  /* Return hp and hc for positive frequencies. Only negatives modes contribute to positive frequencies. */
2274  /* The negative frquencies contribution is the complex conjugate of the positive one. */
2275 
2276  /* Take input/default value for the threshold of the Multibanding. If = 0 then do not use Multibanding. */
2278 
2279  /* If total mass is very high (>500 solar masses), we only have a few points in the ringdown, interpolation is not efficient, do not use Multibanding */
2280  REAL8 Mtot = (m1 + m2) / LAL_MSUN_SI;
2281  if (resTest != 0 && Mtot > 500) {
2282  resTest = 0.;
2283  }
2284 
2285  if (resTest == 0.) { //Do not use multibanding
2286  ret = XLALSimIMRPhenomXHM2(hptilde, hctilde, m1, m2, S1z, S2z, f_min, f_max, deltaF, distance, inclination, phiRef, f_ref, params);
2287  } else { // Use multibanding
2288  ret = XLALSimIMRPhenomXHM(hptilde, hctilde, m1, m2, S1z, S2z, f_min, f_max, deltaF, distance, inclination, phiRef, f_ref, params);
2289  }
2290 
2291  if (ret == XLAL_FAILURE)
2293 
2294 #if DEBUG == 1
2295  printf("\n\n**********Leaving ChooseFDWaveform *********************\n\n");
2296 #endif
2297 
2298  break;
2299 
2300  case IMRPhenomXP:
2301  /* Waveform-specific sanity checks */
2303  /* Default is LAL_SIM_INSPIRAL_FRAME_AXIS_ORBITAL_L : z-axis along direction of orbital angular momentum. */
2304  XLAL_ERROR(XLAL_EINVAL, "Non-default LALSimInspiralFrameAxis provided, but this approximant does not use that flag.");
2305  }
2307  /* Default is (2,2) or l=2 modes. */
2308  XLAL_ERROR(XLAL_EINVAL, "Non-default LALSimInspiralModesChoice provided, but this approximant does not use that flag.");
2309  }
2310  if (!checkTidesZero(lambda1, lambda2)) {
2311  XLAL_ERROR(XLAL_EINVAL, "Non-zero tidal parameters were given, but this is approximant doe not have tidal corrections.");
2312  }
2313  if (f_ref == 0.0) {
2314  /* Default reference frequency is minimum frequency */
2315  f_ref = f_min;
2316  }
2317 
2318  /* Call the main waveform driver. Note that we pass the full spin vectors
2319  with XLALSimIMRPhenomXPCalculateModelParametersFromSourceFrame being
2320  effectively called in the initialization of the pPrec struct
2321  */
2322  ret = XLALSimIMRPhenomXPGenerateFD(hptilde, hctilde, m1, m2, S1x, S1y, S1z, S2x, S2y, S2z, distance, inclination, phiRef, f_min, f_max, deltaF, f_ref, params);
2323  if (ret == XLAL_FAILURE) {
2325  }
2326 
2327  break;
2328 
2329 
2330  case IMRPhenomXP_NRTidalv2:
2331 
2332  {
2333 
2334  /* Waveform-specific sanity checks */
2336  {
2337  /* Default is LAL_SIM_INSPIRAL_FRAME_AXIS_ORBITAL_L : z-axis along direction of orbital angular momentum. */
2338  XLAL_ERROR(XLAL_EINVAL, "Non-default LALSimInspiralFrameAxis provided, but this approximant does not use that flag.");
2339  }
2341  {
2342  /* Default is (2,2) or l=2 modes. */
2343  XLAL_ERROR(XLAL_EINVAL, "Non-default LALSimInspiralModesChoice provided, but this approximant does not use that flag.");
2344  }
2345 
2346  LALDict *LALparams_aux;
2347  if (params == NULL) LALparams_aux = XLALCreateDict();
2348  else LALparams_aux = XLALDictDuplicate(params);
2349 
2350  /* PhenomXTidalFlag maps to the NRTidalv* version used: 2-> NRTidalv2 */
2352 
2353  /* to employ multibanding, we need to call XPHM: hence, we activate a reduced mode array */
2354  LALValue *ModeArray = XLALSimInspiralCreateModeArray();
2355  XLALSimInspiralModeArrayActivateMode(ModeArray, 2, 2);
2356  XLALSimInspiralModeArrayActivateMode(ModeArray, 2, -2);
2357  XLALSimInspiralWaveformParamsInsertModeArray(LALparams_aux, ModeArray);
2358 
2359  // Insert quadrupole parameters for use in twisting up
2360  ret = XLALSimInspiralSetQuadMonParamsFromLambdas(LALparams_aux);
2361  XLAL_CHECK(XLAL_SUCCESS == ret, ret, "Failed to set quadrupole parameters from lambdas for IMRPhenomXP_NRTidalv2");
2362 
2363  if(f_ref==0.0)
2364  {
2365  /* Default reference frequency is minimum frequency */
2366  f_ref = f_min;
2367  }
2368 
2369  ret = XLALSimIMRPhenomXPHM(hptilde, hctilde, m1, m2, S1x, S1y, S1z, S2x, S2y, S2z, distance, inclination,phiRef, f_min, f_max, deltaF, f_ref, LALparams_aux);
2370 
2371  XLALDestroyValue(ModeArray);
2372 
2373  if (ret == XLAL_FAILURE) XLAL_ERROR(XLAL_EFUNC);
2374 
2375  XLALDestroyDict(LALparams_aux);
2376 
2377  }
2378  break;
2379 
2380  case IMRPhenomXPHM:
2381  /* Waveform-specific sanity checks */
2383  /* Default is LAL_SIM_INSPIRAL_FRAME_AXIS_ORBITAL_L : z-axis along direction of orbital angular momentum. */
2384  XLAL_ERROR(XLAL_EINVAL, "Non-default LALSimInspiralFrameAxis provided, but this approximant does not use that flag.");
2385  }
2387  /* Default is (2,2) or l=2 modes. */
2388  XLAL_ERROR(XLAL_EINVAL, "Non-default LALSimInspiralModesChoice provided, but this approximant does not use that flag.");
2389  }
2390  if (!checkTidesZero(lambda1, lambda2)) {
2391  XLAL_ERROR(XLAL_EINVAL, "Non-zero tidal parameters were given, but this is approximant doe not have tidal corrections.");
2392  }
2393  if (f_ref == 0.0) {
2394  /* Default reference frequency is minimum frequency */
2395  f_ref = f_min;
2396  }
2397 
2398  /* Call the main waveform driver. Note that we pass the full spin vectors
2399  with XLALSimIMRPhenomXPCalculateModelParametersFromSourceFrame being
2400  effectively called in the initialization of the pPrec struct
2401  */
2403 
2404  if (usemodes == 0) {
2405  ret = XLALSimIMRPhenomXPHM(hptilde, hctilde, m1, m2, S1x, S1y, S1z, S2x, S2y, S2z, distance, inclination, phiRef, f_min, f_max, deltaF, f_ref, params);
2406  } else {
2407  ret = XLALSimIMRPhenomXPHMFromModes(hptilde, hctilde, m1, m2, S1x, S1y, S1z, S2x, S2y, S2z, distance, inclination, phiRef, f_min, f_max, deltaF, f_ref, params);
2408  }
2409 
2410  if (ret == XLAL_FAILURE) {
2412  }
2413 
2414  break;
2415 
2416  case IMRPhenomXO4a:
2417  {
2418  LALDict *params_aux;
2419  if (params == NULL){
2420  params_aux = XLALCreateDict();
2421  }
2422  else{
2423  params_aux = XLALDictDuplicate(params);
2424  }
2425 
2426  /* XO4 uses previous version of XHM */
2428 
2429  /* Waveform-specific sanity checks */
2431  {
2432  /* Default is LAL_SIM_INSPIRAL_FRAME_AXIS_ORBITAL_L : z-axis along direction of orbital angular momentum. */
2433  XLAL_ERROR(XLAL_EINVAL, "Non-default LALSimInspiralFrameAxis provided, but this approximant does not use that flag.");
2434  }
2436  {
2437  /* Default is (2,2) or l=2 modes. */
2438  XLAL_ERROR(XLAL_EINVAL, "Non-default LALSimInspiralModesChoice provided, but this approximant does not use that flag.");
2439  }
2440  if( !checkTidesZero(lambda1, lambda2) )
2441  {
2442  XLAL_ERROR(XLAL_EINVAL, "Non-zero tidal parameters were given, but this is approximant doe not have tidal corrections.");
2443  }
2444  if(f_ref==0.0)
2445  {
2446  /* Default reference frequency is minimum frequency */
2447  f_ref = f_min;
2448  }
2449 
2450  /* Call the main waveform driver. Note that we pass the full spin vectors
2451  with XLALSimIMRPhenomXPCalculateModelParametersFromSourceFrame being
2452  effectively called in the initialization of the pPrec struct
2453  */
2454 
2455  /* Toggle on PNR angles */
2456  if(!XLALDictContains(params_aux, "PNRUseTunedAngles")){
2458  }
2459 
2460  /* Toggle on tuned coprecessing strain */
2461  if(!XLALDictContains(params_aux, "PNRUseTunedCoprec")){
2463  }
2464  if(!XLALDictContains(params_aux, "PNRForceXHMAlignment")){
2466  }
2467 
2468  /* Toggle on antisymmetric contributions */
2469  if(!XLALDictContains(params_aux, "AntisymmetricWaveform")){
2471  }
2472 
2474  {
2476  {
2477  XLAL_ERROR(XLAL_EFUNC,"Error: Antisymmetric waveform generation not supported without PNR angles, please turn on PNR angles to produce waveform with asymmetries in the (2,2) and (2,-2) modes \n");
2478  }
2479  }
2480 
2481  /* Toggle on reviewed PrecVersion and FinalSpinMod */
2482  if(!XLALDictContains(params_aux, "PrecVersion")){
2484  }
2485 
2487 
2488  if(usemodes == 0){
2489  ret = XLALSimIMRPhenomXPHM(
2490  hptilde, hctilde,
2491  m1, m2,
2492  S1x, S1y, S1z,
2493  S2x, S2y, S2z,
2494  distance, inclination,
2495  phiRef, f_min, f_max, deltaF, f_ref, params_aux
2496  );
2497  }
2498  else{
2500  hptilde, hctilde,
2501  m1, m2,
2502  S1x, S1y, S1z,
2503  S2x, S2y, S2z,
2504  distance, inclination,
2505  phiRef, f_min, f_max, deltaF, f_ref, params_aux
2506  );
2507  }
2508 
2509  XLALDestroyDict(params_aux);
2510 
2511 
2512  if (ret == XLAL_FAILURE)
2513  {
2515  }
2516 
2517  break;
2518  }
2519  default:
2520  XLALPrintError("FD version of approximant not implemented in lalsimulation\n");
2522  }
2523 
2524  REAL8 polariz = longAscNodes;
2525  if (polariz) {
2526  COMPLEX16 tmpP, tmpC;
2527  for (UINT4 idx = 0; idx < (*hptilde)->data->length; idx++) {
2528  tmpP = (*hptilde)->data->data[idx];
2529  tmpC = (*hctilde)->data->data[idx];
2530  (*hptilde)->data->data[idx] = cos(2. * polariz) * tmpP + sin(2. * polariz) * tmpC;
2531  (*hctilde)->data->data[idx] = cos(2. * polariz) * tmpC - sin(2. * polariz) * tmpP;
2532  }
2533  }
2534 
2535  if (ret == XLAL_FAILURE)
2538  ret = XLALSimLorentzInvarianceViolationTerm(hptilde, hctilde, m1 / LAL_MSUN_SI, m2 / LAL_MSUN_SI, distance, params);
2539  if (ret == XLAL_FAILURE)
2541 
2542  return ret;
2543 }
2544 
2545 /**
2546  * Copy of the old code of XLALSimInspiralChooseTDModes(). The new version of XLALSimInspiralChooseTDModes() is just a wrapper over XLALSimInspiralGenerateTDModes().
2547  * XLALSimInspiralGenerateTDModes() internally calls this function for legacy approximants.
2548  */
2550  REAL8 phiRef, /* reference orbital phase (rad). This variable is not used and only kept here for backwards compatibility */
2551  REAL8 deltaT, /* sampling interval (s) */
2552  REAL8 m1, /* mass of companion 1 (kg) */
2553  REAL8 m2, /* mass of companion 2 (kg) */
2554  REAL8 S1x, /* x-component of the dimensionless spin of object 1 */
2555  REAL8 S1y, /* y-component of the dimensionless spin of object 1 */
2556  REAL8 S1z, /* z-component of the dimensionless spin of object 1 */
2557  REAL8 S2x, /* x-component of the dimensionless spin of object 2 */
2558  REAL8 S2y, /* y-component of the dimensionless spin of object 2 */
2559  REAL8 S2z, /* z-component of the dimensionless spin of object 2 */
2560  REAL8 f_min, /* starting GW frequency (Hz) */
2561  REAL8 f_ref, /* reference GW frequency (Hz) */
2562  REAL8 r, /* distance of source (m) */
2563  LALDict *LALpars, /* LAL dictionary containing accessory parameters */
2564  int lmax, /* generate all modes with l <= lmax */
2565  Approximant approximant /* post-Newtonian approximant to use for waveform production */
2566 )
2567 {
2568  XLALPrintWarning("WARNING: The phiRef argument in XLALSimInspiralChooseTDModes will be removed in the future and is currently not used. \n");
2569  REAL8 v0 = 1.;
2570  SphHarmTimeSeries *hlm = NULL;
2571  INT4 errCode = 0;
2572 
2573  /* SEOBNR flag for precessing model version. 3 for SEOBNRv3, 300 for SEOBNRv3_opt, 401 for SEOBNRv4P, 402 for SEOBNRv4PHM */
2574  UINT4 PrecEOBversion;
2575  REAL8 spin1[3], spin2[3];
2576 
2577  /* General sanity checks that will abort */
2578  /*
2579  * If non-GR approximants are added, change the below to
2580  * if( nonGRparams && approximant != nonGR1 && approximant != nonGR2 )
2581  */
2583  XLALPrintError("XLAL Error - %s: Passed in non-NULL pointer to LALSimInspiralTestGRParam for an approximant that does not use LALSimInspiralTestGRParam\n", __func__);
2585  }
2586 
2587  /* General sanity check the input parameters - only give warnings! */
2588  if (deltaT > 1.)
2589  XLALPrintWarning("XLAL Warning - %s: Large value of deltaT = %e requested.\nPerhaps sample rate and time step size were swapped?\n", __func__, deltaT);
2590  if (deltaT < 1. / 16385.)
2591  XLALPrintWarning("XLAL Warning - %s: Small value of deltaT = %e requested.\nCheck for errors, this could create very large time series.\n", __func__, deltaT);
2592  if (m1 < 0.09 * LAL_MSUN_SI)
2593  XLALPrintWarning("XLAL Warning - %s: Small value of m1 = %e (kg) = %e (Msun) requested.\nPerhaps you have a unit conversion error?\n", __func__, m1, m1 / LAL_MSUN_SI);
2594  if (m2 < 0.09 * LAL_MSUN_SI)
2595  XLALPrintWarning("XLAL Warning - %s: Small value of m2 = %e (kg) = %e (Msun) requested.\nPerhaps you have a unit conversion error?\n", __func__, m2, m2 / LAL_MSUN_SI);
2596  if (m1 + m2 > 1000. * LAL_MSUN_SI)
2597  XLALPrintWarning("XLAL Warning - %s: Large value of total mass m1+m2 = %e (kg) = %e (Msun) requested.\nSignal not likely to be in band of ground-based detectors.\n", __func__, m1 + m2, (m1 + m2) / LAL_MSUN_SI);
2598  if (S1x * S1x + S1y * S1y + S1z * S1z > 1.000001)
2599  XLALPrintWarning("XLAL Warning - %s: S1 = (%e,%e,%e) with norm > 1 requested.\nAre you sure you want to violate the Kerr bound?\n", __func__, S1x, S1y, S1z);
2600  if (S2x * S2x + S2y * S2y + S2z * S2z > 1.000001)
2601  XLALPrintWarning("XLAL Warning - %s: S2 = (%e,%e,%e) with norm > 1 requested.\nAre you sure you want to violate the Kerr bound?\n", __func__, S2x, S2y, S2z);
2602  if (f_min < 1.)
2603  XLALPrintWarning("XLAL Warning - %s: Small value of fmin = %e requested.\nCheck for errors, this could create a very long waveform.\n", __func__, f_min);
2604  if (f_min > 40.000001)
2605  XLALPrintWarning("XLAL Warning - %s: Large value of fmin = %e requested.\nCheck for errors, the signal will start in band.\n", __func__, f_min);
2606 
2609  int amplitudeO = XLALSimInspiralWaveformParamsLookupPNAmplitudeOrder(LALpars);
2611  UINT4 l;
2612 
2613  switch (approximant) {
2614  case TaylorT1:
2615  /* Waveform-specific sanity checks */
2616  if (!checkSpinsZero(S1x, S1y, S1z, S2x, S2y, S2z))
2617  XLAL_ERROR_NULL(XLAL_EINVAL, "Non-zero spins were given, but this is a non-spinning approximant.");
2619  XLAL_ERROR_NULL(XLAL_EINVAL, "Non-default LALSimInspiralFrameAxis provided, but this approximant does not use that flag.");
2621  XLAL_ERROR_NULL(XLAL_EINVAL, "Non-default LALSimInspiralModesChoice provided, but this approximant does not use that flag.");
2622  /* Call the waveform driver routine */
2623  hlm = XLALSimInspiralTaylorT1PNModes(v0, deltaT, m1, m2, f_min, f_ref, r, lambda1, lambda2, XLALSimInspiralWaveformParamsLookupPNTidalOrder(LALpars), amplitudeO, phaseO, lmax);
2624  break;
2625  case TaylorT2:
2626  /* Waveform-specific sanity checks */
2627  if (!checkSpinsZero(S1x, S1y, S1z, S2x, S2y, S2z))
2628  XLAL_ERROR_NULL(XLAL_EINVAL, "Non-zero spins were given, but this is a non-spinning approximant.");
2630  XLAL_ERROR_NULL(XLAL_EINVAL, "Non-default LALSimInspiralFrameAxis provided, but this approximant does not use that flag.");
2632  XLAL_ERROR_NULL(XLAL_EINVAL, "Non-default LALSimInspiralModesChoice provided, but this approximant does not use that flag.");
2633  /* Call the waveform driver routine */
2634  hlm = XLALSimInspiralTaylorT2PNModes(v0, deltaT, m1, m2, f_min, f_ref, r, lambda1, lambda2, XLALSimInspiralWaveformParamsLookupPNTidalOrder(LALpars), amplitudeO, phaseO, lmax);
2635  break;
2636  case TaylorT3:
2637  /* Waveform-specific sanity checks */
2638  if (!checkSpinsZero(S1x, S1y, S1z, S2x, S2y, S2z))
2639  XLAL_ERROR_NULL(XLAL_EINVAL, "Non-zero spins were given, but this is a non-spinning approximant.");
2641  XLAL_ERROR_NULL(XLAL_EINVAL, "Non-default LALSimInspiralFrameAxis provided, but this approximant does not use that flag.");
2643  XLAL_ERROR_NULL(XLAL_EINVAL, "Non-default LALSimInspiralModesChoice provided, but this approximant does not use that flag.");
2644  /* Call the waveform driver routine */
2645  hlm = XLALSimInspiralTaylorT3PNModes(v0, deltaT, m1, m2, f_min, f_ref, r, lambda1, lambda2, 0, amplitudeO, phaseO, lmax);
2646  break;
2647  case TaylorT4:
2648  /* Waveform-specific sanity checks */
2649  if (!checkSpinsZero(S1x, S1y, S1z, S2x, S2y, S2z))
2650  XLAL_ERROR_NULL(XLAL_EINVAL, "Non-zero spins were given, but this is a non-spinning approximant.");
2652  XLAL_ERROR_NULL(XLAL_EINVAL, "Non-default LALSimInspiralFrameAxis provided, but this approximant does not use that flag.");
2654  XLAL_ERROR_NULL(XLAL_EINVAL, "Non-default LALSimInspiralModesChoice provided, but this approximant does not use that flag.");
2655  /* Call the waveform driver routine */
2656  hlm = XLALSimInspiralTaylorT4PNModes(v0, deltaT, m1, m2, f_min, f_ref, r, lambda1, lambda2, 0, amplitudeO, phaseO, lmax);
2657  break;
2658  case EOBNRv2:
2659  case EOBNRv2HM:
2660  /* Waveform-specific sanity checks */
2661  if (!checkSpinsZero(S1x, S1y, S1z, S2x, S2y, S2z))
2662  XLAL_ERROR_NULL(XLAL_EINVAL, "Non-zero spins were given, but this is a non-spinning approximant.");
2664  XLAL_ERROR_NULL(XLAL_EINVAL, "Non-default LALSimInspiralFrameAxis provided, but this approximant does not use that flag.");
2666  XLAL_ERROR_NULL(XLAL_EINVAL, "Non-default LALSimInspiralModesChoice provided, but this approximant does not use that flag.");
2667  /* Call the waveform driver routine */
2668  hlm = XLALSimIMREOBNRv2Modes(deltaT, m1, m2, f_min, r);
2669  // EOB driver only outputs modes with m>0, add m<0 modes by symmetry
2670  size_t j;
2671  int m;
2672  for (l = 2; l <= XLALSphHarmTimeSeriesGetMaxL(hlm); l++) {
2673  for (m = -l; m < 0; m++) {
2675  if (!inmode)
2676  continue;
2677  COMPLEX16TimeSeries *tmpmode = XLALCutCOMPLEX16TimeSeries(inmode, 0, inmode->data->length);
2678  for (j = 0; j < tmpmode->data->length; j++) {
2679  tmpmode->data->data[j] = cpow(-1, l)
2680  * conj(tmpmode->data->data[j]);
2681  }
2682  hlm = XLALSphHarmTimeSeriesAddMode(hlm, tmpmode, l, m);
2684  }
2685  }
2686  break;
2687 
2688  case NRSur7dq2:
2689  /* Waveform-specific sanity checks */
2691  XLAL_ERROR_NULL(XLAL_EINVAL, "Non-default flags given, but this approximant does not support this case.");
2692  if (!checkTidesZero(lambda1, lambda2))
2693  XLAL_ERROR_NULL(XLAL_EINVAL, "Non-zero tidal parameters were given, but this is approximant doe not have tidal corrections.");
2694  /* Call the waveform driver routine */
2695  hlm = XLALSimInspiralPrecessingNRSurModes(deltaT, m1, m2, S1x, S1y, S1z, S2x, S2y, S2z, f_min, f_ref, r, LALpars, approximant);
2696  break;
2697 
2698  case NRSur7dq4:
2699  /* Waveform-specific sanity checks */
2701  XLAL_ERROR_NULL(XLAL_EINVAL, "Non-default flags given, but this approximant does not support this case.");
2702  if (!checkTidesZero(lambda1, lambda2))
2703  XLAL_ERROR_NULL(XLAL_EINVAL, "Non-zero tidal parameters were given, but this is approximant doe not have tidal corrections.");
2704  /* Call the waveform driver routine */
2705  hlm = XLALSimInspiralPrecessingNRSurModes(deltaT, m1, m2, S1x, S1y, S1z, S2x, S2y, S2z, f_min, f_ref, r, LALpars, approximant);
2706  break;
2707 
2708  case NRHybSur3dq8:
2709  /* Waveform-specific sanity checks */
2711  XLAL_ERROR_NULL(XLAL_EINVAL, "Non-default flags given, but this approximant does not support this case.");
2712  if (!checkTransverseSpinsZero(S1x, S1y, S2x, S2y))
2713  XLAL_ERROR_NULL(XLAL_EINVAL, "Non-zero transverse spins were given, but this is a non-precessing approximant.");
2714  if (!checkTidesZero(lambda1, lambda2))
2715  XLAL_ERROR_NULL(XLAL_EINVAL, "Non-zero tidal parameters were given, but this is approximant doe not have tidal corrections.");
2716 
2717  /* Call the waveform driver routine */
2718  hlm = XLALSimIMRNRHybSur3dq8Modes(deltaT, m1, m2, S1z, S2z, f_min, f_ref, r, LALpars);
2719  break;
2720 
2721  case IMRPhenomTHM:
2722  /* Waveform-specific sanity checks */
2724  XLAL_ERROR_NULL(XLAL_EINVAL, "Non-default flags given, but this approximant does not support this case.");
2725  if (!checkTransverseSpinsZero(S1x, S1y, S2x, S2y))
2726  XLAL_ERROR_NULL(XLAL_EINVAL, "Non-zero transverse spins were given, but this is a non-precessing approximant.");
2727  if (!checkTidesZero(lambda1, lambda2))
2728  XLAL_ERROR_NULL(XLAL_EINVAL, "Non-zero tidal parameters were given, but this is approximant doe not have tidal corrections.");
2729 
2730  /* Call the waveform driver routine */
2731  hlm = XLALSimIMRPhenomTHM_Modes(m1, m2, S1z, S2z, r, deltaT, f_min, f_ref, phiRef, LALpars);
2732 
2733  break;
2734 
2735  case IMRPhenomTPHM:
2736  /* Waveform-specific sanity checks */
2737  /* FIXME: CHECK XPHM CHECKS */
2739  XLAL_ERROR_NULL(XLAL_EINVAL, "Non-default flags given, but this approximant does not support this case.");
2740  if (!checkTidesZero(lambda1, lambda2))
2741  XLAL_ERROR_NULL(XLAL_EINVAL, "Non-zero tidal parameters were given, but this is approximant doe not have tidal corrections.");
2742  /* Call the waveform driver routine. */
2743  hlm = XLALSimIMRPhenomTPHM_ChooseTDModes(m1, m2, S1x, S1y, S1z, S2x, S2y, S2z, r, deltaT, f_min, f_ref, LALpars);
2744  break;
2745 
2746  case SEOBNRv4HM_PA:
2747  case pSEOBNRv4HM_PA:
2748  /* Waveform-specific sanity checks */
2750  XLAL_ERROR_NULL(XLAL_EINVAL, "Non-default flags given, but this approximant does not support this case.");
2751  if (!checkTidesZero(lambda1, lambda2))
2752  XLAL_ERROR_NULL(XLAL_EINVAL, "Non-zero tidal parameters were given, but this is approximant doe not have tidal corrections.");
2753  if (f_ref != 0.)
2754  XLALPrintWarning("XLAL Warning - %s: This approximant does not use f_ref. The reference phase will be defined at coalescence.\n", __func__);
2755 
2756  UINT4 SpinAlignedEOBversion;
2757  if (approximant == SEOBNRv4HM_PA) SpinAlignedEOBversion = 4111;
2758  if (approximant == pSEOBNRv4HM_PA) SpinAlignedEOBversion = 4112;
2759 
2760  REAL8Vector *dynamics = NULL;
2761  REAL8Vector *dynamicsHi = NULL;
2762 
2763  REAL8 lambda2Tidal1 = 0.0;
2764  REAL8 lambda2Tidal2 = 0.0;
2765  REAL8 omega02Tidal1 = 0.0;
2766  REAL8 omega02Tidal2 = 0.0;
2767  REAL8 lambda3Tidal1 = 0.0;
2768  REAL8 lambda3Tidal2 = 0.0;
2769  REAL8 omega03Tidal1 = 0.0;
2770  REAL8 omega03Tidal2 = 0.0;
2771  REAL8 quadparam1 = 1.0;
2772  REAL8 quadparam2 = 1.0;
2773  REAL8Vector *nqcCoeffsInput = NULL;
2774  INT4 nqcFlag = 0;
2775 
2776  LALDict *PAParams = XLALCreateDict();
2777  XLALDictInsertUINT4Value(PAParams, "PAFlag", 1);
2778  XLALDictInsertUINT4Value(PAParams, "PAOrder", 8);
2779  XLALDictInsertREAL8Value(PAParams, "rFinal", 1.8);
2780  XLALDictInsertREAL8Value(PAParams, "rSwitch", 1.8);
2781  XLALDictInsertUINT2Value(PAParams, "analyticFlag", 1);
2782 
2783  LALDict *TGRParams = XLALCreateDict();
2784  REAL8 domega220 = 0.0;
2785  REAL8 dtau220 = 0.0;
2786  REAL8 domega210 = 0.0;
2787  REAL8 dtau210 = 0.0;
2788  REAL8 domega330 = 0.0;
2789  REAL8 dtau330 = 0.0;
2790  REAL8 domega440 = 0.0;
2791  REAL8 dtau440 = 0.0;
2792  REAL8 domega550 = 0.0;
2793  REAL8 dtau550 = 0.0;
2794 
2795  domega220 = XLALSimInspiralWaveformParamsLookupDOmega220(LALpars);
2796  dtau220 = XLALSimInspiralWaveformParamsLookupDTau220(LALpars);
2797  domega210 = XLALSimInspiralWaveformParamsLookupDOmega210(LALpars);
2798  dtau210 = XLALSimInspiralWaveformParamsLookupDTau210(LALpars);
2799  domega330 = XLALSimInspiralWaveformParamsLookupDOmega330(LALpars);
2800  dtau330 = XLALSimInspiralWaveformParamsLookupDTau330(LALpars);
2801  domega440 = XLALSimInspiralWaveformParamsLookupDOmega440(LALpars);
2802  dtau440 = XLALSimInspiralWaveformParamsLookupDTau440(LALpars);
2803  domega550 = XLALSimInspiralWaveformParamsLookupDOmega550(LALpars);
2804  dtau550 = XLALSimInspiralWaveformParamsLookupDTau550(LALpars);
2805 
2806  UINT2 TGRflag = 0;
2807  if (approximant == pSEOBNRv4HM_PA) TGRflag = 1;
2808 
2809  XLALSimInspiralWaveformParamsInsertDOmega220(TGRParams, domega220);
2810  XLALSimInspiralWaveformParamsInsertDTau220(TGRParams, dtau220);
2811  XLALSimInspiralWaveformParamsInsertDOmega210(TGRParams, domega210);
2812  XLALSimInspiralWaveformParamsInsertDTau210(TGRParams, dtau210);
2813  XLALSimInspiralWaveformParamsInsertDOmega330(TGRParams, domega330);
2814  XLALSimInspiralWaveformParamsInsertDTau330(TGRParams, dtau330);
2815  XLALSimInspiralWaveformParamsInsertDOmega440(TGRParams, domega440);
2816  XLALSimInspiralWaveformParamsInsertDTau440(TGRParams, dtau440);
2817  XLALSimInspiralWaveformParamsInsertDOmega550(TGRParams, domega550);
2818  XLALSimInspiralWaveformParamsInsertDTau550(TGRParams, dtau550);
2819 
2820  XLALDictInsertUINT2Value(TGRParams, "TGRflag", TGRflag);
2821 
2823  &hlm,
2824  &dynamics, &dynamicsHi,
2825  deltaT,
2826  m1, m2,
2827  f_min,
2828  r,
2829  S1z, S2z,
2830  SpinAlignedEOBversion,
2831  lambda2Tidal1, lambda2Tidal2,
2832  omega02Tidal1, omega02Tidal2,
2833  lambda3Tidal1, lambda3Tidal2,
2834  omega03Tidal1, omega03Tidal2,
2835  quadparam1, quadparam2,
2836  nqcCoeffsInput, nqcFlag,
2837  PAParams,
2838  TGRParams) == XLAL_FAILURE
2839  ){
2841  };
2842 
2843  if(dynamics) XLALDestroyREAL8Vector(dynamics);
2844  if(dynamicsHi) XLALDestroyREAL8Vector(dynamicsHi);
2845  XLALDestroyDict(PAParams);
2846  XLALDestroyDict(TGRParams);
2847 
2848  UINT4 i;
2849  UINT4 modeArrayCreated = 0;
2850 
2851  LALValue *modeArray = XLALSimInspiralWaveformParamsLookupModeArray(
2852  LALpars
2853  );
2854 
2855  if (modeArray == NULL) {
2856  modeArray = XLALSimInspiralCreateModeArray();
2857  modeArrayCreated = 1;
2858 
2859  XLALSimInspiralModeArrayActivateMode(modeArray, 2, 2);
2860  XLALSimInspiralModeArrayActivateMode(modeArray, 2, 1);
2861  XLALSimInspiralModeArrayActivateMode(modeArray, 3, 3);
2862  XLALSimInspiralModeArrayActivateMode(modeArray, 4, 4);
2863  XLALSimInspiralModeArrayActivateMode(modeArray, 5, 5);
2864  }
2865 
2866  SphHarmTimeSeries *modes = hlm;
2867  COMPLEX16TimeSeries *tmpMode = NULL;
2868  char modeName[40];
2869 
2870  while (modes) {
2872  modeArray, modes->l, -modes->m
2873  ) == 1) {
2874  sprintf(modeName, "h%dm%d", modes->l, modes->m);
2875 
2877  modeName,
2878  &modes->mode->epoch,
2879  0,
2880  deltaT,
2881  &lalStrainUnit,
2882  modes->mode->data->length
2883  );
2884 
2885  for (i = 0; i < modes->mode->data->length; i++) {
2886  tmpMode->data->data[i] = pow(-1, modes->l) * conj(- modes->mode->data->data[i]);
2887  }
2888 
2889  hlm = XLALSphHarmTimeSeriesAddMode(hlm, tmpMode, modes->l, -(modes->m));
2890  }
2891 
2893  modeArray, modes->l, modes->m
2894  ) == 1) {
2895 
2896  for (i = 0; i < modes->mode->data->length; i++)
2897  modes->mode->data->data[i] *= -1;
2898  }
2899 
2900  modes = modes->next;
2901  }
2902 
2903  if (modeArrayCreated) {
2904  XLALDestroyValue(modeArray);
2905  }
2906 
2908 
2909  break;
2910 
2911  case SEOBNRv4P:
2912  /* Waveform-specific sanity checks */
2914  XLAL_ERROR_NULL(XLAL_EINVAL, "Non-default flags given, but this approximant does not support this case.");
2915  if (!checkTidesZero(lambda1, lambda2))
2916  XLAL_ERROR_NULL(XLAL_EINVAL, "Non-zero tidal parameters were given, but this is approximant doe not have tidal corrections.");
2917  if (f_ref != 0.)
2918  XLALPrintWarning("XLAL Warning - %s: This approximant does use f_ref. The reference phase will be defined at coalescence.\n", __func__);
2919 
2920  spin1[0] = S1x;
2921  spin1[1] = S1y;
2922  spin1[2] = S1z;
2923  spin2[0] = S2x;
2924  spin2[1] = S2y;
2925  spin2[2] = S2z;
2926  PrecEOBversion = 401;
2927  hlm = XLALSimIMRSpinPrecEOBModes(deltaT, m1, m2, f_min, r, spin1, spin2, PrecEOBversion, LALpars);
2928  break;
2929 
2930  case SEOBNRv4PHM:
2931  /* Waveform-specific sanity checks */
2933  XLAL_ERROR_NULL(XLAL_EINVAL, "Non-default flags given, but this approximant does not support this case.");
2934  if (!checkTidesZero(lambda1, lambda2))
2935  XLAL_ERROR_NULL(XLAL_EINVAL, "Non-zero tidal parameters were given, but this is approximant doe not have tidal corrections.");
2936  if (f_ref != 0.)
2937  XLALPrintWarning("XLAL Warning - %s: This approximant does use f_ref. The reference phase will be defined at coalescence.\n", __func__);
2938 
2939  spin1[0] = S1x;
2940  spin1[1] = S1y;
2941  spin1[2] = S1z;
2942  spin2[0] = S2x;
2943  spin2[1] = S2y;
2944  spin2[2] = S2z;
2945  PrecEOBversion = 402;
2946  hlm = XLALSimIMRSpinPrecEOBModes(deltaT, m1, m2, f_min, r, spin1, spin2, PrecEOBversion, LALpars);
2947  break;
2948 
2949  case SpinTaylorT1:
2950  case SpinTaylorT5:
2951  case SpinTaylorT4:
2952  if (lmax > 4)
2953  XLALPrintError("XLAL ERROR - %s: maximum l implemented for SpinTaylors is 4, = %d requested.\n", __func__, lmax);
2954 
2955  REAL8TimeSeries *V = NULL;
2956  REAL8TimeSeries *Phi = NULL;
2957  REAL8TimeSeries *Spin1x = NULL;
2958  REAL8TimeSeries *Spin1y = NULL;
2959  REAL8TimeSeries *Spin1z = NULL;
2960  REAL8TimeSeries *Spin2x = NULL;
2961  REAL8TimeSeries *Spin2y = NULL;
2962  REAL8TimeSeries *Spin2z = NULL;
2963  REAL8TimeSeries *LNhx = NULL;
2964  REAL8TimeSeries *LNhy = NULL;
2965  REAL8TimeSeries *LNhz = NULL;
2966  REAL8TimeSeries *E1x = NULL;
2967  REAL8TimeSeries *E1y = NULL;
2968  REAL8TimeSeries *E1z = NULL;
2969 
2970  /* Here we start dynamics with L//z and e1//x
2971  * which is not the standard case for SpinTaylor
2972  */
2973  REAL8 lnhx = 0.;
2974  REAL8 lnhy = 0.;
2975  REAL8 lnhz = 1.;
2976  REAL8 e1x = 1.;
2977  REAL8 e1y = 0.;
2978  REAL8 e1z = 0.;
2979  //phi_ref is added later
2980  errCode +=
2981  XLALSimInspiralSpinTaylorDriver(NULL, NULL, &V, &Phi, &Spin1x, &Spin1y, &Spin1z, &Spin2x, &Spin2y, &Spin2z, &LNhx, &LNhy, &LNhz, &E1x, &E1y, &E1z, 0., deltaT, m1, m2, f_min, f_ref, r, S1x, S1y, S1z, S2x, S2y, S2z, lnhx, lnhy, lnhz, e1x, e1y,
2982  e1z, LALpars, approximant);
2983  INT4 ma_needs_destroy = 0;
2984  LALValue *modearray = XLALSimInspiralWaveformParamsLookupModeArray(LALpars);
2985  if (modearray == NULL) {
2986  modearray = XLALSimInspiralCreateModeArray();
2987  ma_needs_destroy = 1;
2988  for (l = 2; l <= (UINT4) lmax; l++)
2990  }
2991  errCode += XLALSimInspiralSpinTaylorHlmModesFromOrbit(&hlm, V, Phi, LNhx, LNhy, LNhz, E1x, E1y, E1z, Spin1x, Spin1y, Spin1z, Spin2x, Spin2y, Spin2z, m1, m2, r, XLALSimInspiralWaveformParamsLookupPNAmplitudeOrder(LALpars), modearray);
2992 
3007  if (ma_needs_destroy)
3008  XLALDestroyValue(modearray);
3009  break;
3010 
3011  default:
3012  XLALPrintError("Cannot generate modes for this approximant\n");
3014  }
3015  if (errCode || !(hlm))
3017 
3018  return hlm;
3019 }
3020 
3021 /**
3022  * Copy of the old code of XLALSimInspiralChooseFDModes(). The new version of XLALSimInspiralChooseFDModes() is just a wrapper over XLALSimInspiralGenerateFDModes().
3023  * XLALSimInspiralGeenrateFDModes() internally calls this function for legacy approximants.
3024  */
3026  REAL8 m1, /* mass of companion 1 (kg) */
3027  REAL8 m2, /* mass of companion 2 (kg) */
3028  REAL8 S1x, /* x-component of the dimensionless spin of object 1 */
3029  REAL8 S1y, /* y-component of the dimensionless spin of object 1 */
3030  REAL8 S1z, /* z-component of the dimensionless spin of object 1 */
3031  REAL8 S2x, /* x-component of the dimensionless spin of object 2 */
3032  REAL8 S2y, /* y-component of the dimensionless spin of object 2 */
3033  REAL8 S2z, /* z-component of the dimensionless spin of object 2 */
3034  REAL8 deltaF, /* sampling interval (s) */
3035  REAL8 f_min, /* starting GW frequency (Hz) */
3036  REAL8 f_max, /* ending GW frequency (Hz) */
3037  REAL8 f_ref, /* reference GW frequency (Hz) */
3038  REAL8 phiRef, /* reference phase (rad) */
3039  REAL8 distance, /* distance of source (m) */
3040  REAL8 inclination, /* inclination of source (rad) */
3041  LALDict *params, /* LAL dictionary containing accessory parameters (optional mode array) */
3042  Approximant approximant /* approximant to use for waveform production */
3043 )
3044 {
3045 
3048 
3049  /* General sanity checks that will abort
3050  *
3051  * If non-GR approximants are added, include them in
3052  * XLALSimInspiralApproximantAcceptTestGRParams()
3053  */
3055  XLALPrintError("XLAL Error - %s: Passed in non-NULL pointer to LALSimInspiralTestGRParam for an approximant that does not use LALSimInspiralTestGRParam\n", __func__);
3057  }
3058 
3059  /* General sanity check the input parameters - only give warnings! */
3060  if (deltaF > 1.)
3061  XLALPrintWarning("XLAL Warning - %s: Large value of deltaF = %e requested...This corresponds to a very short TD signal (with padding). Consider a smaller value.\n", __func__, deltaF);
3062  if (deltaF < 1. / 4096.)
3063  XLALPrintWarning("XLAL Warning - %s: Small value of deltaF = %e requested...This corresponds to a very long TD signal. Consider a larger value.\n", __func__, deltaF);
3064  if (m1 < 0.09 * LAL_MSUN_SI)
3065  XLALPrintWarning("XLAL Warning - %s: Small value of m1 = %e (kg) = %e (Msun) requested...Perhaps you have a unit conversion error?\n", __func__, m1, m1 / LAL_MSUN_SI);
3066  if (m2 < 0.09 * LAL_MSUN_SI)
3067  XLALPrintWarning("XLAL Warning - %s: Small value of m2 = %e (kg) = %e (Msun) requested...Perhaps you have a unit conversion error?\n", __func__, m2, m2 / LAL_MSUN_SI);
3068  if (m1 + m2 > 1000. * LAL_MSUN_SI)
3069  XLALPrintWarning("XLAL Warning - %s: Large value of total mass m1+m2 = %e (kg) = %e (Msun) requested...Signal not likely to be in band of ground-based detectors.\n", __func__, m1 + m2, (m1 + m2) / LAL_MSUN_SI);
3070  if (S1x * S1x + S1y * S1y + S1z * S1z > 1.000001)
3071  XLALPrintWarning("XLAL Warning - %s: S1 = (%e,%e,%e) with norm > 1 requested...Are you sure you want to violate the Kerr bound?\n", __func__, S1x, S1y, S1z);
3072  if (S2x * S2x + S2y * S2y + S2z * S2z > 1.000001)
3073  XLALPrintWarning("XLAL Warning - %s: S2 = (%e,%e,%e) with norm > 1 requested...Are you sure you want to violate the Kerr bound?\n", __func__, S2x, S2y, S2z);
3074  if (f_min < 1.)
3075  XLALPrintWarning("XLAL Warning - %s: Small value of fmin = %e requested...Check for errors, this could create a very long waveform.\n", __func__, f_min);
3076  if (f_min > 40.000001)
3077  XLALPrintWarning("XLAL Warning - %s: Large value of fmin = %e requested...Check for errors, the signal will start in band.\n", __func__, f_min);
3078 
3079  /* Adjust the reference frequency for certain precessing approximants:
3080  * if that approximate interprets f_ref==0 to be f_min, set f_ref=f_min;
3081  * otherwise do nothing */
3083 
3084  /* Output object, structure with the individual modes required.
3085  The values of each mode are returned both for positive and negative frequencies to be consistent with the precessing models. */
3086  SphHarmFrequencySeries *hlms = NULL;
3087 
3088  /* Frequency array of each mode. It will have both positive and negative values. */
3089  REAL8Sequence *freqsSphH = NULL;
3090 
3091 
3092  /* The following variables are only used for PhenomHM and SEOBNRv4HM_ROM since some extra operations are needed for them. */
3093 
3094  /* Input ModeArray. If not specified in the LAL dictionary, it will return all the available modes in the model. */
3095  LALValue *ModeArray = NULL;
3096  LALDict *params_aux;
3097  /* This is an auxiliar, easy to read list with the modes in the ModeArray option.
3098  E.g. if (2,-2), (3,-3) are activated, the it would be (2, -2, 3, -3). */
3099  INT2Sequence *modeseq;
3100  /* Variable for the number of modes in the ModeArray */
3101  UINT4 nmodes;
3102  /* Variable for the length of individual modes in half the frequency spectrum. */
3103  INT4 length;
3104  /* Auxiliar variable to store the individual modes computed from the internal functions of each model which later we will
3105  apply some operations to be consistent with LAL conventions. */
3107  *hlms_tmp = NULL;
3108 
3109  INT4 retcode;
3110 
3111  switch (approximant) {
3112  case IMRPhenomXHM:
3113  /* Waveform-specific sanity checks */
3115  XLAL_ERROR_NULL(XLAL_EINVAL, "Non-default flags given, but this approximant does not support this case.");
3116  if (!checkTransverseSpinsZero(S1x, S1y, S2x, S2y))
3117  XLAL_ERROR_NULL(XLAL_EINVAL, "Non-zero transverse spins were given, but this is a non-precessing approximant.");
3118  if (!checkTidesZero(lambda1, lambda2))
3119  XLAL_ERROR_NULL(XLAL_EINVAL, "Non-zero tidal parameters were given, but this is approximant doe not have tidal corrections.");
3120 
3121  /* Compute individual modes from IMRPhenomXHM */
3122  XLALSimIMRPhenomXHMModes(&hlms, m1, m2, S1z, S2z, deltaF, f_min, f_max, f_ref, phiRef, distance, params);
3123  break;
3124 
3125  case IMRPhenomXPHM:
3126  /* Waveform-specific sanity checks */
3128  XLAL_ERROR_NULL(XLAL_EINVAL, "Non-default flags given, but this approximant does not support this case.");
3129  if (!checkTidesZero(lambda1, lambda2))
3130  XLAL_ERROR_NULL(XLAL_EINVAL, "Non-zero tidal parameters were given, but this is approximant doe not have tidal corrections.");
3131 
3132  /* Compute individual modes in the J-frame from IMRPhenomXPHM */
3133  XLALSimIMRPhenomXPHMModes(&hlms, m1, m2, S1x, S1y, S1z, S2x, S2y, S2z, deltaF, f_min, f_max, f_ref, phiRef, distance, inclination, params);
3134  break;
3135 
3136  case IMRPhenomXO4a:
3137  if (params == NULL){
3138  params_aux = XLALCreateDict();
3139  }
3140  else{
3141  params_aux = XLALDictDuplicate(params);
3142  }
3143 
3144  /* XO4 uses previous version of XHM */
3146 
3147  /* Waveform-specific sanity checks */
3149  XLAL_ERROR_NULL(XLAL_EINVAL, "Non-default flags given, but this approximant does not support this case.");
3150  if( !checkTidesZero(lambda1, lambda2) )
3151  XLAL_ERROR_NULL(XLAL_EINVAL, "Non-zero tidal parameters were given, but this is approximant doe not have tidal corrections.");
3152 
3153  /* Toggle on PNR angles */
3154  if(!XLALDictContains(params_aux, "PNRUseTunedAngles")){
3156  }
3157 
3158  /* Toggle on tuned coprecessing strain */
3159  if(!XLALDictContains(params_aux, "PNRUseTunedCoprec")){
3161  }
3162 
3163  /* Ensure that 33 tuning is set to preferred value */
3164  if(!XLALDictContains(params_aux, "PNRUseTunedCoprec33")){
3166  }
3167  if(!XLALDictContains(params_aux, "PNRForceXHMAlignment")){
3169  }
3170 
3171  /* Toggle on antisymmetric contributions */
3172  if(!XLALDictContains(params_aux, "AntisymmetricWaveform")){
3174  }
3175 
3177  {
3179  {
3180  XLAL_ERROR_NULL(XLAL_EFUNC,"Error: Antisymmetric waveform generation not supported without PNR angles, please turn on PNR angles to produce waveform with asymmetries in the (2,2) and (2,-2) modes \n");
3181  }
3182  }
3183 
3184  /* Toggle on reviewed PrecVersion and FinalSpinMod */
3185  if(!XLALDictContains(params_aux, "PrecVersion")){
3187  }
3188 
3189  /* Compute individual modes in the J-frame from IMRPhenomXPHM */
3190  XLALSimIMRPhenomXPHMModes(&hlms, m1, m2, S1x, S1y, S1z, S2x, S2y, S2z, deltaF, f_min, f_max, f_ref, phiRef, distance, inclination, params_aux);
3191 
3192  XLALDestroyDict(params_aux);
3193 
3194  break;
3195 
3196 
3197  case SEOBNRv4HM_ROM:
3198  /* Waveform-specific sanity checks */
3200  XLAL_ERROR_NULL(XLAL_EINVAL, "Non-default flags given, but this approximant does not support this case.");
3201  if (!checkTransverseSpinsZero(S1x, S1y, S2x, S2y))
3202  XLAL_ERROR_NULL(XLAL_EINVAL, "Non-zero transverse spins were given, but this is a non-precessing approximant.");
3203  if (!checkTidesZero(lambda1, lambda2))
3204  XLAL_ERROR_NULL(XLAL_EINVAL, "Non-zero tidal parameters were given, but this is approximant doe not have tidal corrections.");
3205 
3206  /* First we define the mode array of the output SphHarmFrequencySeries.
3207  Although the user can choose this array, the model computes internally all the modes
3208  and then we just pick those specified by the user.
3209  The only exception is when only the 2,-2 mode is required, in such case SEOBNRv4_ROM is called.
3210  */
3211  if (params == NULL) {
3212  params_aux = XLALCreateDict();
3213  } else {
3214  params_aux = XLALDictDuplicate(params);
3215  }
3216  ModeArray = XLALSimInspiralWaveformParamsLookupModeArray(params_aux);
3217  if (ModeArray == NULL) {
3218  /* If not specified, fill array with default modes of IMRPhenomHM */
3219  ModeArray = XLALSimInspiralCreateModeArray();
3220  XLALSimInspiralModeArrayActivateMode(ModeArray, 2, -2);
3221  XLALSimInspiralModeArrayActivateMode(ModeArray, 2, -1);
3222  XLALSimInspiralModeArrayActivateMode(ModeArray, 3, -3);
3223  XLALSimInspiralModeArrayActivateMode(ModeArray, 4, -4);
3224  XLALSimInspiralModeArrayActivateMode(ModeArray, 5, -5);
3225  XLALSimInspiralModeArrayActivateMode(ModeArray, 2, 2);
3226  XLALSimInspiralModeArrayActivateMode(ModeArray, 2, 1);
3227  XLALSimInspiralModeArrayActivateMode(ModeArray, 3, 3);
3228  XLALSimInspiralModeArrayActivateMode(ModeArray, 4, 4);
3229  XLALSimInspiralModeArrayActivateMode(ModeArray, 5, 5);
3230 
3231  modeseq = XLALSimInspiralModeArrayReadModes(ModeArray);
3232 
3233  XLALDestroyValue(ModeArray);
3234  nmodes = modeseq->length / 2;
3235  } else // This is just to avoid killing the kernel when you ask for a mode that is not available.
3236  {
3237  modeseq = XLALSimInspiralModeArrayReadModes(ModeArray);
3238  XLALDestroyValue(ModeArray);
3239  nmodes = modeseq->length / 2;
3240 
3241  /* Check that there are not unavailable modes. */
3242  LALValue *DefaultModeArray = XLALSimInspiralCreateModeArray();
3243  XLALSimInspiralModeArrayActivateMode(DefaultModeArray, 2, -2);
3244  XLALSimInspiralModeArrayActivateMode(DefaultModeArray, 2, -1);
3245  XLALSimInspiralModeArrayActivateMode(DefaultModeArray, 3, -3);
3246  XLALSimInspiralModeArrayActivateMode(DefaultModeArray, 4, -4);
3247  XLALSimInspiralModeArrayActivateMode(DefaultModeArray, 5, -5);
3248  XLALSimInspiralModeArrayActivateMode(DefaultModeArray, 2, 2);
3249  XLALSimInspiralModeArrayActivateMode(DefaultModeArray, 2, 1);
3250  XLALSimInspiralModeArrayActivateMode(DefaultModeArray, 3, 3);
3251  XLALSimInspiralModeArrayActivateMode(DefaultModeArray, 4, 4);
3252  XLALSimInspiralModeArrayActivateMode(DefaultModeArray, 5, 5);
3253 
3254  for (UINT4 i = 0; i < nmodes; i++) {
3255  INT2 l, m;
3256  l = modeseq->data[2 * i];
3257  m = modeseq->data[2 * i + 1];
3258  if (XLALSimInspiralModeArrayIsModeActive(DefaultModeArray, l, m) == 0) {
3259  XLALDestroyValue(DefaultModeArray);
3260  XLALDestroyINT2Sequence(modeseq);
3261  XLALFree(hlms_tmp);
3262  XLAL_ERROR_NULL(XLAL_EINVAL, "Mode (%i,%i) is not available in SEOBNRv4HM_ROM.\n", l, m);
3263  }
3264  }
3265  XLALDestroyValue(DefaultModeArray);
3266  }
3267  XLALDestroyDict(params_aux);
3268 
3269  UINT2 eobmodes = 5;
3270  if (nmodes == 1 && modeseq->data[0] == 2 && abs(modeseq->data[0]) == 2) {
3271  eobmodes = 1; // This will internally call SEOBNRv4_ROM instead of all the modes, therefore saving time.
3272  }
3273 
3274  /* Compute individual modes of SEOBNRv4HM_ROM */
3275  retcode = XLALSimIMRSEOBNRv4HMROM_Modes(hlms_tmp, phiRef, deltaF, f_min, f_max, f_ref, distance, m1, m2, S1z, S2z, -1, eobmodes, 1);
3276  if (retcode != XLAL_SUCCESS) {
3277  XLALFree(hlms_tmp);
3279  }
3280 
3281 
3282  /* This is the length of half of the frequency spectrum.
3283  Later we will resize series to add the negative frequency regime. */
3284  length = (*hlms_tmp)->mode->data->length - 1;
3285 
3286 
3287  /* Loop over modes in the SphHarmFrequencySeries. Resize each mode. */
3288  for (UINT4 i = 0; i < nmodes; i++) {
3289  INT2 l, m;
3290  l = modeseq->data[2 * i];
3291  m = modeseq->data[2 * i + 1];
3292 
3294 
3295 
3296  if (m < 0) {
3297  /* Resize series to add the negative frequency regime */
3298  hlm = XLALResizeCOMPLEX16FrequencySeries(hlm, -length, 2 * length + 1);
3299  } else {
3300  /* Use equatorial symmetry to transform negative to positive mode. */
3301  INT4 minus1l = -1;
3302  if (l % 2 == 0) {
3303  minus1l = 1;
3304  }
3305  hlm = XLALResizeCOMPLEX16FrequencySeries(hlm, 0, 2 * length + 1);
3306  for (INT4 j = 0; j < length; j++) {
3307  hlm->data->data[j] = minus1l * conj(hlm->data->data[hlm->data->length - 1 - j]);
3308  hlm->data->data[hlm->data->length - 1 - j] = 0.;
3309  }
3310  }
3311 
3312  hlms = XLALSphHarmFrequencySeriesAddMode(hlms, hlm, l, m);
3313  }
3314  XLALDestroyINT2Sequence(modeseq);
3316 
3317  /* Add frequency array to SphHarmFrequencySeries */
3318  freqsSphH = XLALCreateREAL8Sequence(2 * length + 1);
3319  for (INT4 i = -length; i <= length; i++) {
3320  freqsSphH->data[i + length] = i * deltaF;
3321  }
3322  XLALSphHarmFrequencySeriesSetFData(hlms, freqsSphH);
3323  break;
3324 
3325  case SEOBNRv5_ROM:
3326  /* Waveform-specific sanity checks */
3328  XLAL_ERROR_NULL(XLAL_EINVAL, "Non-default flags given, but this approximant does not support this case.");
3329  if( !checkTransverseSpinsZero(S1x, S1y, S2x, S2y) )
3330  XLAL_ERROR_NULL(XLAL_EINVAL, "Non-zero transverse spins were given, but this is a non-precessing approximant.");
3331  if( !checkTidesZero(lambda1, lambda2) )
3332  XLAL_ERROR_NULL(XLAL_EINVAL, "Non-zero tidal parameters were given, but this is approximant doe not have tidal corrections.");
3333 
3334  if(params == NULL){
3335  params_aux = XLALCreateDict();
3336  }
3337  else{
3338  params_aux = XLALDictDuplicate(params);
3339  }
3340  ModeArray = XLALSimInspiralWaveformParamsLookupModeArray(params_aux);
3341  if(ModeArray == NULL)
3342  {
3343  /* If not specified, fill array with default modes of SEOBNRv5_ROM */
3344  ModeArray = XLALSimInspiralCreateModeArray();
3345  XLALSimInspiralModeArrayActivateMode(ModeArray, 2, -2);
3346  XLALSimInspiralModeArrayActivateMode(ModeArray, 2, 2);
3347 
3348  modeseq = XLALSimInspiralModeArrayReadModes(ModeArray);
3349 
3350  XLALDestroyValue(ModeArray);
3351  nmodes = modeseq->length/2;
3352  }
3353  else // This is just to avoid killing the kernel when you ask for a mode that is not available.
3354  {
3355  modeseq = XLALSimInspiralModeArrayReadModes(ModeArray);
3356  XLALDestroyValue(ModeArray);
3357  nmodes = modeseq->length/2;
3358 
3359  /* Check that there are not unavailable modes. */
3360  LALValue *DefaultModeArray = XLALSimInspiralCreateModeArray();
3361  XLALSimInspiralModeArrayActivateMode(DefaultModeArray, 2, -2);
3362  XLALSimInspiralModeArrayActivateMode(DefaultModeArray, 2, 2);
3363 
3364  for(UINT4 i=0; i<nmodes; i++)
3365  {
3366  INT2 l, m;
3367  l = modeseq->data[2*i];
3368  m = modeseq->data[2*i+1];
3369  if(XLALSimInspiralModeArrayIsModeActive(DefaultModeArray, l, m) == 0){
3370  XLALDestroyValue(DefaultModeArray);
3371  XLALDestroyINT2Sequence(modeseq);
3372  XLALFree(hlms_tmp);
3373  XLAL_ERROR_NULL(XLAL_EINVAL, "Mode (%i,%i) is not available in SEOBNRv5_ROM.\n", l, m);
3374  }
3375  }
3376  XLALDestroyValue(DefaultModeArray);
3377  }
3378  XLALDestroyDict(params_aux);
3379 
3380  UINT2 eobmodesv5 = 1;
3381 
3382  /* Compute individual modes of SEOBNRv5_ROM */
3383  retcode = XLALSimIMRSEOBNRv5HMROM_Modes(hlms_tmp, phiRef, deltaF, f_min, f_max, f_ref, distance, m1, m2, S1z, S2z, -1, eobmodesv5, true);
3384  if( retcode != XLAL_SUCCESS){
3385  XLALFree(hlms_tmp);
3387  }
3388 
3389 
3390  /* This is the length of half of the frequency spectrum.
3391  Later we will resize series to add the negative frequency regime. */
3392  length = (*hlms_tmp)->mode->data->length -1;
3393 
3394 
3395  /* Loop over modes in the SphHarmFrequencySeries. Resize each mode. */
3396  for(UINT4 i=0; i<nmodes; i++)
3397  {
3398  INT2 l, m;
3399  l = modeseq->data[2*i];
3400  m = modeseq->data[2*i+1];
3401 
3403 
3404 
3405  if(m<0){
3406  /* Resize series to add the negative frequency regime */
3407  hlm = XLALResizeCOMPLEX16FrequencySeries(hlm, -length, 2*length+1);
3408  }
3409  else{
3410  /* Use equatorial symmetry to transform negative to positive mode. */
3411  INT4 minus1l = -1;
3412  if (l%2 == 0){
3413  minus1l = 1;
3414  }
3415  hlm = XLALResizeCOMPLEX16FrequencySeries(hlm, 0, 2*length+1);
3416  for(INT4 j=0; j<length; j++)
3417  {
3418  hlm->data->data[j] = minus1l * conj(hlm->data->data[hlm->data->length -1 - j]);
3419  hlm->data->data[hlm->data->length -1 - j] = 0.;
3420  }
3421  }
3422 
3423  hlms = XLALSphHarmFrequencySeriesAddMode(hlms, hlm, l, m);
3424  }
3425  XLALDestroyINT2Sequence(modeseq);
3427 
3428  /* Add frequency array to SphHarmFrequencySeries */
3429  freqsSphH = XLALCreateREAL8Sequence(2*length+1);
3430  for (INT4 i = -length; i<=length; i++)
3431  {
3432  freqsSphH->data[i+length] = i*deltaF;
3433  }
3434  XLALSphHarmFrequencySeriesSetFData(hlms, freqsSphH);
3435  break;
3436 
3437  case SEOBNRv5HM_ROM:
3438  /* Waveform-specific sanity checks */
3440  XLAL_ERROR_NULL(XLAL_EINVAL, "Non-default flags given, but this approximant does not support this case.");
3441  if( !checkTransverseSpinsZero(S1x, S1y, S2x, S2y) )
3442  XLAL_ERROR_NULL(XLAL_EINVAL, "Non-zero transverse spins were given, but this is a non-precessing approximant.");
3443  if( !checkTidesZero(lambda1, lambda2) )
3444  XLAL_ERROR_NULL(XLAL_EINVAL, "Non-zero tidal parameters were given, but this is approximant doe not have tidal corrections.");
3445 
3446  if(params == NULL){
3447  params_aux = XLALCreateDict();
3448  }
3449  else{
3450  params_aux = XLALDictDuplicate(params);
3451  }
3452  ModeArray = XLALSimInspiralWaveformParamsLookupModeArray(params_aux);
3453  if(ModeArray == NULL)
3454  {
3455  /* If not specified, fill array with default modes of SEOBNRv5HM_ROM */
3456  ModeArray = XLALSimInspiralCreateModeArray();
3457  XLALSimInspiralModeArrayActivateMode(ModeArray, 2, -2);
3458  XLALSimInspiralModeArrayActivateMode(ModeArray, 2, -1);
3459  XLALSimInspiralModeArrayActivateMode(ModeArray, 3, -3);
3460  XLALSimInspiralModeArrayActivateMode(ModeArray, 4, -4);
3461  XLALSimInspiralModeArrayActivateMode(ModeArray, 5, -5);
3462  XLALSimInspiralModeArrayActivateMode(ModeArray, 3, -2);
3463  XLALSimInspiralModeArrayActivateMode(ModeArray, 4, -3);
3464  XLALSimInspiralModeArrayActivateMode(ModeArray, 2, 2);
3465  XLALSimInspiralModeArrayActivateMode(ModeArray, 2, 1);
3466  XLALSimInspiralModeArrayActivateMode(ModeArray, 3, 3);
3467  XLALSimInspiralModeArrayActivateMode(ModeArray, 4, 4);
3468  XLALSimInspiralModeArrayActivateMode(ModeArray, 5, 5);
3469  XLALSimInspiralModeArrayActivateMode(ModeArray, 3, 2);
3470  XLALSimInspiralModeArrayActivateMode(ModeArray, 4, 3);
3471 
3472 
3473  modeseq = XLALSimInspiralModeArrayReadModes(ModeArray);
3474 
3475  XLALDestroyValue(ModeArray);
3476  nmodes = modeseq->length/2;
3477  }
3478  else // This is just to avoid killing the kernel when you ask for a mode that is not available.
3479  {
3480  modeseq = XLALSimInspiralModeArrayReadModes(ModeArray);
3481  XLALDestroyValue(ModeArray);
3482  nmodes = modeseq->length/2;
3483 
3484  /* Check that there are not unavailable modes. */
3485  LALValue *DefaultModeArray = XLALSimInspiralCreateModeArray();
3486  XLALSimInspiralModeArrayActivateMode(DefaultModeArray, 2, -2);
3487  XLALSimInspiralModeArrayActivateMode(DefaultModeArray, 2, -1);
3488  XLALSimInspiralModeArrayActivateMode(DefaultModeArray, 3, -3);
3489  XLALSimInspiralModeArrayActivateMode(DefaultModeArray, 4, -4);
3490  XLALSimInspiralModeArrayActivateMode(DefaultModeArray, 5, -5);
3491  XLALSimInspiralModeArrayActivateMode(DefaultModeArray, 3, -2);
3492  XLALSimInspiralModeArrayActivateMode(DefaultModeArray, 4, -3);
3493  XLALSimInspiralModeArrayActivateMode(DefaultModeArray, 2, 2);
3494  XLALSimInspiralModeArrayActivateMode(DefaultModeArray, 2, 1);
3495  XLALSimInspiralModeArrayActivateMode(DefaultModeArray, 3, 3);
3496  XLALSimInspiralModeArrayActivateMode(DefaultModeArray, 4, 4);
3497  XLALSimInspiralModeArrayActivateMode(DefaultModeArray, 5, 5);
3498  XLALSimInspiralModeArrayActivateMode(DefaultModeArray, 3, 2);
3499  XLALSimInspiralModeArrayActivateMode(DefaultModeArray, 4, 3);
3500 
3501  for(UINT4 i=0; i<nmodes; i++)
3502  {
3503  INT2 l, m;
3504  l = modeseq->data[2*i];
3505  m = modeseq->data[2*i+1];
3506  if(XLALSimInspiralModeArrayIsModeActive(DefaultModeArray, l, m) == 0){
3507  XLALDestroyValue(DefaultModeArray);
3508  XLALDestroyINT2Sequence(modeseq);
3509  XLALFree(hlms_tmp);
3510  XLAL_ERROR_NULL(XLAL_EINVAL, "Mode (%i,%i) is not available in SEOBNRv5HM_ROM.\n", l, m);
3511  }
3512  }
3513  XLALDestroyValue(DefaultModeArray);
3514  }
3515  XLALDestroyDict(params_aux);
3516 
3517  UINT2 eobmodesv5hm = 7;
3518  if(nmodes == 1 && modeseq->data[0]==2 && abs(modeseq->data[1])==2)
3519  {
3520  eobmodesv5hm = 1; // This will internally call SEOBNRv5_ROM instead of all the modes, therefore saving time.
3521  }
3522 
3523  /* If asking for a subset of modes in the proper order only those are computed, and not all 7 */
3524  if (
3525  nmodes == 2 &&
3526  modeseq->data[0] == 2 && abs(modeseq->data[1]) == 2 &&
3527  modeseq->data[2] == 3 && abs(modeseq->data[3]) == 3)
3528  {
3529  eobmodesv5hm = 2;
3530  }
3531  if (
3532  nmodes == 3 &&
3533  modeseq->data[0] == 2 && abs(modeseq->data[1]) == 2 &&
3534  modeseq->data[4] == 3 && abs(modeseq->data[5]) == 3 &&
3535  modeseq->data[2] == 2 && abs(modeseq->data[3]) == 1)
3536  {
3537  eobmodesv5hm = 3;
3538  }
3539  if (
3540  nmodes == 4 &&
3541  modeseq->data[0] == 2 && abs(modeseq->data[1]) == 2 &&
3542  modeseq->data[4] == 3 && abs(modeseq->data[5]) == 3 &&
3543  modeseq->data[2] == 2 && abs(modeseq->data[3]) == 1 &&
3544  modeseq->data[6] == 4 && abs(modeseq->data[7]) == 4)
3545  {
3546  eobmodesv5hm = 4;
3547  }
3548  if (
3549  nmodes == 5 &&
3550  modeseq->data[0] == 2 && abs(modeseq->data[1]) == 2 &&
3551  modeseq->data[4] == 3 && abs(modeseq->data[5]) == 3 &&
3552  modeseq->data[2] == 2 && abs(modeseq->data[3]) == 1 &&
3553  modeseq->data[6] == 4 && abs(modeseq->data[7]) == 4 &&
3554  modeseq->data[8] == 5 && abs(modeseq->data[9]) == 5)
3555  {
3556  eobmodesv5hm = 5;
3557  }
3558  if (
3559  nmodes == 6 &&
3560  modeseq->data[0] == 2 && abs(modeseq->data[1]) == 2 &&
3561  modeseq->data[4] == 3 && abs(modeseq->data[5]) == 3 &&
3562  modeseq->data[2] == 2 && abs(modeseq->data[3]) == 1 &&
3563  modeseq->data[8] == 4 && abs(modeseq->data[9]) == 4 &&
3564  modeseq->data[10] == 5 && abs(modeseq->data[11]) == 5 &&
3565  modeseq->data[6] == 3 && abs(modeseq->data[7]) == 2)
3566  {
3567  eobmodesv5hm = 6;
3568  }
3569  /* Compute individual modes of SEOBNRv5HM_ROM */
3570  retcode = XLALSimIMRSEOBNRv5HMROM_Modes(hlms_tmp, phiRef, deltaF, f_min, f_max, f_ref, distance, m1, m2, S1z, S2z, -1, eobmodesv5hm, true);
3571  if( retcode != XLAL_SUCCESS){
3572  XLALFree(hlms_tmp);
3574  }
3575 
3576 
3577  /* This is the length of half of the frequency spectrum.
3578  Later we will resize series to add the negative frequency regime. */
3579  length = (*hlms_tmp)->mode->data->length -1;
3580 
3581 
3582  /* Loop over modes in the SphHarmFrequencySeries. Resize each mode. */
3583  for(UINT4 i=0; i<nmodes; i++)
3584  {
3585  INT2 l, m;
3586  l = modeseq->data[2*i];
3587  m = modeseq->data[2*i+1];
3588 
3590 
3591 
3592  if(m<0){
3593  /* Resize series to add the negative frequency regime */
3594  hlm = XLALResizeCOMPLEX16FrequencySeries(hlm, -length, 2*length+1);
3595  }
3596  else{
3597  /* Use equatorial symmetry to transform negative to positive mode. */
3598  INT4 minus1l = -1;
3599  if (l%2 == 0){
3600  minus1l = 1;
3601  }
3602  hlm = XLALResizeCOMPLEX16FrequencySeries(hlm, 0, 2*length+1);
3603  for(INT4 j=0; j<length; j++)
3604  {
3605  hlm->data->data[j] = minus1l * conj(hlm->data->data[hlm->data->length -1 - j]);
3606  hlm->data->data[hlm->data->length -1 - j] = 0.;
3607  }
3608  }
3609 
3610  hlms = XLALSphHarmFrequencySeriesAddMode(hlms, hlm, l, m);
3611  }
3612  XLALDestroyINT2Sequence(modeseq);
3614 
3615  /* Add frequency array to SphHarmFrequencySeries */
3616  freqsSphH = XLALCreateREAL8Sequence(2*length+1);
3617  for (INT4 i = -length; i<=length; i++)
3618  {
3619  freqsSphH->data[i+length] = i*deltaF;
3620  }
3621  XLALSphHarmFrequencySeriesSetFData(hlms, freqsSphH);
3622  break;
3623 
3624  case IMRPhenomHM:
3625  /* Waveform-specific sanity checks */
3627  XLAL_ERROR_NULL(XLAL_EINVAL, "Non-default flags given, but this approximant does not support this case.");
3628  if (!checkTransverseSpinsZero(S1x, S1y, S2x, S2y))
3629  XLAL_ERROR_NULL(XLAL_EINVAL, "Non-zero transverse spins were given, but this is a non-precessing approximant.");
3630  if (!checkTidesZero(lambda1, lambda2))
3631  XLAL_ERROR_NULL(XLAL_EINVAL, "Non-zero tidal parameters were given, but this is approximant doe not have tidal corrections.");
3632 
3633 
3634  /* First we define the mode array of the output SphHarmFrequencySeries.
3635  PhenomHM only computes those modes specified in this array.
3636  We use an auxiliary LALDictionary params_I */
3637  if (params == NULL) {
3638  params_aux = XLALCreateDict();
3639  } else {
3640  params_aux = XLALDictDuplicate(params);
3641  }
3642  ModeArray = XLALSimInspiralWaveformParamsLookupModeArray(params_aux);
3643  if (ModeArray == NULL) {
3644  /* If not specified, fill array with default modes of IMRPhenomHM */
3645  ModeArray = XLALSimInspiralCreateModeArray();
3646  XLALSimInspiralModeArrayActivateMode(ModeArray, 2, 2);
3647  XLALSimInspiralModeArrayActivateMode(ModeArray, 2, 1);
3648  XLALSimInspiralModeArrayActivateMode(ModeArray, 3, 3);
3649  XLALSimInspiralModeArrayActivateMode(ModeArray, 3, 2);
3650  XLALSimInspiralModeArrayActivateMode(ModeArray, 4, 4);
3651  XLALSimInspiralModeArrayActivateMode(ModeArray, 4, 3);
3652 
3653  XLALSimInspiralWaveformParamsInsertModeArray(params_aux, ModeArray);
3654 
3655  XLALSimInspiralModeArrayActivateMode(ModeArray, 2, -2);
3656  XLALSimInspiralModeArrayActivateMode(ModeArray, 2, -1);
3657  XLALSimInspiralModeArrayActivateMode(ModeArray, 3, -3);
3658  XLALSimInspiralModeArrayActivateMode(ModeArray, 3, -2);
3659  XLALSimInspiralModeArrayActivateMode(ModeArray, 4, -4);
3660  XLALSimInspiralModeArrayActivateMode(ModeArray, 4, -3);
3661 
3662  modeseq = XLALSimInspiralModeArrayReadModes(ModeArray);
3663  nmodes = modeseq->length / 2;
3664  } else // This is to avoid killing the kernel when you ask for a mode that is not available.
3665  {
3666  modeseq = XLALSimInspiralModeArrayReadModes(ModeArray);
3667  nmodes = modeseq->length / 2;
3668 
3669  /* Modes supported by IMRPhenomHM */
3670  LALValue *DefaultModeArray = XLALSimInspiralCreateModeArray();
3671  XLALSimInspiralModeArrayActivateMode(DefaultModeArray, 2, 2);
3672  XLALSimInspiralModeArrayActivateMode(DefaultModeArray, 2, 1);
3673  XLALSimInspiralModeArrayActivateMode(DefaultModeArray, 3, 3);
3674  XLALSimInspiralModeArrayActivateMode(DefaultModeArray, 3, 2);
3675  XLALSimInspiralModeArrayActivateMode(DefaultModeArray, 4, 4);
3676  XLALSimInspiralModeArrayActivateMode(DefaultModeArray, 4, 3);
3677  XLALSimInspiralModeArrayActivateMode(DefaultModeArray, 2, -2);
3678  XLALSimInspiralModeArrayActivateMode(DefaultModeArray, 2, -1);
3679  XLALSimInspiralModeArrayActivateMode(DefaultModeArray, 3, -3);
3680  XLALSimInspiralModeArrayActivateMode(DefaultModeArray, 3, -2);
3681  XLALSimInspiralModeArrayActivateMode(DefaultModeArray, 4, -4);
3682  XLALSimInspiralModeArrayActivateMode(DefaultModeArray, 4, -3);
3683 
3684  /* Check if there is any mode not supported */
3685  for (UINT4 i = 0; i < nmodes; i++) {
3686  INT2 l, m;
3687  l = modeseq->data[2 * i];
3688  m = modeseq->data[2 * i + 1];
3689 
3690  if (XLALSimInspiralModeArrayIsModeActive(DefaultModeArray, l, m) == 0) {
3691  XLALDestroyValue(ModeArray);
3692  XLALDestroyValue(DefaultModeArray);
3693  XLALDestroyINT2Sequence(modeseq);
3694  XLALFree(hlms_tmp);
3695  XLAL_ERROR_NULL(XLAL_EINVAL, "Mode (%i,%i) is not available in IMRPhenomHM.\n", l, m);
3696  }
3697  /* For the internal function of IMRPhenomHM we must pass an array only with positive modes */
3698  if (m < 0) {
3700  XLALSimInspiralModeArrayActivateMode(ModeArray, l, abs(m));
3701  }
3702  }
3703  XLALSimInspiralWaveformParamsInsertModeArray(params_aux, ModeArray);
3704  XLALDestroyValue(DefaultModeArray);
3705  }
3706 
3707  /* Build structure for minimum and maximum frequencies */
3709  freqs->data[0] = f_min;
3710  freqs->data[1] = f_max;
3711 
3712 
3713  /* Call individual modes of PhenomHM */
3714  retcode = XLALSimIMRPhenomHMGethlmModes(hlms_tmp, freqs, m1, m2, 0., 0., S1z, 0., 0., S2z, phiRef, deltaF, f_ref, params_aux);
3715  XLALDestroyREAL8Sequence(freqs);
3716  if (retcode != XLAL_SUCCESS) {
3717  XLALFree(hlms_tmp);
3719  }
3720 
3721 
3722  /* This is the length of half of the frequency spectrum.
3723  Later we will resize series to add the negative frequency regime. */
3724  length = (*hlms_tmp)->mode->data->length - 1;
3725 
3726 
3727  /* PhenomHM returns the modes in geometrical units, we need to multiply them by amp0 to obtain physical units. */
3728  const REAL8 Mtot_Msun = (m1 + m2) / LAL_MSUN_SI;
3729  const REAL8 amp0 = Mtot_Msun * LAL_MRSUN_SI * Mtot_Msun * LAL_MTSUN_SI / distance;
3730 
3731  /* PhenomHM neglects the LAL convention that the azimuthal angle of the spherical harmonics Ylm is PI/2 - phiRef.
3732  Here we compesate by this factor so it is consistent with the polarizations construction. */
3733  COMPLEX16 extra_phase = cexp(-I * (LAL_PI_2 - phiRef));
3734 
3735  /* Loop over modes in the SphHarmFrequencySeries.
3736  We add the previous factors and resize the series. */
3737  for (UINT4 i = 0; i < nmodes; i++) {
3738  INT2 l, m; // Indexes of mode
3739  l = modeseq->data[2 * i];
3740  m = modeseq->data[2 * i + 1];
3741 
3742  /* Get one individual mode.
3743  Either if m is positive or negative we read the same mode and transform accordingly later. */
3745 
3746  INT4 minus1l = -1;
3747  if (l % 2 == 0)
3748  minus1l = 1;
3749 
3750  /* Incorporate correct units and */
3751  COMPLEX16 extra_factor_lm = minus1l * amp0 * cpow(extra_phase, m);
3752 
3753  if (m < 0) {
3754  for (UINT4 j = 0; j < hlm->data->length; j++) {
3755  hlm->data->data[j] = hlm->data->data[j] * extra_factor_lm;
3756  }
3757  hlm = XLALResizeCOMPLEX16FrequencySeries(hlm, -length, 2 * length + 1);
3758  } else {
3759  if (XLALSimInspiralModeArrayIsModeActive(ModeArray, l, -m) == 1) {
3760  extra_factor_lm = minus1l;
3761  } else {
3762  extra_factor_lm = minus1l * extra_factor_lm;
3763  }
3764  hlm = XLALResizeCOMPLEX16FrequencySeries(hlm, 0, 2 * length + 1);
3765  for (INT4 j = 0; j < length; j++) {
3766  hlm->data->data[j] = conj(hlm->data->data[hlm->data->length - 1 - j]) * extra_factor_lm;
3767  hlm->data->data[hlm->data->length - 1 - j] = 0.;
3768  }
3769  }
3770 
3771  /* Add the mode to the SphHarmFrequencySeries */
3772  hlms = XLALSphHarmFrequencySeriesAddMode(hlms, hlm, l, m);
3773 
3774  }
3775  XLALDestroyINT2Sequence(modeseq);
3777  XLALDestroyValue(ModeArray);
3778  XLALDestroyDict(params_aux);
3779 
3780  /* Add frequency array to SphHarmFrequencySeries */
3781  /* Here we build the whole frequency regime (negative and positive). */
3782  freqsSphH = XLALCreateREAL8Sequence(hlms->mode->data->length);
3783  for (INT4 i = -length; i <= length; i++) {
3784  freqsSphH->data[i + length] = i * deltaF;
3785  }
3786  XLALSphHarmFrequencySeriesSetFData(hlms, freqsSphH);
3787 
3788  break;
3789  default:
3790  XLALPrintError("XLAL ERROR - %s approximant not supported by ChooseFDModes.\n", XLALSimInspiralGetStringFromApproximant(approximant));
3792  }
3793  XLALFree(hlms_tmp);
3794 
3795  if (!(hlms))
3797 
3798  return hlms;
3799 }
int XLALDictContains(const LALDict *dict, const char *key)
void XLALDestroyDict(LALDict *dict)
LALDict * XLALDictDuplicate(LALDict *old)
LALDict * XLALCreateDict(void)
int XLALDictInsertUINT4Value(LALDict *dict, const char *key, UINT4 value)
int XLALDictInsertUINT2Value(LALDict *dict, const char *key, UINT2 value)
INT4 XLALDictLookupINT4Value(LALDict *dict, const char *key)
int XLALDictInsertREAL8Value(LALDict *dict, const char *key, REAL8 value)
int XLALSimIMRPhenomHM(COMPLEX16FrequencySeries **hptilde, COMPLEX16FrequencySeries **hctilde, REAL8Sequence *freqs, REAL8 m1_SI, REAL8 m2_SI, REAL8 chi1z, REAL8 chi2z, const REAL8 distance, const REAL8 inclination, const REAL8 phiRef, const REAL8 deltaF, REAL8 f_ref, LALDict *extraParams)
int XLALSimIMRPhenomXPHMModes(SphHarmFrequencySeries **hlms, REAL8 m1_SI, REAL8 m2_SI, 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 *LALparams)
Function to obtain a SphHarmFrequencySeries with the individual modes h_lm.
int XLALSimIMRPhenSpinInspiralRDGenerator(REAL8TimeSeries **hplus, REAL8TimeSeries **hcross, REAL8 phi0, REAL8 deltaT, REAL8 m1, REAL8 m2, REAL8 f_min, REAL8 f_ref, REAL8 r, REAL8 iota, REAL8 s1x, REAL8 s1y, REAL8 s1z, REAL8 s2x, REAL8 s2y, REAL8 s2z, int phaseO, int ampO, REAL8 lambda1, REAL8 lambda2, REAL8 quadparam1, REAL8 quadparam2, LALDict *LALparams)
int XLALSimIMRPhenomPv3(COMPLEX16FrequencySeries **hptilde, COMPLEX16FrequencySeries **hctilde, REAL8Sequence *freqs, REAL8 m1_SI, REAL8 m2_SI, REAL8 S1x, REAL8 S1y, REAL8 S1z, REAL8 S2x, REAL8 S2y, REAL8 S2z, const REAL8 distance, const REAL8 inclination, const REAL8 phiRef, const REAL8 deltaF, const REAL8 f_ref, LALDict *extraParams)
Driver routine to compute the precessing inspiral-merger-ringdown phenomenological waveform IMRPhenom...
int XLALSimIMRSEOBNRv4HMROM_Modes(SphHarmFrequencySeries **hlm, REAL8 phiRef, REAL8 deltaF, REAL8 fLow, REAL8 fHigh, REAL8 fRef, REAL8 distance, REAL8 m1SI, REAL8 m2SI, REAL8 chi1, REAL8 chi2, INT4 nk_max, UINT4 nModes, bool use_hybridization)
int XLALSimIMRPhenomPv3HMGetHplusHcross(COMPLEX16FrequencySeries **hptilde, COMPLEX16FrequencySeries **hctilde, REAL8Sequence *freqs, REAL8 m1_SI, REAL8 m2_SI, REAL8 chi1x, REAL8 chi1y, REAL8 chi1z, REAL8 chi2x, REAL8 chi2y, REAL8 chi2z, const REAL8 distance, const REAL8 inclination, const REAL8 phiRef, const REAL8 deltaF, REAL8 f_ref, LALDict *extraParams)
int XLALSimIMRTEOBResumS(REAL8TimeSeries **hplus, REAL8TimeSeries **hcross, const REAL8 phiRef, const REAL8 deltaT, const REAL8 m1, const REAL8 m2, const REAL8 S1x, const REAL8 S1y, const REAL8 S1z, const REAL8 S2x, const REAL8 S2y, const REAL8 S2z, const REAL8 lambda1, const REAL8 lambda2, const REAL8 distance, const REAL8 inclination, const REAL8 longAscNodes, LALDict *LALparams, const REAL8 eccentricity, const REAL8 meanPerAno, const REAL8 f_min, const REAL8 f_ref)
int XLALSimIMRSEOBNRv5HMROM_Modes(SphHarmFrequencySeries **hlm, REAL8 phiRef, REAL8 deltaF, REAL8 fLow, REAL8 fHigh, REAL8 fRef, REAL8 distance, REAL8 m1SI, REAL8 m2SI, REAL8 chi1, REAL8 chi2, INT4 nk_max, UINT4 nModes, bool use_hybridization)
int XLALSimIMRPhenomHMGethlmModes(SphHarmFrequencySeries **hlms, REAL8Sequence *freqs, REAL8 m1_SI, REAL8 m2_SI, REAL8 chi1x, REAL8 chi1y, REAL8 chi1z, REAL8 chi2x, REAL8 chi2y, REAL8 chi2z, const REAL8 phiRef, const REAL8 deltaF, REAL8 f_ref, LALDict *extraParams)
int XLALSimInspiralNRWaveformGetHplusHcross(REAL8TimeSeries **hplus, REAL8TimeSeries **hcross, REAL8 phiRef, REAL8 inclination, REAL8 deltaT, REAL8 m1, REAL8 m2, REAL8 r, REAL8 fStart, REAL8 fRef, REAL8 s1x, REAL8 s1y, REAL8 s1z, REAL8 s2x, REAL8 s2y, REAL8 s2z, const char *NRDataFile, LALValue *ModeArray)
int XLALSimIMREOBNRv2HMROM(struct tagCOMPLEX16FrequencySeries **hptilde, struct tagCOMPLEX16FrequencySeries **hctilde, REAL8 phiRef, REAL8 deltaF, REAL8 fLow, REAL8 fHigh, REAL8 fRef, REAL8 distance, REAL8 inclination, REAL8 m1SI, REAL8 m2SI, const int higherModesFlag)
int XLALSimSpinInspiralGenerator(REAL8TimeSeries **hPlus, REAL8TimeSeries **hCross, REAL8 phi_start, REAL8 deltaT, REAL8 m1, REAL8 m2, REAL8 f_min, REAL8 f_ref, REAL8 r, REAL8 iota, REAL8 s1x, REAL8 s1y, REAL8 s1z, REAL8 s2x, REAL8 s2y, REAL8 s2z, int phaseO, int ampO, REAL8 lambda1, REAL8 lambda2, REAL8 quadparam1, REAL8 quadparam2, LALDict *LALparams)
int XLALSimIMRSpinEOBWaveform(REAL8TimeSeries **hplus, REAL8TimeSeries **hcross, const REAL8 phiC, const REAL8 deltaT, const REAL8 m1SI, const REAL8 m2SI, const REAL8 fMin, const REAL8 r, const REAL8 inc, const REAL8 spin1[], const REAL8 spin2[], const UINT4 PrecEOBversion)
Standard interface for SEOBNRv3 waveform generator: calls XLALSimIMRSpinEOBWaveformAll.
int XLALSimIMRSEOBNRv4HMROM(struct tagCOMPLEX16FrequencySeries **hptilde, struct tagCOMPLEX16FrequencySeries **hctilde, REAL8 phiRef, REAL8 deltaF, REAL8 fLow, REAL8 fHigh, REAL8 fRef, REAL8 distance, REAL8 inclination, REAL8 m1SI, REAL8 m2SI, REAL8 chi1, REAL8 chi2, INT4 nk_max, UINT4 nModes, bool use_hybridization, LALDict *LALParams)
int XLALSimIMRSEOBNRv5HMROM(struct tagCOMPLEX16FrequencySeries **hptilde, struct tagCOMPLEX16FrequencySeries **hctilde, REAL8 phiRef, REAL8 deltaF, REAL8 fLow, REAL8 fHigh, REAL8 fRef, REAL8 distance, REAL8 inclination, REAL8 m1SI, REAL8 m2SI, REAL8 chi1, REAL8 chi2, INT4 nk_max, UINT4 nModes, bool use_hybridization, LALDict *LALParams)
int XLALSimIMRSpinPrecEOBWaveform(REAL8TimeSeries **hplus, REAL8TimeSeries **hcross, const REAL8 phiC, const REAL8 deltaT, const REAL8 m1SI, const REAL8 m2SI, const REAL8 fMin, const REAL8 r, const REAL8 inc, const REAL8 INspin1[], const REAL8 INspin2[], const UINT4 PrecEOBversion, LALDict *LALParams)
SphHarmTimeSeries * XLALSimIMRSpinPrecEOBModes(const REAL8 deltaT, const REAL8 m1SI, const REAL8 m2SI, const REAL8 fMin, const REAL8 r, const REAL8 INspin1[], const REAL8 INspin2[], const UINT4 PrecEOBversion, LALDict *LALParams)
INT4 XLALSimIMRNRHybSur3dq8Polarizations(REAL8TimeSeries **hplus, REAL8TimeSeries **hcross, REAL8 phiRef, REAL8 inclination, REAL8 deltaT, REAL8 m1, REAL8 m2, REAL8 distance, REAL8 fMin, REAL8 fRef, REAL8 chi1z, REAL8 chi2z, LALDict *LALparams)
Reference: arxiv:1812.07865.
SphHarmTimeSeries * XLALSimIMRNRHybSur3dq8Modes(REAL8 deltaT, REAL8 m1, REAL8 m2, REAL8 chi1z, REAL8 chi2z, REAL8 fMin, REAL8 fRef, REAL8 distance, LALDict *LALparams)
Reference: arxiv:1812.07865.
int XLALSimNRSur4d2s(struct tagCOMPLEX16FrequencySeries **hptilde, struct tagCOMPLEX16FrequencySeries **hctilde, REAL8 phiRef, REAL8 deltaF, REAL8 fLow, REAL8 fHigh, REAL8 distance, REAL8 inclination, REAL8 m1SI, REAL8 m2SI, REAL8 S1x, REAL8 S1y, REAL8 S1z, REAL8 S2x, REAL8 S2y, REAL8 S2z)
Compute waveform in LAL format for the NRSur4d2s_FDROM NR surrogate model.
#define ROTATEY(angle, vx, vy, vz)
int XLALSimInspiralApproximantAcceptTestGRParams(Approximant approx)
const char * XLALSimInspiralGetStringFromApproximant(Approximant approximant)
Returns a string associated with an Approximant enum value.
int XLALSimInspiralSetQuadMonParamsFromLambdas(LALDict *LALparams)
if you do NOT provide a quadparam[1,2] term and you DO provide lamdba[1,2] then we calculate quad-mon...
int XLALSimLorentzInvarianceViolationTerm(COMPLEX16FrequencySeries **hptilde, COMPLEX16FrequencySeries **hctilde, REAL8 m1, REAL8 m2, REAL8 r, LALDict *LALparams)
SphHarmTimeSeries * XLALSimInspiralTaylorT2PNModes(REAL8 v0, REAL8 deltaT, REAL8 m1, REAL8 m2, REAL8 f_min, REAL8 fRef, REAL8 r, REAL8 lambda1, REAL8 lambda2, LALSimInspiralTidalOrder tideO, int amplitudeO, int phaseO, int lmax)
int XLALSimInspiralEFD(COMPLEX16FrequencySeries **hptilde, COMPLEX16FrequencySeries **hctilde, const REAL8 phiRef, const REAL8 deltaF, const REAL8 m1_SI, const REAL8 m2_SI, const REAL8 fStart, const REAL8 fEnd, const REAL8 i, const REAL8 r, const REAL8 inclination_azimuth, const REAL8 e_min, int phaseO)
int XLALSimInspiralSpinTaylorDriver(REAL8TimeSeries **hplus, REAL8TimeSeries **hcross, REAL8TimeSeries **Vout, REAL8TimeSeries **Phiout, REAL8TimeSeries **S1xout, REAL8TimeSeries **S1yout, REAL8TimeSeries **S1zout, REAL8TimeSeries **S2xout, REAL8TimeSeries **S2yout, REAL8TimeSeries **S2zout, REAL8TimeSeries **LNhxout, REAL8TimeSeries **LNhyout, REAL8TimeSeries **LNhzout, REAL8TimeSeries **E1xout, REAL8TimeSeries **E1yout, REAL8TimeSeries **E1zout, REAL8 phiRef, REAL8 deltaT, REAL8 m1_SI, REAL8 m2_SI, REAL8 fStart, REAL8 fRef, REAL8 r, REAL8 s1x, REAL8 s1y, REAL8 s1z, REAL8 s2x, REAL8 s2y, REAL8 s2z, REAL8 lnhatx, REAL8 lnhaty, REAL8 lnhatz, REAL8 e1x, REAL8 e1y, REAL8 e1z, LALDict *LALparams, Approximant approx)
Driver function to generate any of SpinTaylorT1/T5/T4 If the output entries are not null the relative...
SphHarmTimeSeries * XLALSimInspiralTaylorT4PNModes(REAL8 v0, REAL8 deltaT, REAL8 m1, REAL8 m2, REAL8 f_min, REAL8 fRef, REAL8 r, REAL8 lambda1, REAL8 lambda2, LALSimInspiralTidalOrder tideO, int amplitudeO, int phaseO, int lmax)
SphHarmTimeSeries * XLALSimInspiralTaylorT3PNModes(REAL8 v0, REAL8 deltaT, REAL8 m1, REAL8 m2, REAL8 f_min, REAL8 fRef, REAL8 r, REAL8 lambda1, REAL8 lambda2, LALSimInspiralTidalOrder tideO, int amplitudeO, int phaseO, int lmax)
int XLALSimInspiralGeneratorAddConditioningForApproximant(LALSimInspiralGenerator *generator, int approximant)
int XLALSimInspiralTaylorT2PNGenerator(REAL8TimeSeries **hplus, REAL8TimeSeries **hcross, REAL8 phiRef, REAL8 v0, REAL8 deltaT, REAL8 m1, REAL8 m2, REAL8 f_min, REAL8 fRef, REAL8 r, REAL8 i, REAL8 lambda1, REAL8 lambda2, LALSimInspiralTidalOrder tideO, int amplitudeO, int phaseO)
int XLALSimInspiralTEOBResumROM(REAL8TimeSeries **hPlus, REAL8TimeSeries **hCross, REAL8 phiRef, REAL8 deltaT, REAL8 fLow, REAL8 fRef, REAL8 distance, REAL8 inclination, REAL8 m1SI, REAL8 m2SI, REAL8 lambda1, REAL8 lambda2)
INT4 XLALSimInspiralSpinTaylorHlmModesFromOrbit(SphHarmTimeSeries **hlm, REAL8TimeSeries *V, REAL8TimeSeries *Phi, REAL8TimeSeries *LNhx, REAL8TimeSeries *LNhy, REAL8TimeSeries *LNhz, REAL8TimeSeries *e1x, REAL8TimeSeries *e1y, REAL8TimeSeries *e1z, REAL8TimeSeries *S1x, REAL8TimeSeries *S1y, REAL8TimeSeries *S1z, REAL8TimeSeries *S2x, REAL8TimeSeries *S2y, REAL8TimeSeries *S2z, REAL8 m1_SI, REAL8 m2_SI, REAL8 distance, int ampO, LALValue *modearray)
SphHarmTimeSeries * XLALSimInspiralTaylorT1PNModes(REAL8 v0, REAL8 deltaT, REAL8 m1, REAL8 m2, REAL8 f_min, REAL8 fRef, REAL8 r, REAL8 lambda1, REAL8 lambda2, LALSimInspiralTidalOrder tideO, int amplitudeO, int phaseO, int lmax)
int XLALSimInspiralTaylorT4PNGenerator(REAL8TimeSeries **hplus, REAL8TimeSeries **hcross, REAL8 phiRef, REAL8 v0, REAL8 deltaT, REAL8 m1, REAL8 m2, REAL8 f_min, REAL8 fRef, REAL8 r, REAL8 i, REAL8 lambda1, REAL8 lambda2, LALSimInspiralTidalOrder tideO, int amplitudeO, int phaseO)
int XLALSimInspiralSpinDominatedWaveformInterfaceTD(REAL8TimeSeries **hplus, REAL8TimeSeries **hcross, REAL8 deltaT, REAL8 m1, REAL8 m2, REAL8 fStart, REAL8 fRef, REAL8 D, REAL8 s1x, REAL8 s1y, REAL8 s1z, REAL8 lnhatx, REAL8 lnhaty, REAL8 lnhatz, REAL8 incl, int phaseO, int amplitudeO, REAL8 phiRef)
Interface routine, calculating the prefered variables for the Spin-dominated waveforms.
static int generate_fd_waveform(COMPLEX16FrequencySeries **hplus, COMPLEX16FrequencySeries **hcross, LALDict *params, LALSimInspiralGenerator *myself)
Fourier domain polarizations.
static int generate_fd_modes(SphHarmFrequencySeries **hlm, LALDict *params, LALSimInspiralGenerator *myself)
Define waveform generator methods to generate polarizations or modes in time or Fourier domain for le...
static int generate_td_waveform(REAL8TimeSeries **hplus, REAL8TimeSeries **hcross, LALDict *params, LALSimInspiralGenerator *myself)
Time domain polarizations.
static int XLALSimInspiralChooseTDWaveform_legacy(REAL8TimeSeries **hplus, REAL8TimeSeries **hcross, REAL8 m1, REAL8 m2, REAL8 S1x, REAL8 S1y, REAL8 S1z, REAL8 S2x, REAL8 S2y, REAL8 S2z, REAL8 distance, REAL8 inclination, REAL8 phiRef, REAL8 longAscNodes, REAL8 eccentricity, REAL8 meanPerAno, REAL8 deltaT, REAL8 f_min, REAL8 f_ref, LALDict *params, Approximant approximant)
Copy of the old code of XLALSimInspiralChooseTDWaveform().
static int generate_td_modes(SphHarmTimeSeries **hlm, LALDict *params, LALSimInspiralGenerator *myself)
Time domain modes.
#define DEFINE_GENERATOR_TEMPLATE(approx, fd_modes, fd_waveform, td_modes, td_waveform)
Define which methods are supported by every legacy approximant.
static int initialize(LALSimInspiralGenerator *myself, LALDict *params)
Method to initialize generator.
static SphHarmFrequencySeries * XLALSimInspiralChooseFDModes_legacy(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)
Copy of the old code of XLALSimInspiralChooseFDModes().
static SphHarmTimeSeries * XLALSimInspiralChooseTDModes_legacy(REAL8 phiRef, REAL8 deltaT, REAL8 m1, REAL8 m2, REAL8 S1x, REAL8 S1y, REAL8 S1z, REAL8 S2x, REAL8 S2y, REAL8 S2z, REAL8 f_min, REAL8 f_ref, REAL8 r, LALDict *LALpars, int lmax, Approximant approximant)
Copy of the old code of XLALSimInspiralChooseTDModes().
static int XLALSimInspiralChooseFDWaveform_legacy(COMPLEX16FrequencySeries **hptilde, COMPLEX16FrequencySeries **hctilde, REAL8 m1, REAL8 m2, REAL8 S1x, REAL8 S1y, REAL8 S1z, REAL8 S2x, REAL8 S2y, REAL8 S2z, REAL8 distance, REAL8 inclination, REAL8 phiRef, REAL8 longAscNodes, REAL8 eccentricity, REAL8 meanPerAno, REAL8 deltaF, REAL8 f_min, REAL8 f_max, REAL8 f_ref, LALDict *params, Approximant approximant)
int XLALSimInspiralWaveformParamsInsertModeArray(LALDict *params, LALValue *value)
LALValue * XLALSimInspiralWaveformParamsLookupModeArray(LALDict *params)
REAL8 XLALSimInspiralWaveformParamsLookupDOmega220(LALDict *params)
int XLALSimInspiralWaveformParamsInsertDTau220(LALDict *params, REAL8 value)
int XLALSimInspiralWaveformParamsInsertDOmega440(LALDict *params, REAL8 value)
REAL8 XLALSimInspiralWaveformParamsLookupDTau220(LALDict *params)
int XLALSimInspiralWaveformParamsInsertTidalQuadrupolarFMode1(LALDict *params, REAL8 value)
INT4 XLALSimInspiralWaveformParamsLookupEnableLIV(LALDict *params)
int XLALSimInspiralWaveformParamsInsertDTau440(LALDict *params, REAL8 value)
int XLALSimInspiralWaveformParamsInsertPhenomXPNRUseTunedCoprec33(LALDict *params, INT4 value)
int XLALSimInspiralWaveformParamsInsertEccentricityFreq(LALDict *params, REAL8 value)
REAL8 XLALSimInspiralWaveformParamsLookupDOmega550(LALDict *params)
REAL8 XLALSimInspiralWaveformParamsLookupDTau550(LALDict *params)
int XLALSimInspiralWaveformParamsInsertPhenomXPNRUseTunedAngles(LALDict *params, INT4 value)
REAL8 XLALSimInspiralWaveformParamsLookupdQuadMon1(LALDict *params)
INT4 XLALSimInspiralWaveformParamsLookupFrameAxis(LALDict *params)
REAL8 XLALSimInspiralWaveformParamsLookupTidalLambda2(LALDict *params)
int XLALSimInspiralWaveformParamsInsertDOmega330(LALDict *params, REAL8 value)
int XLALSimInspiralWaveformParamsInsertDOmega550(LALDict *params, REAL8 value)
int XLALSimInspiralWaveformParamsInsertTidalOctupolarFMode1(LALDict *params, REAL8 value)
int XLALSimInspiralWaveformParamsInsertDTau330(LALDict *params, REAL8 value)
int XLALSimInspiralWaveformParamsInsertDOmega210(LALDict *params, REAL8 value)
REAL8 XLALSimInspiralWaveformParamsLookupDTau330(LALDict *params)
int XLALSimInspiralWaveformParamsInsertPhenomXAntisymmetricWaveform(LALDict *params, INT4 value)
REAL8 XLALSimInspiralWaveformParamsLookupDOmega210(LALDict *params)
REAL8 XLALSimInspiralWaveformParamsLookupEccentricityFreq(LALDict *params)
int XLALSimInspiralWaveformParamsInsertTidalOctupolarLambda1(LALDict *params, REAL8 value)
int XLALSimInspiralWaveformParamsInsertTidalOctupolarFMode2(LALDict *params, REAL8 value)
int XLALSimInspiralWaveformParamsInsertPhenomXPNRForceXHMAlignment(LALDict *params, INT4 value)
INT4 XLALSimInspiralWaveformParamsLookupPhenomXPHMUseModes(LALDict *params)
REAL8 XLALSimInspiralWaveformParamsLookupTidalLambda1(LALDict *params)
const char * XLALSimInspiralWaveformParamsLookupNumRelData(LALDict *params)
int XLALSimInspiralWaveformParamsInsertDOmega220(LALDict *params, REAL8 value)
int XLALSimInspiralWaveformParamsInsertPhenomXHMReleaseVersion(LALDict *params, INT4 value)
REAL8 XLALSimInspiralWaveformParamsLookupDOmega440(LALDict *params)
int XLALSimInspiralWaveformParamsInsertPhenomXPNRUseTunedCoprec(LALDict *params, INT4 value)
REAL8 XLALSimInspiralWaveformParamsLookupPhenomXHMThresholdMband(LALDict *params)
REAL8 XLALSimInspiralWaveformParamsLookupDTau210(LALDict *params)
INT4 XLALSimInspiralWaveformParamsLookupPNPhaseOrder(LALDict *params)
INT4 XLALSimInspiralWaveformParamsLookupPNAmplitudeOrder(LALDict *params)
REAL8 XLALSimInspiralWaveformParamsLookupDOmega330(LALDict *params)
int XLALSimInspiralWaveformParamsModesChoiceIsDefault(LALDict *params)
INT4 XLALSimInspiralWaveformParamsLookupPhenomXPNRUseTunedAngles(LALDict *params)
REAL8 XLALSimInspiralWaveformParamsLookupdQuadMon2(LALDict *params)
int XLALSimInspiralWaveformParamsInsertDTau550(LALDict *params, REAL8 value)
INT4 XLALSimInspiralWaveformParamsLookupPhenomXAntisymmetricWaveform(LALDict *params)
INT4 XLALSimInspiralWaveformParamsLookupPNTidalOrder(LALDict *params)
int XLALSimInspiralWaveformParamsInsertDTau210(LALDict *params, REAL8 value)
int XLALSimInspiralWaveformParamsInsertdQuadMon2(LALDict *params, REAL8 value)
int XLALSimInspiralWaveformParamsInsertTidalOctupolarLambda2(LALDict *params, REAL8 value)
int XLALSimInspiralWaveformParamsInsertPhenomXTidalFlag(LALDict *params, INT4 value)
int XLALSimInspiralWaveformParamsInsertTidalQuadrupolarFMode2(LALDict *params, REAL8 value)
int XLALSimInspiralWaveformParamsInsertdQuadMon1(LALDict *params, REAL8 value)
int XLALSimInspiralWaveformParamsInsertPhenomXPrecVersion(LALDict *params, INT4 value)
int XLALSimInspiralWaveformParamsPNSpinOrderIsDefault(LALDict *params)
int XLALSimInspiralWaveformParamsFrameAxisIsDefault(LALDict *params)
REAL8 XLALSimInspiralWaveformParamsLookupDTau440(LALDict *params)
REAL8 XLALSimUniversalRelationlambda3TidalVSlambda2Tidal(REAL8 lambda2bar)
Eq.
REAL8 XLALSimUniversalRelationomega03TidalVSlambda3Tidal(REAL8 lambda3bar)
Eq.
REAL8 XLALSimUniversalRelationQuadMonVSlambda2Tidal(REAL8 lambda2bar)
REAL8 XLALSimUniversalRelationomega02TidalVSlambda2Tidal(REAL8 lambda2bar)
Eq.
void XLALDestroyValue(LALValue *value)
static REAL8 pfac(int n)
REAL8 tmp1
int l
Definition: bh_qnmode.c:135
double i
Definition: bh_ringdown.c:118
double e
Definition: bh_ringdown.c:117
#define checkCOSpinZero(s2x, s2y, s2z)
#define checkTransverseSpinsZero(s1x, s1y, s2x, s2y)
#define checkAlignedSpinsEqual(s1z, s2z)
#define checkSpinsZero(s1x, s1y, s1z, s2x, s2y, s2z)
#define checkTidesZero(lambda1, lambda2)
#define FIX_REFERENCE_FREQUENCY(f_ref, f_min, approximant)
COMPLEX16FrequencySeries * XLALResizeCOMPLEX16FrequencySeries(COMPLEX16FrequencySeries *series, int first, size_t length)
COMPLEX16FrequencySeries * XLALCreateCOMPLEX16FrequencySeries(const CHAR *name, const LIGOTimeGPS *epoch, REAL8 f0, REAL8 deltaF, const LALUnit *sampleUnits, size_t length)
#define LAL_PI_2
#define LAL_MSUN_SI
#define LAL_PI
#define LAL_MTSUN_SI
#define LAL_MRSUN_SI
double complex COMPLEX16
double REAL8
int16_t INT2
uint16_t UINT2
uint32_t UINT4
int32_t INT4
void * XLALMalloc(size_t n)
void XLALFree(void *p)
@ IMRPhenomPv1_V
version 1: based on IMRPhenomC
Definition: LALSimIMR.h:74
@ IMRPhenomPv2_V
version 2: based on IMRPhenomD
Definition: LALSimIMR.h:75
@ IMRPhenomPv2NRTidal_V
version Pv2_NRTidal: based on IMRPhenomPv2; NRTides added before precession; can be used with both NR...
Definition: LALSimIMR.h:76
@ SEOBNRv4TSurrogate_CUBIC
use cubic splines in frequency
Definition: LALSimIMR.h:89
@ NRTidal_V
version NRTidal: based on https://arxiv.org/pdf/1706.02969.pdf
Definition: LALSimIMR.h:81
@ NoNRT_V
special case for PhenomPv2 BBH baseline
Definition: LALSimIMR.h:85
@ NRTidalv2NSBH_V
version NRTidalv2: https://arxiv.org/abs/1905.06011 with amplitude corrections for NSBH (used for SEO...
Definition: LALSimIMR.h:84
@ NRTidalv2_V
version NRTidalv2: https://arxiv.org/abs/1905.06011
Definition: LALSimIMR.h:82
int XLALSimIMREOBNRv2AllModes(REAL8TimeSeries **hplus, REAL8TimeSeries **hcross, const REAL8 phiC, const REAL8 deltaT, const REAL8 m1SI, const REAL8 m2SI, const REAL8 fLower, const REAL8 distance, const REAL8 inclination)
This function generates the plus and cross polarizations for the EOBNRv2 approximant with all availab...
SphHarmTimeSeries * XLALSimIMREOBNRv2Modes(const REAL8 deltaT, const REAL8 m1, const REAL8 m2, const REAL8 fLower, const REAL8 distance)
Wrapper function to generate the -2 spin-weighted spherical harmonic modes (as opposed to generating ...
int XLALSimIMREOBNRv2DominantMode(REAL8TimeSeries **hplus, REAL8TimeSeries **hcross, const REAL8 phiC, const REAL8 deltaT, const REAL8 m1SI, const REAL8 m2SI, const REAL8 fLower, const REAL8 distance, const REAL8 inclination)
This function generates the plus and cross polarizations for the dominant (2,2) mode of the EOBNRv2 a...
int XLALSimIMRPhenomBGenerateFD(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)
Driver routine to compute the spin-aligned, inspiral-merger-ringdown phenomenological waveform IMRPhe...
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 XLALSimIMRPhenomDGenerateFD(COMPLEX16FrequencySeries **htilde, const REAL8 phi0, const REAL8 fRef, const REAL8 deltaF, const REAL8 m1_SI, const REAL8 m2_SI, const REAL8 chi1, const REAL8 chi2, const REAL8 f_min, const REAL8 f_max, const REAL8 distance, LALDict *extraParams, NRTidal_version_type NRTidal_version)
Driver routine to compute the spin-aligned, inspiral-merger-ringdown phenomenological waveform IMRPhe...
int XLALSimIMRPhenomPCalculateModelParametersFromSourceFrame(REAL8 *chi1_l, REAL8 *chi2_l, REAL8 *chip, REAL8 *thetaJN, REAL8 *alpha0, REAL8 *phi_aligned, REAL8 *zeta_polariz, const REAL8 m1_SI, const REAL8 m2_SI, const REAL8 f_ref, const REAL8 phiRef, const REAL8 incl, const REAL8 s1x, const REAL8 s1y, const REAL8 s1z, const REAL8 s2x, const REAL8 s2y, const REAL8 s2z, IMRPhenomP_version_type IMRPhenomP_version)
Function to map LAL parameters (masses, 6 spin components, phiRef and inclination at f_ref) (assumed ...
double XLALSimIMRPhenomBComputeChi(const REAL8 m1, const REAL8 m2, const REAL8 s1z, const REAL8 s2z)
Compute the dimensionless, spin-aligned parameter chi as used in the IMRPhenomB waveform.
int XLALSimIMRPhenomAGenerateFD(COMPLEX16FrequencySeries **htilde, const REAL8 phiPeak, const REAL8 deltaF, const REAL8 m1_SI, const REAL8 m2_SI, const REAL8 f_min, const REAL8 f_max, const REAL8 distance)
Driver routine to compute the non-spinning, inspiral-merger-ringdown phenomenological waveform IMRPhe...
int XLALSimIMRPhenomAGenerateTD(REAL8TimeSeries **hplus, REAL8TimeSeries **hcross, const REAL8 phiPeak, const REAL8 deltaT, const REAL8 m1_SI, const REAL8 m2_SI, const REAL8 f_min, const REAL8 f_max, const REAL8 distance, const REAL8 inclination)
Driver routine to compute the non-spinning, inspiral-merger-ringdown phenomenological waveform IMRPhe...
int XLALSimIMRPhenomCGenerateTD(REAL8TimeSeries **hplus, REAL8TimeSeries **hcross, const REAL8 phiPeak, const REAL8 deltaT, const REAL8 m1_SI, const REAL8 m2_SI, const REAL8 chi, const REAL8 f_min, const REAL8 f_max, const REAL8 distance, const REAL8 inclination, LALDict *extraParams)
Driver routine to compute the spin-aligned, inspiral-merger-ringdown phenomenological waveform IMRPhe...
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...
int XLALSimIMRPhenomNSBH(COMPLEX16FrequencySeries **htilde, REAL8 phiRef, REAL8 deltaF, REAL8 fLow, REAL8 fHigh, REAL8 fRef, REAL8 distance, REAL8 mBH_SI, REAL8 mNS_SI, REAL8 chi_BH, REAL8 chi_NS, LALDict *extraParams)
Driver routine to compute the single-spin, non-precessing, neutron-star-black-hole,...
int XLALSimIMRPhenomBGenerateTD(REAL8TimeSeries **hplus, REAL8TimeSeries **hcross, const REAL8 phiPeak, const REAL8 deltaT, const REAL8 m1_SI, const REAL8 m2_SI, const REAL8 chi, const REAL8 f_min, const REAL8 f_max, const REAL8 distance, const REAL8 inclination)
Driver routine to compute the spin-aligned, inspiral-merger-ringdown phenomenological waveform IMRPhe...
SphHarmTimeSeries * XLALSimIMRPhenomTPHM_ChooseTDModes(REAL8 m1_SI, REAL8 m2_SI, REAL8 chi1x, REAL8 chi1y, REAL8 chi1z, REAL8 chi2x, REAL8 chi2y, REAL8 chi2z, REAL8 distance, REAL8 deltaT, REAL8 fmin, REAL8 fRef, LALDict *lalParams)
Routine to be used by ChooseTDModes, it returns a list of the time-domain modes of the IMRPhenomTPHM ...
int XLALSimIMRPhenomTHM(REAL8TimeSeries **hp, REAL8TimeSeries **hc, REAL8 m1_SI, REAL8 m2_SI, REAL8 chi1L, REAL8 chi2L, REAL8 distance, REAL8 inclination, REAL8 deltaT, REAL8 fmin, REAL8 fRef, REAL8 phiRef, LALDict *lalparams)
Routine to compute time domain polarisations for IMRPhenomTHM model.
SphHarmTimeSeries * XLALSimIMRPhenomTHM_Modes(REAL8 m1_SI, REAL8 m2_SI, REAL8 chi1L, REAL8 chi2L, REAL8 distance, REAL8 deltaT, REAL8 fmin, REAL8 fRef, REAL8 phiRef, LALDict *lalParams)
Routine to compute time domain Spin-Weighted Spherical Harmonic modes for IMRPhenomTHM model.
int XLALSimIMRPhenomT(REAL8TimeSeries **hp, REAL8TimeSeries **hc, REAL8 m1_SI, REAL8 m2_SI, REAL8 chi1L, REAL8 chi2L, REAL8 distance, REAL8 inclination, REAL8 deltaT, REAL8 fmin, REAL8 fRef, REAL8 phiRef, LALDict *lalParams)
Routine to compute time domain polarisations for IMRPhenomT model.
int XLALSimIMRPhenomTPHM(REAL8TimeSeries **hp, REAL8TimeSeries **hc, REAL8 m1_SI, REAL8 m2_SI, REAL8 chi1x, REAL8 chi1y, REAL8 chi1z, REAL8 chi2x, REAL8 chi2y, REAL8 chi2z, REAL8 distance, REAL8 inclination, REAL8 deltaT, REAL8 fmin, REAL8 fRef, REAL8 phiRef, LALDict *lalParams)
Routine to compute time-domain polarizations for the IMRPhenomTPHM model.
int XLALSimIMRPhenomTP(REAL8TimeSeries **hp, REAL8TimeSeries **hc, REAL8 m1_SI, REAL8 m2_SI, REAL8 chi1x, REAL8 chi1y, REAL8 chi1z, REAL8 chi2x, REAL8 chi2y, REAL8 chi2z, REAL8 distance, REAL8 inclination, REAL8 deltaT, REAL8 fmin, REAL8 fRef, REAL8 phiRef, LALDict *lalParams)
Routine to compute time-domain polarizations for the IMRPhenomTP model.
int XLALSimIMRPhenomXPHMFromModes(COMPLEX16FrequencySeries **hptilde, COMPLEX16FrequencySeries **hctilde, REAL8 m1_SI, REAL8 m2_SI, REAL8 chi1x, REAL8 chi1y, REAL8 chi1z, REAL8 chi2x, REAL8 chi2y, REAL8 chi2z, const REAL8 distance, const REAL8 inclination, const REAL8 phiRef, REAL8 f_min, REAL8 f_max, const REAL8 deltaF, REAL8 fRef_In, LALDict *lalParams)
Returns hptilde and hctilde of the multimode precessing waveform for positive frequencies in an equal...
int XLALSimIMRPhenomXASGenerateFD(COMPLEX16FrequencySeries **htilde22, REAL8 m1_SI, REAL8 m2_SI, REAL8 chi1L, REAL8 chi2L, REAL8 distance, REAL8 f_min, REAL8 f_max, REAL8 deltaF, REAL8 phiRef, REAL8 fRef_In, LALDict *lalParams)
Driver routine to calculate an IMRPhenomX aligned-spin, inspiral-merger-ringdown phenomenological wav...
int XLALSimIMRPhenomXHMModes(SphHarmFrequencySeries **hlms, REAL8 m1_SI, REAL8 m2_SI, REAL8 S1z, REAL8 S2z, REAL8 deltaF, REAL8 f_min, REAL8 f_max, REAL8 f_ref, REAL8 phiRef, REAL8 distance, LALDict *LALparams)
Function to obtain a SphHarmFrequencySeries with the individual modes h_lm.
int XLALSimIMRPhenomXHM(COMPLEX16FrequencySeries **hptilde, COMPLEX16FrequencySeries **hctilde, REAL8 m1_SI, REAL8 m2_SI, REAL8 chi1z, REAL8 chi2z, REAL8 f_min, REAL8 f_max, REAL8 deltaF, REAL8 distance, REAL8 inclination, REAL8 phiRef, REAL8 fRef_In, LALDict *lalParams)
Returns the hptilde and hctilde of the multimode waveform for positive frequencies.
int XLALSimIMRPhenomXPGenerateFD(COMPLEX16FrequencySeries **hptilde, COMPLEX16FrequencySeries **hctilde, REAL8 m1_SI, REAL8 m2_SI, REAL8 chi1x, REAL8 chi1y, REAL8 chi1z, REAL8 chi2x, REAL8 chi2y, REAL8 chi2z, const REAL8 distance, const REAL8 inclination, const REAL8 phiRef, REAL8 f_min, REAL8 f_max, const REAL8 deltaF, REAL8 fRef_In, LALDict *lalParams)
int XLALSimIMRPhenomXPHM(COMPLEX16FrequencySeries **hptilde, COMPLEX16FrequencySeries **hctilde, REAL8 m1_SI, REAL8 m2_SI, REAL8 chi1x, REAL8 chi1y, REAL8 chi1z, REAL8 chi2x, REAL8 chi2y, REAL8 chi2z, REAL8 distance, REAL8 inclination, REAL8 phiRef, REAL8 f_min, REAL8 f_max, REAL8 deltaF, REAL8 fRef_In, LALDict *lalParams)
Returns hptilde and hctilde of the multimode precessing waveform for positive frequencies in an equal...
int XLALSimIMRPhenomXHM2(COMPLEX16FrequencySeries **hptilde, COMPLEX16FrequencySeries **hctilde, REAL8 m1_SI, REAL8 m2_SI, REAL8 chi1L, REAL8 chi2L, REAL8 distance, REAL8 f_min, REAL8 f_max, REAL8 deltaF, REAL8 inclination, REAL8 phiRef, REAL8 fRef_In, LALDict *lalParams)
Returns the hptilde and hctilde of the multimode waveform for positive frequencies.
int XLALSimIMRSEOBNRv4ROM(struct tagCOMPLEX16FrequencySeries **hptilde, struct tagCOMPLEX16FrequencySeries **hctilde, REAL8 phiRef, REAL8 deltaF, REAL8 fLow, REAL8 fHigh, REAL8 fRef, REAL8 distance, REAL8 inclination, REAL8 m1SI, REAL8 m2SI, REAL8 chi1, REAL8 chi2, INT4 nk_max, LALDict *LALparams, NRTidal_version_type NRTidal_version)
Compute waveform in LAL format for the SEOBNRv4_ROM model.
int XLALSimIMRSEOBNRv2ROMDoubleSpin(struct tagCOMPLEX16FrequencySeries **hptilde, struct tagCOMPLEX16FrequencySeries **hctilde, REAL8 phiRef, REAL8 deltaF, REAL8 fLow, REAL8 fHigh, REAL8 fRef, REAL8 distance, REAL8 inclination, REAL8 m1SI, REAL8 m2SI, REAL8 chi1, REAL8 chi2)
Compute waveform in LAL format for the SEOBNRv2_ROM_DoubleSpin model.
int XLALSimIMRSEOBNRv2ROMDoubleSpinHI(struct tagCOMPLEX16FrequencySeries **hptilde, struct tagCOMPLEX16FrequencySeries **hctilde, REAL8 phiRef, REAL8 deltaF, REAL8 fLow, REAL8 fHigh, REAL8 fRef, REAL8 distance, REAL8 inclination, REAL8 m1SI, REAL8 m2SI, REAL8 chi1, REAL8 chi2, INT4 nk_max)
Compute waveform in LAL format for the SEOBNRv2_ROM_DoubleSpin_HI model.
int XLALSimIMRSEOBNRv1ROMEffectiveSpin(struct tagCOMPLEX16FrequencySeries **hptilde, struct tagCOMPLEX16FrequencySeries **hctilde, REAL8 phiRef, REAL8 deltaF, REAL8 fLow, REAL8 fHigh, REAL8 fRef, REAL8 distance, REAL8 inclination, REAL8 m1SI, REAL8 m2SI, REAL8 chi)
Compute waveform in LAL format for the SEOBNRv1_ROM_EffectiveSpin model.
int XLALSimIMRSEOBNRv2ROMEffectiveSpin(struct tagCOMPLEX16FrequencySeries **hptilde, struct tagCOMPLEX16FrequencySeries **hctilde, REAL8 phiRef, REAL8 deltaF, REAL8 fLow, REAL8 fHigh, REAL8 fRef, REAL8 distance, REAL8 inclination, REAL8 m1SI, REAL8 m2SI, REAL8 chi)
Compute waveform in LAL format for the SEOBNRv2_ROM_EffectiveSpin model.
int XLALSimIMRSEOBNRv1ROMDoubleSpin(struct tagCOMPLEX16FrequencySeries **hptilde, struct tagCOMPLEX16FrequencySeries **hctilde, REAL8 phiRef, REAL8 deltaF, REAL8 fLow, REAL8 fHigh, REAL8 fRef, REAL8 distance, REAL8 inclination, REAL8 m1SI, REAL8 m2SI, REAL8 chi1, REAL8 chi2)
Compute waveform in LAL format for the SEOBNRv1_ROM_DoubleSpin model.
int XLALSimIMRSEOBNRv4TSurrogate(struct tagCOMPLEX16FrequencySeries **hptilde, struct tagCOMPLEX16FrequencySeries **hctilde, REAL8 phiRef, REAL8 deltaF, REAL8 fLow, REAL8 fHigh, REAL8 fRef, REAL8 distance, REAL8 inclination, REAL8 m1SI, REAL8 m2SI, REAL8 chi1, REAL8 chi2, REAL8 lambda1, REAL8 lambda2, SEOBNRv4TSurrogate_spline_order spline_order)
Compute waveform in LAL format for the SEOBNRv4T_surrogate model.
int XLALSimIMRSpinAlignedEOBModes(SphHarmTimeSeries **hlmmode, REAL8Vector **dynamics_out, REAL8Vector **dynamicsHi_out, REAL8 deltaT, const REAL8 m1SI, const REAL8 m2SI, const REAL8 fMin, const REAL8 r, const REAL8 spin1z, const REAL8 spin2z, UINT4 SpinAlignedEOBversion, const REAL8 lambda2Tidal1, const REAL8 lambda2Tidal2, const REAL8 omega02Tidal1, const REAL8 omega02Tidal2, const REAL8 lambda3Tidal1, const REAL8 lambda3Tidal2, const REAL8 omega03Tidal1, const REAL8 omega03Tidal2, const REAL8 quadparam1, const REAL8 quadparam2, REAL8Vector *nqcCoeffsInput, const INT4 nqcFlag, LALDict *PAParams, LALDict *TGRParams)
This function generates spin-aligned SEOBNRv1,2,2opt,4,4opt,2T,4T,4HM complex modes hlm.
int XLALSimIMRSpinAlignedEOBWaveform(REAL8TimeSeries **hplus, REAL8TimeSeries **hcross, const REAL8 phiC, REAL8 deltaT, const REAL8 m1SI, const REAL8 m2SI, const REAL8 fMin, const REAL8 r, const REAL8 inc, const REAL8 spin1z, const REAL8 spin2z, UINT4 SpinAlignedEOBversion, LALDict *LALparams)
int XLALSimIMRPhenomDNRTidal(COMPLEX16FrequencySeries **htilde, REAL8 phiRef, REAL8 deltaF, REAL8 fLow, REAL8 fHigh, REAL8 fRef, REAL8 distance, REAL8 m1_SI, REAL8 m2_SI, REAL8 chi1, REAL8 chi2, REAL8 lambda1, REAL8 lambda2, LALDict *extraParams, NRTidal_version_type NRTidal_version)
Compute waveform in LAL format for the IMRPhenomD_NRTidal tidal model based on IMRPhenomD.
int XLALSimIMRSEOBNRv4ROMNRTidal(struct tagCOMPLEX16FrequencySeries **hptilde, struct tagCOMPLEX16FrequencySeries **hctilde, REAL8 phiRef, REAL8 deltaF, REAL8 fLow, REAL8 fHigh, REAL8 fRef, REAL8 distance, REAL8 inclination, REAL8 m1_SI, REAL8 m2_SI, REAL8 chi1, REAL8 chi2, REAL8 Lambda1, REAL8 Lambda2, LALDict *LALparams, NRTidal_version_type NRTidal_version)
Compute waveform in LAL format for the SEOBNRv4_ROM_NRTidal tidal model based on SEOBNRv4_ROM.
int XLALSimIMRLackeyTidal2013(struct tagCOMPLEX16FrequencySeries **hptilde, struct tagCOMPLEX16FrequencySeries **hctilde, REAL8 phiRef, REAL8 deltaF, REAL8 fLow, REAL8 fHigh, REAL8 fRef, REAL8 distance, REAL8 inclination, REAL8 mBH_SI, REAL8 mNS_SI, REAL8 chi_BH, REAL8 Lambda)
Compute waveform in LAL format for the Lackey et al (2013) tidal model based on SEOBNRv2_ROM_DoubleSp...
void XLALSimInspiralParseDictionaryToChooseTDWaveform(REAL8 *m1, REAL8 *m2, REAL8 *S1x, REAL8 *S1y, REAL8 *S1z, REAL8 *S2x, REAL8 *S2y, REAL8 *S2z, REAL8 *distance, REAL8 *inclination, REAL8 *phiRef, REAL8 *longAscNodes, REAL8 *eccentricity, REAL8 *meanPerAno, REAL8 *deltaT, REAL8 *f_min, REAL8 *f_ref, LALDict *params)
Insert all the input arguments needed by XALSimInspiralChooseTDWaveform() into a laldictionary.
void XLALSimInspiralParseDictionaryToChooseTDModes(REAL8 *phiRef, REAL8 *deltaT, REAL8 *m1, REAL8 *m2, REAL8 *S1x, REAL8 *S1y, REAL8 *S1z, REAL8 *S2x, REAL8 *S2y, REAL8 *S2z, REAL8 *f_min, REAL8 *f_ref, REAL8 *distance, INT4 *lmax, LALDict *params)
Insert all the input arguments needed by XLALSimInspiralChooseTDModes() into a laldictionary.
void XLALSimInspiralParseDictionaryToChooseFDWaveform(REAL8 *m1, REAL8 *m2, REAL8 *S1x, REAL8 *S1y, REAL8 *S1z, REAL8 *S2x, REAL8 *S2y, REAL8 *S2z, REAL8 *distance, REAL8 *inclination, REAL8 *phiRef, REAL8 *longAscNodes, REAL8 *eccentricity, REAL8 *meanPerAno, REAL8 *deltaF, REAL8 *f_min, REAL8 *f_max, REAL8 *f_ref, LALDict *params)
Insert all the input arguments needed by XLALSimInspiralChooseFDWaveform() into a laldictionary.
void XLALSimInspiralParseDictionaryToChooseFDModes(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)
Insert all the input arguments needed by XLALSimInspiralChooseFDModes() into a laldictionary.
int XLALSimInspiralTDFromFD(REAL8TimeSeries **hplus, REAL8TimeSeries **hcross, REAL8 m1, REAL8 m2, REAL8 S1x, REAL8 S1y, REAL8 S1z, REAL8 S2x, REAL8 S2y, REAL8 S2z, REAL8 distance, REAL8 inclination, REAL8 phiRef, REAL8 longAscNodes, REAL8 eccentricity, REAL8 meanPerAno, REAL8 deltaT, REAL8 f_min, REAL8 f_ref, LALDict *LALparams, Approximant approximant)
Helper routines for XLALSimInspiralTD(): performs conditioning of a FD waveform and transforms it to ...
Approximant
Enum that specifies the PN approximant to be used in computing the waveform.
@ TaylorR2F4
A frequency domain model closely related to TaylorT4.
@ EOBNRv2HM
UNDOCUMENTED.
@ SpinTaylorT4
Spinning case T4 models (lalsimulation's equivalent of SpinTaylorFrameless).
@ IMRPhenomPv3
Frequency domain (generic spins) inspiral-merger-ringdown templates of Hannam et al....
@ TaylorF2RedSpinTidal
TaylorF2 waveforms for non-precessing spins, defined in terms of a single (reduced-spin) parameter [A...
@ TaylorEt
UNDOCUMENTED.
@ SpinTaylorT5Fourier
Frequency domain (generic spins) inspiral only waveforms based on TaylorT5, , (the paper refers to S...
@ SEOBNRv4HM_PA
@ SEOBNRv2_ROM_DoubleSpin_HI
High resolution low-mass double-spin frequency domain reduced order model of spin-aligned EOBNR model...
@ SEOBNRv4_ROM_NRTidal
Low-mass double-spin frequency domain reduced order model of spin-aligned EOBNR model SEOBNRv4 [Bohe ...
@ IMRPhenomXAS_NRTidalv2
Spin non-precessing EOBNR model v4 with higher modes post-adiabatic dynamics (time domain) and TGR ri...
@ SEOBNRv2
Spin-aligned EOBNR model v2.
@ IMRPhenomTPHM
Time domain, precessing phenomenological IMR waveform model for L=2 sector ([arXiv: 20XY....
@ IMRPhenomP
Frequency domain (generic spins) inspiral-merger-ringdown templates of Hannam et al....
@ SEOBNRv4_ROM_NRTidalv2
based on NRTidalv2; https://arxiv.org/abs/1905.06011.
@ IMRPhenomXP
Frequency domain, precessing phenomenological IMR waveform model.
@ SEOBNRv2_opt
Optimized Spin-aligned EOBNR model v2.
@ SEOBNRv3_opt_rk4
USE RK4 Optimized Spin precessing EOBNR model v3.
@ IMRPhenomC
Frequency domain (non-precessing spins) inspiral-merger-ringdown templates of Santamaria et al [Santa...
@ SEOBNRv4HM_ROM
Low-mass double-spin frequency domain reduced order model of spin-aligned EOBNR model SEOBNRv4hm.
@ IMRPhenomPv2_NRTidal
Frequency domain tidal version of IMRPhenomPv2, using NRTidal framework from arXiv:1706....
@ SEOBNRv3_pert
Perturbed [m1 -> m1*(1+1e-15)] Spin precessing EOBNR model v3.
@ SEOBNRv1
Spin-aligned EOBNR model.
@ IMRPhenomT
@ Lackey_Tidal_2013_SEOBNRv2_ROM
Frequency domain tidal model based on reduced order model of SEOBNRv2.
@ NRHybSur3dq8
Time domain, aligned-spin, higher modes, hybridized.
@ HGimri
Time domain inspiral-merger-ringdown waveform for quasi-circular intermediate mass-ratio inspirals [H...
@ SEOBNRv4
Spin nonprecessing EOBNR model v4.
@ SEOBNRv3
Spin precessing EOBNR model v3.
@ EOBNRv2
UNDOCUMENTED.
@ IMRPhenomXO4a
Frequency domain, precessing with subdominant modes phenomenological IMR waveform model with NR-tuned...
@ TEOBResum_ROM
Time domain reduced order model of EOB with tidal effects.
@ IMRPhenomNSBH
NSBH Tidal model.
@ IMRPhenomXPHM
Frequency domain, precessing with subdominant modes phenomenological IMR waveform model.
@ IMRPhenomD
Frequency domain (non-precessing spins) inspiral-merger-ringdown templates of Husa et al,...
@ IMRPhenomXHM
Frequency domain, non-precessing phenomenological IMR waveform model with subdominant modes ([arXiv:2...
@ EccentricFD
Frequency domain waveform in the SPA to describe low eccentricity systems.
@ SEOBNRv2_ROM_EffectiveSpin
Single-spin frequency domain reduced order model of spin-aligned EOBNR model SEOBNRv2.
@ SEOBNRv4P
Spin precessing EOBNR model based on SEOBNRv4.
@ NRSur7dq4
q=4 extension of NRSur7dq2, arxiv: 1905.09300
@ IMRPhenomD_NRTidal
Uses arxiv:1706.02969 to upgrad IMRPhenomD to a tidal approximant.
@ TaylorF2RedSpin
TaylorF2 waveforms for non-precessing spins, defined in terms of a single (reduced-spin) parameter [A...
@ NR_hdf5
Time domain, NR waveform from HDF file.
@ SEOBNRv1_ROM_EffectiveSpin
Single-spin frequency domain reduced order model of spin-aligned EOBNR model SEOBNRv1 See [Purrer:201...
@ TaylorF2NLTides
The standard stationary phase approximation including a phenomenological model of nonlinear tidal eff...
@ IMRPhenomTP
Time domain, non-precessing phenomenological IMR waveform model with subdominant modes ([arXiv: 20XY....
@ IMRPhenomD_NRTidalv2
NRTidalv2; https://arxiv.org/abs/1905.06011.
@ IMRPhenomA
Time domain (non-spinning) inspiral-merger-ringdown waveforms generated from the inverse FFT of IMRPh...
@ IMRPhenomHM
Frequency domain with higher modes (non-precessing spins) inspiral-merger-ringdown templates,...
@ TaylorF2Ecc
The standard stationary phase approximation with eccentricity; Outputs a frequency-domain wave.
@ SEOBNRv4PHM
Spin precessing EOBNR model based on SEOBNRv4HM.
@ SpinTaylorT4Fourier
Frequency domain (generic spins) inspiral only waveforms based on TaylorT4, arXiv: 1408....
@ SpinDominatedWf
Time domain, inspiral only, 1 spin, precessing waveform, Tapai et al, arXiv: 1209....
@ IMRPhenomPv2
Frequency domain (generic spins) inspiral-merger-ringdown templates of Hannam et al....
@ IMRPhenomPv2_NRTidalv2
Frequency domain tidal version; based on https://arxiv.org/abs/1905.06011.
@ NRSur7dq2
Time domain, fully precessing NR surrogate model with up to ell=4 modes, arxiv: 1705....
@ TaylorT3
Time domain Taylor approximant in which phase is explicitly given as a function of time; outputs a ti...
@ SpinTaylorF2
Spinning case F2 models (single spin only).
@ NRSur4d2s
@ EOBNRv2HM_ROM
Frequency domain reduced order model of model EOBNRv2HM, no spin but with higher modes.
@ IMRPhenomXAS
Frequency domain, non-precessing phenomenological IMR waveform model ([arXiv:2001....
@ EOBNRv2_ROM
Frequency domain reduced order model of model EOBNRv2HM, no spin neither higher modes.
@ SpinTaylorT5
Spinning case T5 models, which is a variant of the spinning version of the original TaylorT2 (see ) d...
@ PhenSpinTaylor
Inspiral part of the PhenSpinTaylorRD.
@ TaylorT4
UNDOCUMENTED.
@ SEOBNRv4_ROM_NRTidalv2_NSBH
NSBH model based on SEOBNRv4_ROM_NRTidalv2.
@ SEOBNRv1_ROM_DoubleSpin
Double-spin frequency domain reduced order model of spin-aligned EOBNR model SEOBNRv1 See [Purrer:201...
@ SEOBNRv4HM
Spin nonprecessing EOBNR model v4 with higher modes, PhysRevD.98.084028 [arXiv:1803....
@ TaylorF2
The standard stationary phase approximation; Outputs a frequency-domain wave.
@ SEOBNRv4_ROM
Low-mass double-spin frequency domain reduced order model of spin-aligned EOBNR model SEOBNRv4.
@ SEOBNRv2_ROM_DoubleSpin
Double-spin frequency domain reduced order model of spin-aligned EOBNR model SEOBNRv2.
@ IMRPhenomB
Time domain (non-precessing spins) inspiral-merger-ringdown waveforms generated from the inverse FFT ...
@ PhenSpinTaylorRD
Phenomenological waveforms, interpolating between a T4 spin-inspiral and the ringdown.
@ SEOBNRv2T
Tidal EOB model.
@ IMRPhenomTHM
Time domain, non-precessing phenomenological IMR waveform model for the dominant (2,...
@ IMRPhenomPv3HM
Frequency domain (generic spins) inspiral-merger-ringdown templates of Khan et al.
@ pSEOBNRv4HM_PA
Spin non-precessing EOBNR model v4 with higher modes post-adiabatic dynamics (time domain),...
@ SEOBNRv4T
Tidal EOB model.
@ TaylorT1
Time domain Taylor approximant in which the energy and flux are both kept as Taylor expansions and a ...
@ SEOBNRv5_ROM
Time domain, precessing phenomenological IMR waveform model with subdominant modes ([arXiv: 20XY....
@ EccentricTD
Time domain Taylor T4 approximant including orbital eccentricity effects.
@ SEOBNRv3_opt
Optimized Spin precessing EOBNR model v3.
@ SpinTaylorT1
Spinning case T1 models.
@ IMRPhenomXP_NRTidalv2
Tidal extension of IMRPhenomXP based on [arXiv:1905.06011].
@ TEOBResumS
Resummed Spin-aligned Tidal EOB.
@ SEOBNRv5HM_ROM
External Python model.
@ TaylorT2
Time domain Taylor approximant in which the phase evolution is obtained by iteratively solving post-...
@ SEOBNRv4T_surrogate
Double-spin frequency domain surrogate model of spin-aligned tidal EOBNR model SEOBNRv4T.
@ SEOBNRv4_opt
Optimized Spin-aligned EOBNR model v4.
@ LAL_SIM_INSPIRAL_TESTGR_PARAMS
These approximants cannot accept testGR params as input params.
int XLALSimInspiralEccentricTDPNGenerator(REAL8TimeSeries **hplus, REAL8TimeSeries **hcross, REAL8 phiRef, REAL8 deltaT, REAL8 m1, REAL8 m2, REAL8 f_min, REAL8 fRef, REAL8 r, REAL8 i, REAL8 e_min, int amplitudeO, int phaseO)
Driver routine to compute the post-Newtonian inspiral waveform.
int XLALHGimriGenerator(REAL8TimeSeries **hplus, REAL8TimeSeries **hcross, REAL8 phiRef, REAL8 deltaT, REAL8 m1, REAL8 m2, REAL8 f_min, REAL8 r, REAL8 i, REAL8 S1z)
int XLALSimInspiralSpinTaylorT5Fourier(COMPLEX16FrequencySeries **hplus, COMPLEX16FrequencySeries **hcross, REAL8 fMin, REAL8 fMax, REAL8 deltaF, INT4 kMax, REAL8 phiRef, REAL8 v0, REAL8 m1, REAL8 m2, REAL8 fStart, REAL8 fRef, REAL8 r, REAL8 s1x, REAL8 s1y, REAL8 s1z, REAL8 s2x, REAL8 s2y, REAL8 s2z, REAL8 lnhatx, REAL8 lnhaty, REAL8 lnhatz, REAL8 e1x, REAL8 e1y, REAL8 e1z, REAL8 lambda1, REAL8 lambda2, REAL8 quadparam1, REAL8 quadparam2, LALDict *LALparams, INT4 phaseO, INT4 amplitudeO, INT4 phiRefAtEnd)
Driver routine to compute a precessing post-Newtonian inspiral waveform in the Fourier domain with ph...
int XLALSimInspiralSpinTaylorT5(REAL8TimeSeries **hplus, REAL8TimeSeries **hcross, REAL8 phiRef, REAL8 deltaT, REAL8 m1, REAL8 m2, REAL8 fStart, REAL8 fRef, REAL8 r, REAL8 s1x, REAL8 s1y, REAL8 s1z, REAL8 s2x, REAL8 s2y, REAL8 s2z, REAL8 lnhatx, REAL8 lnhaty, REAL8 lnhatz, REAL8 e1x, REAL8 e1y, REAL8 e1z, LALDict *LALparams)
Driver routine to compute a precessing post-Newtonian inspiral waveform with phasing computed from en...
int XLALSimInspiralInitialConditionsPrecessingApproxs(REAL8 *inc, REAL8 *S1x, REAL8 *S1y, REAL8 *S1z, REAL8 *S2x, REAL8 *S2y, REAL8 *S2z, const REAL8 inclIn, const REAL8 S1xIn, const REAL8 S1yIn, const REAL8 S1zIn, const REAL8 S2xIn, const REAL8 S2yIn, const REAL8 S2zIn, const REAL8 m1, const REAL8 m2, const REAL8 fRef, const REAL8 phiRef, LALSimInspiralFrameAxis axisChoice)
Function to specify the desired orientation of the spin components of a precessing binary.
int XLALSimInspiralSpinTaylorT4(REAL8TimeSeries **hplus, REAL8TimeSeries **hcross, REAL8 phiRef, REAL8 deltaT, REAL8 m1, REAL8 m2, REAL8 fStart, REAL8 fRef, REAL8 r, REAL8 s1x, REAL8 s1y, REAL8 s1z, REAL8 s2x, REAL8 s2y, REAL8 s2z, REAL8 lnhatx, REAL8 lnhaty, REAL8 lnhatz, REAL8 e1x, REAL8 e1y, REAL8 e1z, LALDict *LALParams)
int XLALSimInspiralSpinTaylorF2(COMPLEX16FrequencySeries **hplus_out, COMPLEX16FrequencySeries **hcross_out, REAL8 phi_ref, REAL8 deltaF, REAL8 m1_SI, REAL8 m2_SI, REAL8 s1x, REAL8 s1y, REAL8 s1z, REAL8 lnhatx, REAL8 lnhaty, REAL8 lnhatz, const REAL8 fStart, const REAL8 fEnd, const REAL8 f_ref, const REAL8 r, LALDict *moreParams, INT4 phaseO, INT4 amplitudeO)
Computes the stationary phase approximation to the Fourier transform of a chirp waveform with phase g...
int XLALSimInspiralSpinTaylorT1(REAL8TimeSeries **hplus, REAL8TimeSeries **hcross, REAL8 phiRef, REAL8 deltaT, REAL8 m1, REAL8 m2, REAL8 fStart, REAL8 fRef, REAL8 r, REAL8 s1x, REAL8 s1y, REAL8 s1z, REAL8 s2x, REAL8 s2y, REAL8 s2z, REAL8 lnhatx, REAL8 lnhaty, REAL8 lnhatz, REAL8 e1x, REAL8 e1y, REAL8 e1z, LALDict *LALparams)
int XLALSimInspiralSpinTaylorT4Fourier(COMPLEX16FrequencySeries **hplus, COMPLEX16FrequencySeries **hcross, REAL8 fMin, REAL8 fMax, REAL8 deltaF, INT4 kMax, REAL8 phiRef, REAL8 v0, REAL8 m1, REAL8 m2, REAL8 fStart, REAL8 fRef, REAL8 r, REAL8 s1x, REAL8 s1y, REAL8 s1z, REAL8 s2x, REAL8 s2y, REAL8 s2z, REAL8 lnhatx, REAL8 lnhaty, REAL8 lnhatz, REAL8 e1x, REAL8 e1y, REAL8 e1z, REAL8 lambda1, REAL8 lambda2, REAL8 quadparam1, REAL8 quadparam2, LALDict *LALparams, INT4 phaseO, INT4 amplitudeO, INT4 phiRefAtEnd)
Driver routine to compute a precessing post-Newtonian inspiral waveform in the Fourier domain with ph...
int XLALSimInspiralTaylorF2Ecc(COMPLEX16FrequencySeries **htilde, const REAL8 phi_ref, const REAL8 deltaF, const REAL8 m1_SI, const REAL8 m2_SI, const REAL8 S1z, const REAL8 S2z, const REAL8 fStart, const REAL8 fEnd, const REAL8 f_ref, const REAL8 r, const REAL8 eccentricity, LALDict *LALparams)
Computes the stationary phase approximation to the Fourier transform of a chirp waveform with eccentr...
int XLALSimInspiralTaylorF2ReducedSpinTidal(COMPLEX16FrequencySeries **htilde, const REAL8 phic, const REAL8 deltaF, const REAL8 m1_SI, const REAL8 m2_SI, const REAL8 chi, const REAL8 lam1, const REAL8 lam2, const REAL8 fStart, const REAL8 fEnd, const REAL8 r, const INT4 phaseO, const INT4 ampO)
Generate the "reduced-spin templates" proposed in http://arxiv.org/abs/1107.1267 Add the tidal phase ...
int XLALSimInspiralTaylorF2ReducedSpin(COMPLEX16FrequencySeries **htilde, const REAL8 phic, const REAL8 deltaF, const REAL8 m1_SI, const REAL8 m2_SI, const REAL8 chi, const REAL8 fStart, const REAL8 fEnd, const REAL8 r, const INT4 phaseO, const INT4 ampO)
Driver routine to compute a non-precessing post-Newtonian inspiral waveform in the frequency domain,...
REAL8 XLALSimInspiralTaylorF2ReducedSpinComputeChi(const REAL8 m1, const REAL8 m2, const REAL8 s1z, const REAL8 s2z)
Compute the dimensionless, aligned-spin parameter chi as used in the TaylorF2RedSpin waveform.
int XLALSimInspiralTaylorEtPNGenerator(REAL8TimeSeries **hplus, REAL8TimeSeries **hcross, REAL8 phic, REAL8 x0, REAL8 deltaT, REAL8 m1, REAL8 m2, REAL8 f_min, REAL8 r, REAL8 i, int amplitudeO, int phaseO)
Driver routine to compute the post-Newtonian inspiral waveform.
int XLALSimInspiralTaylorT1PNGenerator(REAL8TimeSeries **hplus, REAL8TimeSeries **hcross, REAL8 phiRef, REAL8 v0, REAL8 deltaT, REAL8 m1, REAL8 m2, REAL8 f_min, REAL8 fRef, REAL8 r, REAL8 i, REAL8 lambda1, REAL8 lambda2, LALSimInspiralTidalOrder tideO, int amplitudeO, int phaseO)
Driver routine to compute the post-Newtonian inspiral waveform.
int XLALSimInspiralTaylorF2(COMPLEX16FrequencySeries **htilde, const REAL8 phi_ref, const REAL8 deltaF, const REAL8 m1_SI, const REAL8 m2_SI, const REAL8 S1z, const REAL8 S2z, const REAL8 fStart, const REAL8 fEnd, const REAL8 f_ref, const REAL8 r, LALDict *LALpars)
Computes the stationary phase approximation to the Fourier transform of a chirp waveform.
int XLALSimInspiralTaylorT3PNGenerator(REAL8TimeSeries **hplus, REAL8TimeSeries **hcross, REAL8 phiRef, REAL8 v0, REAL8 deltaT, REAL8 m1, REAL8 m2, REAL8 f_min, REAL8 fRef, REAL8 r, REAL8 i, REAL8 lambda1, REAL8 lambda2, LALSimInspiralTidalOrder tideO, int amplitudeO, int phaseO)
Driver routine to compute the post-Newtonian inspiral waveform.
int XLALSimInspiralTaylorF2NLTides(COMPLEX16FrequencySeries **htilde, const REAL8 phi_ref, const REAL8 deltaF, const REAL8 m1_SI, const REAL8 m2_SI, const REAL8 S1z, const REAL8 S2z, const REAL8 fStart, const REAL8 fEnd, const REAL8 f_ref, const REAL8 r, LALDict *LALpars)
Computes the stationary phase approximation to the Fourier transform of a chirp waveform.
int XLALSimInspiralWaveformParamsNonGRAreDefault(LALDict *params)
bool XLALSimInspiralWaveformParamsFlagsAreDefault(LALDict *params)
Returns true if waveFlags is non-NULL and all of its fields have default value; returns false otherwi...
LALValue * XLALSimInspiralModeArrayDeactivateMode(LALValue *modes, unsigned l, int m)
LALValue * XLALSimInspiralCreateModeArray(void)
Create a LALValue pointer to store the mode array.
int XLALSimInspiralModeArrayIsModeActive(LALValue *modes, unsigned l, int m)
LALValue * XLALSimInspiralModeArrayActivateMode(LALValue *modes, unsigned l, int m)
LALValue * XLALSimInspiralModeArrayActivateAllModesAtL(LALValue *modes, unsigned l)
INT2Sequence * XLALSimInspiralModeArrayReadModes(LALValue *modes)
SphHarmTimeSeries * XLALSimInspiralPrecessingNRSurModes(REAL8 deltaT, REAL8 m1, REAL8 m2, REAL8 S1x, REAL8 S1y, REAL8 S1z, REAL8 S2x, REAL8 S2y, REAL8 S2z, REAL8 fMin, REAL8 fRef, REAL8 distance, LALDict *LALparams, Approximant approximant)
This function evaluates the NRSur7dq2 or NRSur7dq4 surrogate model and returns the inertial frame mod...
int XLALSimInspiralPrecessingNRSurPolarizations(REAL8TimeSeries **hplus, REAL8TimeSeries **hcross, REAL8 phiRef, REAL8 inclination, REAL8 deltaT, REAL8 m1, REAL8 m2, REAL8 distnace, REAL8 fMin, REAL8 fRef, REAL8 s1x, REAL8 s1y, REAL8 s1z, REAL8 s2x, REAL8 s2y, REAL8 s2z, LALDict *LALparams, Approximant approximant)
This function evaluates the NRSur7dq2 or NRSur7dq4 surrogate model and sums over all ell <= 4 modes t...
SphHarmTimeSeries * XLALSphHarmTimeSeriesAddMode(SphHarmTimeSeries *appended, const COMPLEX16TimeSeries *inmode, UINT4 l, INT4 m)
Prepend a node to a linked list of SphHarmTimeSeries, or create a new head.
COMPLEX16TimeSeries * XLALSphHarmTimeSeriesGetMode(SphHarmTimeSeries *ts, UINT4 l, INT4 m)
Get the time series of a waveform's (l,m) spherical harmonic mode from a SphHarmTimeSeries linked lis...
UINT4 XLALSphHarmTimeSeriesGetMaxL(SphHarmTimeSeries *ts)
Get the largest l index of any mode in the SphHarmTimeSeries linked list.
COMPLEX16FrequencySeries * XLALSphHarmFrequencySeriesGetMode(SphHarmFrequencySeries *ts, UINT4 l, INT4 m)
Get the time series of a waveform's (l,m) spherical harmonic mode from a SphHarmFrequencySeries linke...
SphHarmFrequencySeries * XLALSphHarmFrequencySeriesAddMode(SphHarmFrequencySeries *appended, const COMPLEX16FrequencySeries *inmode, UINT4 l, INT4 m)
Prepend a node to a linked list of SphHarmFrequencySeries, or create a new head.
void XLALDestroySphHarmFrequencySeries(SphHarmFrequencySeries *ts)
Delete list from current pointer to the end of the list.
void XLALSphHarmFrequencySeriesSetFData(SphHarmFrequencySeries *ts, REAL8Sequence *fdata)
Set the tdata member for all nodes in the list.
static const INT4 r
static const INT4 m
void XLALDestroyINT2Sequence(INT2Sequence *sequence)
void XLALDestroyREAL8Sequence(REAL8Sequence *sequence)
REAL8Sequence * XLALCreateREAL8Sequence(size_t length)
void XLALDestroyCOMPLEX16TimeSeries(COMPLEX16TimeSeries *series)
void XLALDestroyREAL8TimeSeries(REAL8TimeSeries *series)
COMPLEX16TimeSeries * XLALCutCOMPLEX16TimeSeries(const COMPLEX16TimeSeries *series, size_t first, size_t length)
COMPLEX16TimeSeries * XLALCreateCOMPLEX16TimeSeries(const CHAR *name, const LIGOTimeGPS *epoch, REAL8 f0, REAL8 deltaT, const LALUnit *sampleUnits, size_t length)
const LALUnit lalStrainUnit
void XLALDestroyREAL8Vector(REAL8Vector *vector)
#define XLAL_ERROR_NULL(...)
#define XLAL_ERROR(...)
#define XLAL_CHECK(assertion,...)
#define XLAL_PRINT_WARNING(...)
#define XLAL_TRY(statement, errnum)
int XLALPrintError(const char *fmt,...) _LAL_GCC_PRINTF_FORMAT_(1
int int XLALPrintWarning(const char *fmt,...) _LAL_GCC_PRINTF_FORMAT_(1
XLAL_SUCCESS
XLAL_EFUNC
XLAL_EDOM
XLAL_EINVAL
XLAL_FAILURE
LIGOTimeGPS * XLALGPSSetREAL8(LIGOTimeGPS *epoch, REAL8 t)
string approximant
COMPLEX16Sequence * data
COMPLEX16Sequence * data
COMPLEX16 * data
UINT4 length
INT2 * data
REAL8Sequence * data
LIGOTimeGPS epoch
REAL8 * data
COMPLEX16FrequencySeries * mode
The sequences of sampled data.
Structure to carry a collection of spherical harmonic modes in COMPLEX16 time series.
struct tagSphHarmTimeSeries * next
next pointer
COMPLEX16TimeSeries * mode
The sequences of sampled data.
INT4 m
Node submode m
UINT4 l
Node mode l
Definition: burst.c:245
double V
Definition: unicorn.c:25
double f_min
Definition: unicorn.c:22
double deltaT
Definition: unicorn.c:24
double f_max
Definition: unicorn.c:23