LALSimulation  5.4.0.1-fe68b98
LALSimIMRPhenomXUtilities.h
Go to the documentation of this file.
1 #ifndef _LALSIM_IMR_PHENOMX_UTILITIES_H
2 #define _LALSIM_IMR_PHENOMX_UTILITIES_H
3 
4 /*
5  * Copyright (C) 2018 Geraint Pratten
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with with program; see the file COPYING. If not, write to the
19  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20  * MA 02110-1301 USA
21  */
22 
23 
24 /*
25  * \author Geraint Pratten
26  *
27  */
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 #ifdef __GNUC__
34 #define UNUSED __attribute__ ((unused))
35 #else
36 #define UNUSED
37 #endif
38 
39 #include <lal/LALDatatypes.h>
40 #include <lal/LALConstants.h>
41 #include <lal/LALStdlib.h>
42 #include <lal/FrequencySeries.h>
43 #include <lal/Units.h>
44 #include <lal/Date.h>
45 #include <lal/LALSimInspiral.h>
46 
47 #include <stdlib.h>
48 #include <stdio.h>
49 #include <math.h>
50  //#include <complex.h>
51 
52 /* ********************** NUMERICAL UTILITY FUNCTIONS ********************* */
53 size_t NextPow2(const size_t n);
54 bool IMRPhenomX_StepFuncBool(const double t, const double t1);
55 void IMRPhenomX_InternalNudge(REAL8 x, REAL8 X, REAL8 epsilon);
56 bool IMRPhenomX_ApproxEqual(REAL8 x, REAL8 y, REAL8 epsilon);
57 
58 double pow_2_of(double number);
59 double pow_3_of(double number);
60 double pow_4_of(double number);
61 double pow_5_of(double number);
62 double pow_6_of(double number);
63 double pow_7_of(double number);
64 double pow_8_of(double number);
65 double pow_9_of(double number);
66 
68 
70 
71 
72 /* We want to expose the functions below - they are useful */
73 /* ********************** FREQUENCY CONVERSIONS ********************* */
76 
79 REAL8 XLALSimIMRPhenomXPsi4ToStrain(double eta, double S, double dchi);
80 
81 /* ********************** MECO, ISCO, ETC ********************* */
82 REAL8 XLALSimIMRPhenomXfMECO(REAL8 eta, REAL8 chi1L, REAL8 chi2L);
84 
85 /* ********************** SPIN PARAMETERISATIONS ********************* */
86 REAL8 XLALSimIMRPhenomXchiPN(REAL8 eta, REAL8 chi1l, REAL8 chi2l);
88 REAL8 XLALSimIMRPhenomXchiEff(REAL8 eta, REAL8 chi1l, REAL8 chi2l);
90 REAL8 XLALSimIMRPhenomXSTotR(REAL8 eta, REAL8 chi1l, REAL8 chi2l);
91 
92 /* ********************** MASS PARAMETERISATIONS ********************* */
93 
94 /* ********************** FINAL STATE ********************* */
99 
100 /* Check masses and spins */
101 INT4 XLALIMRPhenomXPCheckMassesAndSpins(REAL8 *m1, REAL8 *m2, REAL8 *chi1x, REAL8 *chi1y, REAL8 *chi1z, REAL8 *chi2x, REAL8 *chi2y, REAL8 *chi2z);
102 
103 /* ********************** ANALYTICAL MODEL WRAPPERS ********************* */
109 
111 
112 
113 
114 
115 /*
116  The functions below are XLAL exposed of the QNM ringdown and damping frequency used for the
117  IMRPhenomX model: https://arxiv.org/abs/2001.11412.
118 
119  See:
120  https://arxiv.org/src/2001.10914v1/anc/QNMs/CoefficientStatsfring22.m
121  https://arxiv.org/src/2001.10914v1/anc/QNMs/CoefficientStatsfdamp22.m
122 */
125 
126 // unwrapping utility
127 void XLALSimIMRPhenomXUnwrapArray(double *in, double *out, int len);
128 
129 
130 
131 
132 #ifdef __cplusplus
133 }
134 #endif
135 
136 #endif /* _LALSIM_IMR_PHENOMX_UTILITIES_H */
static double double delta
REAL8 XLALSimIMRPhenomXfMECO(REAL8 eta, REAL8 chi1L, REAL8 chi2L)
Phenomenological fit to hybrid minimum energy circular orbit (MECO) function.
REAL8 XLALSimIMRPhenomXSTotR(REAL8 eta, REAL8 chi1l, REAL8 chi2l)
Total spin normalised to [-1,1].
void IMRPhenomX_InternalNudge(REAL8 x, REAL8 X, REAL8 epsilon)
If x and X are approximately equal to relative accuracy epsilon then set x = X.
REAL8 XLALSimIMRPhenomXFinalMass2017(REAL8 eta, REAL8 chi1L, REAL8 chi2L)
Final Mass = 1 - Energy Radiated, X Jimenez-Forteza et al, PRD, 95, 064024, (2017),...
bool IMRPhenomX_ApproxEqual(REAL8 x, REAL8 y, REAL8 epsilon)
This function determines whether x and y are approximately equal to a relative accuracy epsilon.
REAL8 XLALSimIMRPhenomXErad2017(REAL8 eta, REAL8 chi1L, REAL8 chi2L)
Energy Radiated: X Jimenez-Forteza et al, PRD, 95, 064024, (2017), arXiv:1611.00332.
REAL8 XLALSimIMRPhenomXfring22(const REAL8 af)
Ringdown frequency for 22 mode, given final dimensionless spin.
void XLALSimIMRPhenomXUnwrapArray(double *in, double *out, int len)
Function to unwrap a time series that contains an angle, to obtain a continuous time series.
REAL8 XLALSimIMRPhenomXRingdownPhaseDeriv22AnsatzAnalytical(REAL8 ff, REAL8 fRD, REAL8 fDA, REAL8 a0, REAL8 a1, REAL8 a2, REAL8 a4, REAL8 aL)
"Analytical" phenomenological ringdown ansatz for phase derivative.
INT4 XLALIMRPhenomXPCheckMassesAndSpins(REAL8 *m1, REAL8 *m2, REAL8 *chi1x, REAL8 *chi1y, REAL8 *chi1z, REAL8 *chi2x, REAL8 *chi2y, REAL8 *chi2z)
Check if m1 > m2.
REAL8 XLALSimIMRPhenomXRingdownPhase22AnsatzAnalytical(REAL8 ff, REAL8 fRD, REAL8 fDA, REAL8 a0, REAL8 a1, REAL8 a2, REAL8 a4, REAL8 aL)
"Analytical" phenomenological ringdown ansatz for phase.
double pow_9_of(double number)
calc ninth power of number without floating point 'pow'
REAL8 XLALSimIMRPhenomXfISCO(REAL8 chif)
Fitting function for hybrid minimum energy circular orbit (MECO) function.
REAL8 XLALSimIMRPhenomXchiPN(REAL8 eta, REAL8 chi1l, REAL8 chi2l)
PN reduced spin parameter.
REAL8 XLALSimIMRPhenomXFinalSpin2017(REAL8 eta, REAL8 chi1L, REAL8 chi2L)
Final Dimensionless Spin, X Jimenez-Forteza et al, PRD, 95, 064024, (2017), arXiv:1611....
REAL8 XLALSimIMRPhenomXchiPNHat(REAL8 eta, REAL8 chi1l, REAL8 chi2l)
Normalised PN reduced spin parameter.
bool IMRPhenomX_StepFuncBool(const double t, const double t1)
REAL8 XLALSimIMRPhenomXIntermediateAmplitude22AnsatzAnalytical(REAL8 ff, REAL8 ff7o6, REAL8 a0, REAL8 a1, REAL8 a2, REAL8 a3, REAL8 a4, REAL8 a5)
double pow_4_of(double number)
calc fourth power of number without floating point 'pow'
REAL8 XLALSimIMRPhenomXatan2tol(REAL8 a, REAL8 b, REAL8 tol)
REAL8 XLALSimIMRPhenomXRingdownAmplitude22AnsatzAnalytical(REAL8 ff, REAL8 fRD, REAL8 fDA, REAL8 gamma1, REAL8 gamma2, REAL8 gamma3)
"Analytical" phenomenological ringdown ansatz for amplitude.
REAL8 XLALSimIMRPhenomXPrecessingFinalSpin2017(REAL8 eta, REAL8 chi1L, REAL8 chi2L, REAL8 chi_inplane)
Wrapper for the final spin in generically precessing binary black holes.
REAL8 XLALSimIMRPhenomXUtilsHztoMf(REAL8 fHz, REAL8 Mtot_Msun)
Convert from frequency in Hz to geometric frequency.
REAL8 XLALSimIMRPhenomXdchi(REAL8 chi1l, REAL8 chi2l)
Spin difference.
double pow_3_of(double number)
calc cube of number without floating point 'pow'
double pow_8_of(double number)
calc eigth power of number without floating point 'pow'
REAL8 XLALSimIMRPhenomXsign(REAL8 x)
REAL8 XLALSimIMRPhenomXUtilsMftoHz(REAL8 Mf, REAL8 Mtot_Msun)
Convert from geometric frequency to Hz.
double pow_7_of(double number)
calc seventh power of number without floating point 'pow'
double pow_5_of(double number)
calc fifth power of number without floating point 'pow'
REAL8 XLALSimIMRPhenomXLina(REAL8 eta, REAL8 S, REAL8 dchi, REAL8 delta)
We apply a linear time and phase shift to ~ align peak LinShift = (PNLina[ ] + + f PNLinb[ ]); Linea...
REAL8 XLALSimIMRPhenomXIntermediatePhase22AnsatzAnalytical(REAL8 ff, REAL8 fRD, REAL8 fDA, REAL8 a0, REAL8 a1, REAL8 a2, REAL8 a3, REAL8 a4, REAL8 aL)
REAL8 XLALSimIMRPhenomXfdamp22(const REAL8 af)
Damping frequency for 22 mode, given final dimensionless spin.
REAL8 XLALSimIMRPhenomXPsi4ToStrain(double eta, double S, double dchi)
This is a fit of the time-difference between t_peak of strain and t_peak of psi4 needed to align in t...
double pow_6_of(double number)
calc sixth power of number without floating point 'pow'
REAL8 XLALSimIMRPhenomXLinb(REAL8 eta, REAL8 S, REAL8 dchi, REAL8 delta)
double pow_2_of(double number)
calc square of number without floating point 'pow'
size_t NextPow2(const size_t n)
REAL8 XLALSimIMRPhenomXchiEff(REAL8 eta, REAL8 chi1l, REAL8 chi2l)
Effective aligned spin parameter.
REAL8 XLALSimIMRPhenomXAmp22Prefactor(REAL8 eta)
const double a4
const double a2
double REAL8
int32_t INT4
static const INT4 a