LALSimulation  5.4.0.1-fe68b98
LALSimIMRPhenomX_PNR_internals.h
Go to the documentation of this file.
1 #ifndef _LALSIM_IMR_PHENOMX_PNR_INTERNALS_H
2 #define _LALSIM_IMR_PHENOMX_PNR_INTERNALS_H
3 /*
4  * Copyright (C) 2022 Cardiff University
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with with program; see the file COPYING. If not, write to the
18  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19  * MA 02110-1301 USA
20  */
21 
22 /**
23  * \author Eleanor Hamilton, Sebastian Khan, Jonathan E. Thompson
24  *
25  */
26 
27 #ifdef __cplusplus
28 extern "C"
29 {
30 #endif
31 
32 #include "LALSimIMRPhenomX.h"
35 
36 #include "LALSimIMRPhenomXHM.h"
38 
42 
43 #include <lal/LALStdlib.h>
44 #include <lal/LALSimIMR.h>
45 #include <lal/LALConstants.h>
46 #include <lal/LALDatatypes.h>
47 #include <lal/Sequence.h>
48 #include <lal/LALDict.h>
49 #include <lal/XLALError.h>
50 
51 #include <lal/FrequencySeries.h>
52 #include <lal/LALSimInspiral.h>
53 
54 #include <math.h>
55 #include <gsl/gsl_spline.h>
56 #include <gsl/gsl_integration.h>
57 
58  typedef struct tagIMRPhenomX_PNR_angle_spline
59  {
60  gsl_spline *alpha_spline; /**< alpha cubic spline */
61  gsl_spline *beta_spline; /**< beta cubic spline */
62  gsl_spline *gamma_spline; /**< gamma cubic spline */
63  gsl_interp_accel *alpha_acc; /**< alpha cubic spline accelerator */
64  gsl_interp_accel *beta_acc; /**< beta cubic spline accelerator */
65  gsl_interp_accel *gamma_acc; /**< gamma cubic spline accelerator */
67 
71 
73  IMRPhenomXWaveformStruct **pWF_SingleSpin,
74  IMRPhenomXPrecessionStruct **pPrec_SingleSpin,
75  IMRPhenomX_PNR_alpha_parameters **alphaParams,
76  IMRPhenomX_PNR_beta_parameters **betaParams,
79  LALDict *lalParams);
80 
82  IMRPhenomXWaveformStruct **pWF_SingleSpin,
83  IMRPhenomXPrecessionStruct **pPrec_SingleSpin,
84  IMRPhenomX_PNR_alpha_parameters **alphaParams,
85  IMRPhenomX_PNR_beta_parameters **betaParams);
86 
89  const REAL8Sequence *freqs,
90  const REAL8Sequence *alpha,
91  const REAL8Sequence *beta);
92 
95  const REAL8Sequence *freqs,
96  IMRPhenomX_PNR_angle_spline *ab_splines);
97 
99 
100  REAL8 IMRPhenomX_PNR_LinearFrequencyMap(REAL8 Mf, REAL8 ell, REAL8 emm, REAL8 Mf_lower, REAL8 Mf_upper, REAL8 Mf_RD_22, REAL8 Mf_RD_lm, UINT4 INSPIRAL);
101  REAL8 IMRPhenomX_PNR_LinearFrequencySlope(REAL8 emm, REAL8 Mf_lower, REAL8 Mf_upper, REAL8 Mf_RD_22, REAL8 Mf_RD_lm);
104 
106 
107  REAL8 IMRPhenomX_PNR_AngleAtFRef(const REAL8Sequence *angle, const REAL8 f_ref, const REAL8Sequence *freqs, const REAL8 deltaF);
109 
111  REAL8 beta_ref,
114  LALDict *lalParams);
115 
118  UINT4 ell,
119  UINT4 emmprime,
120  LALDict *lalParams /**< LAL Dictionary struct */
121  );
122 
124  IMRPhenomX_PNR_alpha_parameters *alphaParams,
125  IMRPhenomX_PNR_beta_parameters *betaParams);
126 
127  /* Compute window function to ensure smooth transition from tuned to PN angles outside calibration region */
131  );
132 
133  /* Compute window function which controls use of PNR coprecessing deviations. */
136  );
137 
138  /* Compute XAS phase and phase derivative a reference frequency "f_inspiral_align" */
142  );
143 
144  /* Align the PNR CoPrec phase and phase derivative at
145  "f_inspiral_align" by changing the effective value of
146  phifRef and linb */
148  double* linb,
151  );
152 
153  /* Compute XHM phase and phase derivative a reference frequency "f_inspiral_align" */
155  INT4 ell,
156  INT4 emm,
159  LALDict *lalParams
160  );
161 
162  /* Align the PNR HM CoPrec phase and phase derivative at
163  "f_inspiral_align" by providing the needed phase and time shifts*/
165  double* lina,
166  double* linb,
167  INT4 ell,
168  INT4 emm,
170  LALDict *lalParams
171  );
172 
173  /* Function to get and or store coprec params
174  into pWF and pPrec */
178  LALDict *lalParams
179  );
180 
181 #ifdef __cplusplus
182 }
183 #endif
184 
185 #endif /*_LALSIM_IMR_PHENOMX_PNR_INTERNALS_H*/
REAL8 IMRPhenomX_PNR_AnglesWindow(IMRPhenomXWaveformStruct *pWF, IMRPhenomXPrecessionStruct *pPrec)
void IMRPhenomX_PNR_FreeStructs(IMRPhenomXWaveformStruct **pWF_SingleSpin, IMRPhenomXPrecessionStruct **pPrec_SingleSpin, IMRPhenomX_PNR_alpha_parameters **alphaParams, IMRPhenomX_PNR_beta_parameters **betaParams)
REAL8 IMRPhenomX_PNR_alphadot_cosbeta(REAL8 f, IMRPhenomX_PNR_angle_spline *params)
Wrapper function for computing the integrand in Eq.
void IMRPhenomX_PNR_AngleParameterDebugPrint(IMRPhenomX_PNR_alpha_parameters *alphaParams, IMRPhenomX_PNR_beta_parameters *betaParams)
Print various parameters in the angle structs.
INT4 IMRPhenomX_PNR_CheckTwoSpin(IMRPhenomXPrecessionStruct *pPrec)
This function quickly checks to see if we expect two-spin effects to be present in the inspiral prece...
REAL8 IMRPhenomX_PNR_GenerateEffectiveRingdownFreq(IMRPhenomXWaveformStruct *pWF, UINT4 ell, UINT4 emmprime, LALDict *lalParams)
This code recomputes the skymapped locations in the J-frame using the new value of beta computed from...
INT4 IMRPhenomX_PNR_PopulateStructs(IMRPhenomXWaveformStruct **pWF_SingleSpin, IMRPhenomXPrecessionStruct **pPrec_SingleSpin, IMRPhenomX_PNR_alpha_parameters **alphaParams, IMRPhenomX_PNR_beta_parameters **betaParams, IMRPhenomXWaveformStruct *pWF, IMRPhenomXPrecessionStruct *pPrec, LALDict *lalParams)
These two functions create and populate the required parameter structs for PNR.
INT4 IMRPhenomX_PNR_GetAndSetCoPrecParams(IMRPhenomXWaveformStruct *pWF, IMRPhenomXPrecessionStruct *pPrec, LALDict *lalParams)
REAL8 IMRPhenomX_PNR_HMInterpolationDeltaF(REAL8 f_min, IMRPhenomXWaveformStruct *pWF, IMRPhenomXPrecessionStruct *pPrec)
Here we compute an appropriate deltaF to be used when generating the (2,2) angle interpolants and map...
REAL8 IMRPhenomX_PNR_CoprecWindow(IMRPhenomXWaveformStruct *pWF)
INT4 IMRPhenomXHM_PNR_SetPhaseAlignmentParams(INT4 ell, INT4 emm, IMRPhenomXWaveformStruct *pWF, IMRPhenomXPrecessionStruct *pPrec, LALDict *lalParams)
void IMRPhenomX_PNR_EnforceXASPhaseAlignment(double *linb, IMRPhenomXWaveformStruct *pWF, IMRPhenomXPhaseCoefficients *pPhase)
REAL8 IMRPhenomX_PNR_LinearFrequencyMap(REAL8 Mf, REAL8 ell, REAL8 emm, REAL8 Mf_lower, REAL8 Mf_upper, REAL8 Mf_RD_22, REAL8 Mf_RD_lm, UINT4 INSPIRAL)
Computes a linear frequency map for the HM PNR angles based on the linear frequency mapping used orig...
INT4 IMRPhenomX_PNR_GeneratePNRGamma(REAL8Sequence *gamma, const REAL8Sequence *freqs, const REAL8Sequence *alpha, const REAL8Sequence *beta)
This function computes the frequency integral outlined in Eq.
INT4 IMRPhenomX_PNR_RemapThetaJSF(REAL8 beta_ref, IMRPhenomXWaveformStruct *pWF, IMRPhenomXPrecessionStruct *pPrec, LALDict *lalParams)
This code recomputes the skymapped locations in the J-frame using the new value of beta computed from...
INT4 IMRPhenomX_PNR_GetAndSetPNRVariables(IMRPhenomXWaveformStruct *pWF, IMRPhenomXPrecessionStruct *pPrec)
This function computes the required single-spin quantities used to parameterize the MR tuned function...
INT4 IMRPhenomX_PNR_SetPhaseAlignmentParams(IMRPhenomXWaveformStruct *pWF, IMRPhenomXPrecessionStruct *pPrec)
void IMRPhenomXHM_PNR_EnforceXHMPhaseAlignment(double *lina, double *linb, INT4 ell, INT4 emm, IMRPhenomXWaveformStruct *pWF, LALDict *lalParams)
REAL8 IMRPhenomX_PNR_LinearFrequencySlope(REAL8 emm, REAL8 Mf_lower, REAL8 Mf_upper, REAL8 Mf_RD_22, REAL8 Mf_RD_lm)
Computes the slope of the linear frequency interpolation mapping used for the HM PNR angles.
REAL8 IMRPhenomX_PNR_LinearInterpolate(REAL8 a0, REAL8 a1, REAL8 f0, REAL8 f1, REAL8 feval)
Evaluates a function at two points and interpolates between them.
INT4 IMRPhenomX_PNR_LinearFrequencyMapTransitionFrequencies(REAL8 *Mf_low, REAL8 *Mf_high, REAL8 emmprime, REAL8 Mf_RD_22, REAL8 Mf_RD_lm, IMRPhenomXPrecessionStruct *pPrec)
Compute the transition frequencies for the HM PNR angle mapping.
REAL8 IMRPhenomX_PNR_AngleAtFRef(const REAL8Sequence *angle, const REAL8 f_ref, const REAL8Sequence *freqs, const REAL8 deltaF)
Evaluates a function at two points and interpolates between them.
INT4 IMRPhenomX_PNR_GeneratePNRGamma_FromInterpolants(REAL8Sequence *gamma, const REAL8Sequence *freqs, IMRPhenomX_PNR_angle_spline *ab_splines)
This function computes the frequency integral outlined in Eq.
static double beta(const double a, const double b, const sysq *system)
Internal function that computes the spin-orbit couplings.
@ INSPIRAL
double REAL8
uint32_t UINT4
int32_t INT4
double alpha
Definition: sgwb.c:106
gsl_spline * beta_spline
beta cubic spline
gsl_interp_accel * beta_acc
beta cubic spline accelerator
gsl_interp_accel * alpha_acc
alpha cubic spline accelerator
gsl_interp_accel * gamma_acc
gamma cubic spline accelerator
gsl_spline * gamma_spline
gamma cubic spline
gsl_spline * alpha_spline
alpha cubic spline
Definition: burst.c:245
double f_min
Definition: unicorn.c:22