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>
39 #include <lal/LALSimIMR.h>
40 #include <lal/LALSimInspiral.h>
114 LALDict *lalParams_aux;
116 if (lalParams == NULL)
141 status =
LALSimIMRPhenomTHM_Modes(&hlms, m1_SI, m2_SI, chi1L, chi2L, distance,
deltaT, fmin, fRef, phiRef, lalParams_aux, only22);
161 hlms_temp = hlms_temp->
next;
247 status =
LALSimIMRPhenomTHM_Modes(&hlms, m1_SI, m2_SI, chi1L, chi2L, distance,
deltaT, fmin, fRef, phiRef, lalParams, only22);
267 hlms_temp = hlms_temp->
next;
305 status =
LALSimIMRPhenomTHM_Modes(&hlms, m1_SI, m2_SI, chi1L, chi2L, distance,
deltaT, fmin, fRef, phiRef, lalParams, only22);
339 if(fRef < 0.0) {
XLAL_ERROR(
XLAL_EDOM,
"fRef_In must be positive or set to 0 to ignore.\n"); }
344 if(distance <= 0.0) {
XLAL_ERROR(
XLAL_EDOM,
"Distance must be positive and greater than 0.\n"); }
369 mass_ratio = m1_SI / m2_SI;
373 mass_ratio = m2_SI / m1_SI;
375 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."); }
376 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."); }
377 if(mass_ratio > 200. && fabs(mass_ratio - 200) > 1
e-12) {
XLAL_ERROR(
XLAL_EDOM,
"ERROR: Model not valid at mass ratios beyond 200."); }
378 if(fabs(chi1L) > 0.99 || fabs(chi2L) > 0.99) {
XLAL_PRINT_INFO(
"Warning: Extrapolating to extremal spins, model is not trusted."); }
383 LALDict *lalParams_aux;
385 if (lalParams == NULL)
399 status =
IMRPhenomTSetWaveformVariables(pWF, m1_SI, m2_SI, chi1L, chi2L, distance,
deltaT, fmin, fRef, phiRef, lalParams_aux);
412 size_t length_insp = length_insp_early + length_insp_late;
416 REAL8 factheta = pow(5.0,1./8);
430 for(
UINT4 jdx = 0; jdx < length_insp_early; jdx++)
432 t = pPhase->
tmin + jdx*pWF->
dtM;
434 thetabar = pow(pWF->
eta*(pPhase->
tt0-t),-1./8);
436 theta = factheta*thetabar;
439 xorb->
data[jdx] = pow(0.5*w22,2./3);
443 phi22->
data[jdx] = ph22;
446 for(
UINT4 jdx = length_insp_early; jdx < length_insp; jdx++)
448 t = pPhase->
tmin + jdx*pWF->
dtM;
450 thetabar = pow(-pWF->
eta*t,-1./8);
452 theta = factheta*thetabar;
455 xorb->
data[jdx] = pow(0.5*w22,2./3);
459 phi22->
data[jdx] = ph22;
465 for(
UINT4 jdx = 0; jdx < length_insp; jdx++)
467 t = pPhase->
tmin + jdx*pWF->
dtM;
469 thetabar = pow(-pWF->
eta*t,-1./8);
471 theta = factheta*thetabar;
474 xorb->
data[jdx] = pow(0.5*w22,2./3);
478 phi22->
data[jdx] = ph22;
485 for(
UINT4 jdx = length_insp; jdx < length; jdx++)
487 t = pPhase->
tmin + jdx*pWF->
dtM;
490 xorb->
data[jdx] = pow(0.5*w22,2./3);
494 phi22->
data[jdx] = ph22;
499 INT4 posMode, negMode;
501 for (
UINT4 ell = 2; ell <= 5; ell++)
503 for (
UINT4 emm = 1; emm <= ell; emm++)
508 if ( posMode != 1 && negMode != 1)
524 for(
UINT4 jdx = 0; jdx < length; jdx++)
526 ((*tmp_mode).data)->
data[jdx] = pow(-1,ell)*conj(((*tmp_mode).data)->data[jdx]);
584 UNUSED
REAL8 phi22 = 0.0;
602 for(
UINT4 jdx = 0; jdx < length; jdx++)
604 t = pPhase->
tmin + jdx*pWF->
dtM;
605 x = (xorb)->
data[jdx];
608 phi22 = (phase22)->
data[jdx] - phiref0;
609 wf = amplm*cexp(-I*phi22);
611 ((*hlm)->data->data)[jdx] = wf;
615 else if(emm%2 != 0 && pWF->
delta<1E-10 && fabs(pWF->
chi1L-pWF->
chi2L)<1E-10)
618 memset( (*hlm)->data->data, 0.0, (*hlm)->data->length *
sizeof(
COMPLEX16) );
638 else if(ell==3 && emm==3)
642 else if(ell==5 && emm==5)
646 else if(ell==4 && emm==4)
652 for(
UINT4 jdx = 0; jdx < length; jdx++)
655 t = pPhase->
tmin + jdx*pWF->
dtM;
656 x = (xorb)->
data[jdx];
659 phi22 = (phase22)->
data[jdx];
661 philm =
IMRPhenomTHMPhase(t, phi22, pPhaselm,pAmplm) - (emm/2.0)*phiref0 - phoff;
662 wf = amplm*cexp(-I*philm);
664 ((*hlm)->data->data)[jdx] = wf;
683 if (ModeArray == NULL)
721 INT4 larray[5] = {2, 2, 3, 4, 5};
722 INT4 marray[5] = {2, 1, 3, 4, 5};
726 for(
INT4 emm=0; emm<=ell; emm++)
730 for(
UINT4 idx=0; idx<5; idx++)
732 if(ell==larray[idx] && abs(emm)==marray[idx])
739 XLALPrintError (
"Mode (%d,%d) is not available by the model.\n", ell, emm);
767 for(
INT4 emm=0; emm<=ell; emm++)
772 if(ell==2 && abs(emm)==2)
779 XLALPrintError (
"Mode (%d,%d) is not available by the model.\n", ell, emm);
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)
int LALSimIMRPhenomTHM_Modes(SphHarmTimeSeries **hlms, REAL8 m1_SI, REAL8 m2_SI, REAL8 chi1L, REAL8 chi2L, REAL8 distance, REAL8 deltaT, REAL8 fmin, REAL8 fRef, REAL8 phiRef, LALDict *lalParams, UINT4 only22)
LALDict * IMRPhenomTHM_setup_mode_array(LALDict *lalParams)
double IMRPhenomTomega22(REAL8 t, REAL8 theta, IMRPhenomTWaveformStruct *pWF, IMRPhenomTPhase22Struct *pPhase)
int IMRPhenomTSetHMAmplitudeCoefficients(int l, int m, IMRPhenomTHMAmpStruct *pAmp, IMRPhenomTPhase22Struct *pPhase, IMRPhenomTWaveformStruct *wf)
COMPLEX16 IMRPhenomTHMAmp(REAL8 t, UNUSED REAL8 x, IMRPhenomTHMAmpStruct *pAmp)
int IMRPhenomTSetPhase22Coefficients(IMRPhenomTPhase22Struct *pPhase, IMRPhenomTWaveformStruct *wf)
double IMRPhenomTHMPhase(REAL8 t, REAL8 phiInsp, IMRPhenomTHMPhaseStruct *pPhaseHM, UNUSED IMRPhenomTHMAmpStruct *pAmpHM)
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)
int IMRPhenomTSetHMPhaseCoefficients(int l, int m, IMRPhenomTHMPhaseStruct *pPhaseHM, IMRPhenomTPhase22Struct *pPhase, IMRPhenomTHMAmpStruct *pAmplm, IMRPhenomTWaveformStruct *wf)
double IMRPhenomTPhase22(REAL8 t, REAL8 thetabar, IMRPhenomTWaveformStruct *pWF, IMRPhenomTPhase22Struct *pPhase)
void XLALDestroyValue(LALValue *value)
void * XLALMalloc(size_t n)
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.
#define LAL_SIM_L_MAX_MODE_ARRAY
Maximum L spherical harmonic mode that is supported in Mode Array.
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)
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,...)
int XLALPrintError(const char *fmt,...) _LAL_GCC_PRINTF_FORMAT_(1
#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.