21 #include <lal/Sequence.h>
23 #include <lal/Units.h>
24 #include <lal/XLALError.h>
27 #include <lal/LALDatatypes.h>
28 #include <lal/LALStdlib.h>
29 #include <lal/LALConstants.h>
32 #include <lal/TimeSeries.h>
33 #include <lal/TimeFreqFFT.h>
34 #include <lal/SphericalHarmonics.h>
35 #include <lal/LALSimSphHarmMode.h>
36 #include <lal/FrequencySeries.h>
40 #include <lal/LALSimIMR.h>
41 #include <lal/LALSimInspiral.h>
55 #define MAX(a,b) (((a)>(b))?(a):(b))
145 REAL8 chi_in_plane = sqrt(pow(chi1x + chi2x,2) + pow(chi1y + chi2y,2));
148 status =
XLALSimIMRPhenomT(hp, hc, m1_SI, m2_SI, chi1z, chi2z, distance, inclination,
deltaT, fmin, fRef, phiRef, lalParams);
157 status =
XLALSimIMRPhenomTPHM_L0Modes(&hlm, m1_SI, m2_SI, chi1x,chi1y,chi1z,chi2x,chi2y,chi2z,distance,inclination,
deltaT,fmin,fRef,phiRef,lalParams, 1);
161 size_t length = (hlm)->mode->data->length;
178 hlms_temp = hlms_temp->
next;
237 REAL8 chi_in_plane = sqrt(pow(chi1x + chi2x,2) + pow(chi1y + chi2y,2));
240 status =
XLALSimIMRPhenomTHM(hp, hc, m1_SI, m2_SI, chi1z, chi2z, distance, inclination,
deltaT, fmin, fRef, phiRef, lalParams);
248 status =
XLALSimIMRPhenomTPHM_L0Modes(&hlm, m1_SI, m2_SI, chi1x,chi1y,chi1z,chi2x,chi2y,chi2z,distance,inclination,
deltaT,fmin,fRef,phiRef,lalParams,0);
252 size_t length = (hlm)->mode->data->length;
269 hlms_temp = hlms_temp->
next;
311 REAL8 inclination = 0.0;
316 status =
XLALSimIMRPhenomTPHM_L0Modes(&hlms, m1_SI, m2_SI, chi1x,chi1y,chi1z,chi2x,chi2y,chi2z,distance,inclination,
deltaT,fmin,fRef,phiRef,lalParams,0);
359 status =
XLALSimIMRPhenomTPHM_JModes(hlmI, &alphaTS, &cosbetaTS, &gammaTS, &af, m1_SI, m2_SI, chi1x,chi1y,chi1z,chi2x,chi2y,chi2z,distance,inclination,
deltaT,fmin,fRef,phiRef,lalParams,only22);
365 status =
IMRPhenomTSetWaveformVariables(pWF, m1_SI, m2_SI, chi1z, chi2z, distance,
deltaT, fmin, fRef, phiRef, lalParams);
375 if(pPhase->
tmin<0.0 && pPhase->
tRef>=0.0)
383 size_t length1 = floor(fabs(tint1)/pWF->
dtM);
386 REAL8 alphaJtoI, cosbetaJtoI, gammaJtoI;
387 alphaJtoI = (alphaTS)->
data->data[length1];
388 cosbetaJtoI = (cosbetaTS)->data->data[length1];
389 gammaJtoI = (gammaTS)->
data->data[length1];
396 size_t length = (*hlmI)->mode->data->length;
448 status =
XLALSimIMRPhenomTPHM_CoprecModes(hlmJ, alphaTS, cosbetaTS, gammaTS, af, m1_SI, m2_SI, chi1x,chi1y,chi1z,chi2x,chi2y,chi2z,distance,inclination,
deltaT,fmin,fRef,phiRef,lalParams,only22);
495 if(fRef < 0.0) {
XLAL_ERROR(
XLAL_EDOM,
"fRef_In must be positive or set to 0 to ignore.\n"); }
500 if(distance <= 0.0) {
XLAL_ERROR(
XLAL_EDOM,
"Distance must be positive and greater than 0.\n"); }
501 if(fRef > 0.0 && fRef < fmin){
XLAL_ERROR(
XLAL_EDOM,
"fRef must be >= f_min or =0 to use f_min.\n"); }
525 REAL8 mass_ratio = m1_SI / m2_SI;
537 if(mass_ratio > 20.0 && chi1L < 0.9 && m2_SI/LAL_MSUN_SI >= 0.5 ) {
XLAL_PRINT_INFO(
"Warning: Extrapolating outside of Numerical Relativity calibration domain."); }
538 if(mass_ratio > 20.0 && (chi1L >= 0.9 || m2_SI/
LAL_MSUN_SI < 0.5) ) {
XLAL_PRINT_INFO(
"Warning: Model can be pathological at these parameters"); }
539 if(mass_ratio > 200. && fabs(mass_ratio - 200) > 1
e-12) {
XLAL_ERROR(
XLAL_EDOM,
"ERROR: Model not valid at mass ratios beyond 200."); }
540 if(fabs(chi1L) > 0.99 || fabs(chi2L) > 0.99) {
XLAL_PRINT_INFO(
"Warning: Extrapolating to extremal spins, model is not trusted."); }
543 UNUSED
INT4 precVer, precVerX, EulerRDVersion, EulerGammaVersion, EulerInspVersion, FSVer;
544 UNUSED
INT4 evolvedFS = 0;
549 INT4 lendigits = snprintf(digits, 6,
"%d", precVer);
553 sprintf(digits,
"%d", precVer);
554 sscanf(digits,
"%3d%1d%1d", &precVerX, &EulerRDVersion, &EulerGammaVersion);
555 EulerInspVersion = 0;
556 if(EulerRDVersion>2 || EulerRDVersion<0){
XLAL_ERROR(
XLAL_EDOM,
"Invalid EulerRDVersion. Choose between 0, 1, and 2.\n");}
557 if(EulerGammaVersion>1 || EulerGammaVersion<0){
XLAL_ERROR(
XLAL_EDOM,
"Invalid EulerGammaVersion. Choose between 0, 1.\n");}
560 else if(lendigits==3 && precVer==300)
562 EulerInspVersion = 1;
570 else if(lendigits==3 && precVer!=300)
572 EulerInspVersion = 0;
575 EulerGammaVersion = 0;
586 LALDict *lalParams_aux;
587 if (lalParams == NULL)
596 LALValue *ModeArray = NULL;
644 status =
IMRPhenomTSetWaveformVariables(pWF, m1_SI, m2_SI, chi1L, chi2L, distance,
deltaT, fmin, fRef, phiRef, lalParams_aux);
650 status =
IMRPhenomXSetWaveformVariables(pWFX, m1_SI, m2_SI, chi1L, chi2L, 0.1, fRef, phiRef, fmin, 1./
deltaT, distance, inclination, lalParams_aux, 0);
656 status =
IMRPhenomXGetAndSetPrecessionVariables(pWFX, pPrec, m1_SI, m2_SI, chi1x, chi1y, chi1z, chi2x, chi2y, chi2z, lalParams_aux, 0);
674 size_t length_insp = length_insp_early + length_insp_late;
678 REAL8 factheta = pow(5.0,1./8);
697 for(
UINT4 jdx = 0; jdx < length_insp_early; jdx++)
699 t = pPhase->
tmin + jdx*pWF->
dtM;
700 thetabar = pow(pWF->
eta*(pPhase->
tt0-t),-1./8);
701 theta = factheta*thetabar;
703 xorb->
data[jdx] = pow(0.5*w22,2./3);
705 phi22->data[jdx] = ph22;
708 for(
UINT4 jdx = length_insp_early; jdx < length_insp; jdx++)
710 t = pPhase->
tmin + jdx*pWF->
dtM;
711 thetabar = pow(-pWF->
eta*t,-1./8);
712 theta = factheta*thetabar;
714 xorb->
data[jdx] = pow(0.5*w22,2./3);
716 phi22->data[jdx] = ph22;
722 for(
UINT4 jdx = 0; jdx < length_insp; jdx++)
724 t = pPhase->
tmin + jdx*pWF->
dtM;
725 thetabar = pow(-pWF->
eta*t,-1./8);
726 theta = factheta*thetabar;
728 xorb->
data[jdx] = pow(0.5*w22,2./3);
730 phi22->data[jdx] = ph22;
737 for(
UINT4 jdx = length_insp; jdx < length; jdx++)
739 t = pPhase->
tmin + jdx*pWF->
dtM;
741 xorb->
data[jdx] = pow(0.5*w22,2./3);
743 phi22->data[jdx] = ph22;
757 EulerInspVersion = 0;
759 EulerGammaVersion = 0;
761 XLAL_PRINT_WARNING(
"Waveform only contains ringdown, version 300 not meaningful. Defaulting to analytical ringdown angles (EulerInspVersion=0, EulerRDVersion=1.)\n");
763 else if(pPhase->
tRef>=-8*pWF->
dtM)
766 XLAL_PRINT_WARNING(
"Waveform contains pre-peak cycles but reference frequency is specified post-peak, which may be not meaningful. Reference frequency will be set close before the peak. \n");
769 if(EulerInspVersion==1)
772 status =
IMRPhenomTPHM_NumericalEulerAngles(alphaTS,cosbetaTS,gammaTS, &af_evolved, xorb, pPhase->
dtM,m1_SI, m2_SI, chi1x,chi1y,chi1z,chi2x,chi2y,chi2z,pPhase->
tmin, pWF, pPhase, pPrec);
778 if(!(reconsMerger==1))
788 for(
UINT4 jdx = length_insp; jdx < length; jdx++)
790 t = pPhase->
tmin + jdx*pWF->
dtM;
793 xorb->
data[jdx] = pow(0.5*w22,2./3);
796 phi22->data[jdx] = ph22;
814 INT4 posMode, negMode;
816 for (
UINT4 ell = 2; ell <= LMAX; ell++)
818 for (
UINT4 emm = 0; emm <= ell; emm++)
823 if ( posMode != 1 && negMode != 1)
844 for(
UINT4 jdx = 0; jdx < length; jdx++)
846 ((*tmp_mode).data)->
data[jdx] = pow(-1,ell)*conj(((*tmp_mode).data)->data[jdx]);
void XLALDestroyDict(LALDict *dict)
LALDict * XLALDictDuplicate(LALDict *old)
LALDict * XLALCreateDict(void)
INT4 check_input_mode_array_THM(LALDict *lalParams)
int LALSimIMRPhenomTHM_OneMode(COMPLEX16TimeSeries **hlm, IMRPhenomTWaveformStruct *pWF, IMRPhenomTPhase22Struct *pPhase, REAL8Sequence *phase22, REAL8Sequence *xorb, UINT4 ell, UINT4 emm)
INT4 check_input_mode_array_22_THM(LALDict *lalParams)
LALDict * IMRPhenomTHM_setup_mode_array(LALDict *lalParams)
double IMRPhenomTomega22(REAL8 t, REAL8 theta, IMRPhenomTWaveformStruct *pWF, IMRPhenomTPhase22Struct *pPhase)
int IMRPhenomTSetPhase22Coefficients(IMRPhenomTPhase22Struct *pPhase, IMRPhenomTWaveformStruct *wf)
int IMRPhenomTSetWaveformVariables(IMRPhenomTWaveformStruct *wf, const REAL8 m1_SI, const REAL8 m2_SI, const REAL8 chi1L_In, const REAL8 chi2L_In, const REAL8 distance, const REAL8 deltaT, const REAL8 fmin, const REAL8 fRef, const REAL8 phiRef, LALDict *lalParams)
double IMRPhenomTPhase22(REAL8 t, REAL8 thetabar, IMRPhenomTWaveformStruct *pWF, IMRPhenomTPhase22Struct *pPhase)
int PNAnalyticalInspiralEulerAngles(REAL8TimeSeries **alphaTS, REAL8TimeSeries **cosbetaTS, REAL8TimeSeries **gammaTS, REAL8Sequence *xorb, IMRPhenomTWaveformStruct *pWF, IMRPhenomTPhase22Struct *pPhase, IMRPhenomXWaveformStruct *pWFX, IMRPhenomXPrecessionStruct *pPrec, INT4 EulerRDVersion, INT4 GammaVersion)
This function provides a wrapper to the analytical PN angle descriptions computed by the IMRPhenomXP(...
int IMRPhenomTPHM_NumericalEulerAngles(REAL8TimeSeries **alphaInt, REAL8TimeSeries **cosbetaInt, REAL8TimeSeries **gammaInt, REAL8 *af_evolved, REAL8Sequence *xorb, REAL8 deltaT, REAL8 m1_SI, REAL8 m2_SI, REAL8 s1x, REAL8 s1y, REAL8 s1z, REAL8 s2x, REAL8 s2y, REAL8 s2z, REAL8 epochT, IMRPhenomTWaveformStruct *pWF, IMRPhenomTPhase22Struct *pPhase, UNUSED IMRPhenomXPrecessionStruct *pPrec)
int PhenomTPHM_RotateModes_Global(SphHarmTimeSeries *h_lm, REAL8 alpha, REAL8 cosbeta, REAL8 gam, size_t length, PhenomT_precomputed_sqrt *SQRT)
void IMRPhenomTPHM_SetPrecomputedSqrt(PhenomT_precomputed_sqrt *SQRT)
int PhenomTPHM_RotateModes(SphHarmTimeSeries *h_lm, REAL8TimeSeries *alpha, REAL8TimeSeries *cosbeta, REAL8TimeSeries *gam, PhenomT_precomputed_sqrt *SQRT)
int IMRPhenomXSetWaveformVariables(IMRPhenomXWaveformStruct *wf, const REAL8 m1_SI, const REAL8 m2_SI, const REAL8 chi1L_In, const REAL8 chi2L_In, const REAL8 deltaF, const REAL8 fRef, const REAL8 phi0, const REAL8 f_min, const REAL8 f_max, const REAL8 distance, const REAL8 inclination, LALDict *LALParams, UNUSED const UINT4 debug)
int IMRPhenomXGetAndSetPrecessionVariables(IMRPhenomXWaveformStruct *pWF, IMRPhenomXPrecessionStruct *pPrec, REAL8 m1_SI, REAL8 m2_SI, REAL8 chi1x, REAL8 chi1y, REAL8 chi1z, REAL8 chi2x, REAL8 chi2y, REAL8 chi2z, LALDict *lalParams, INT4 debug_flag)
Function to populate the IMRPhenomXPrecessionStruct:
void XLALDestroyValue(LALValue *value)
void * XLALMalloc(size_t n)
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.
int XLALSimIMRPhenomTPHM_JModes(SphHarmTimeSeries **hlmJ, REAL8TimeSeries **alphaTS, REAL8TimeSeries **cosbetaTS, REAL8TimeSeries **gammaTS, REAL8 *af, 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, UINT4 only22)
Routine to compute a list of the time-domain modes of the IMRPhenomTPHM model in the inertial J-frame...
int XLALSimIMRPhenomTPHM_CoprecModes(SphHarmTimeSeries **hlmJ, REAL8TimeSeries **alphaTS, REAL8TimeSeries **cosbetaTS, REAL8TimeSeries **gammaTS, REAL8 *af, 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, UINT4 only22)
Routine to compute a list of the time-domain modes of the IMRPhenomTPHM model in the co-precessing fr...
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 XLALSimIMRPhenomTPHM_L0Modes(SphHarmTimeSeries **hlmI, 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, UINT4 only22)
Routine to compute a list of the time-domain modes of the IMRPhenomTPHM model in the inertial L0-fram...
int XLALSimAddMode(REAL8TimeSeries *hplus, REAL8TimeSeries *hcross, COMPLEX16TimeSeries *hmode, REAL8 theta, REAL8 phi, int l, int m, int sym)
Multiplies a mode h(l,m) by a spin-2 weighted spherical harmonic to obtain hplus - i hcross,...
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.
void XLALDestroySphHarmTimeSeries(SphHarmTimeSeries *ts)
Delete list from current pointer to the end of the list.
void XLALDestroyREAL8Sequence(REAL8Sequence *sequence)
REAL8Sequence * XLALCreateREAL8Sequence(size_t length)
REAL8TimeSeries * XLALCreateREAL8TimeSeries(const CHAR *name, const LIGOTimeGPS *epoch, REAL8 f0, REAL8 deltaT, const LALUnit *sampleUnits, size_t length)
void XLALDestroyCOMPLEX16TimeSeries(COMPLEX16TimeSeries *series)
void XLALDestroyREAL8TimeSeries(REAL8TimeSeries *series)
COMPLEX16TimeSeries * XLALCreateCOMPLEX16TimeSeries(const CHAR *name, const LIGOTimeGPS *epoch, REAL8 f0, REAL8 deltaT, const LALUnit *sampleUnits, size_t length)
const LALUnit lalStrainUnit
#define XLAL_PRINT_INFO(...)
#define XLAL_CHECK(assertion,...)
#define XLAL_PRINT_WARNING(...)
#define XLAL_CHECK_NULL(assertion,...)
LIGOTimeGPS * XLALGPSAdd(LIGOTimeGPS *epoch, REAL8 dt)
size_t wflength_insp_early
size_t wflength_insp_late
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.