LALSimulation  5.4.0.1-ec27e42
pn_spin_evolution_wrapper.py
Go to the documentation of this file.
1 import numpy as np
2 import lalsimulation as lalsim
3 from lal import MSUN_SI, MTSUN_SI
4 
5 def spin_evolution(q, chiA0, chiB0, omega0, approximant='SpinTaylorT4',
6  dt=0.1, spinO=6, phaseO=7):
7  """
8  Wrapper for PN spin and dynamics evolution in LAL.
9  Inputs:
10  - q: Mass ratio (q>=1)
11  - chiA0: Dimensionless spin of BhA at initial freq.
12  - chiB0: Dimensionless spin of BhB at initial freq.
13  - omega0: Initial orbital frequency in dimensionless units.
14  - approximant: 'SpinTaylorT1/T4/T5'. Default: SpinTaylorT4.
15  - dt: Dimensionless step time for evolution. Default: 0.1
16  - spinO: Twice PN order of spin effects. Default: 7.
17  - phaseO: Twice PN order in phase. Default: 7.
18 
19  Outputs (all are time series):
20  - Omega: Dimensionless orbital frequency.
21  - Phi: Orbital phase (radians)
22  - ChiA: Dimensionless spin of BhA
23  - ChiB: Dimensionless spin of BhB
24  - LNhat: Orbital angular momentum direction
25  - E1: Orbital plane basis vector
26 
27  The frame is defined at the initial frequency omega0, as follows: \n
28  - z-axis is set by the orbital angular momentum direction.
29  - x-axis is the separation vector from the lighter BH to the heavier BH.
30  - y-axis completes the triad by right-hand rule. \n
31  All quantities are defined in this fixed frame, including initial spins,
32  returned spins, other vectors like LNhat, etc.
33  """
34 
35  approxTag = lalsim.SimInspiralGetApproximantFromString(approximant)
36 
37  # Total mass in solar masses
38  M = 100 # This does not affect the returned values as they are
39  # dimensionless
40 
41  # time step and initial GW freq in SI units
42  MT = M*MTSUN_SI
43  deltaT = dt*MT
44  fStart = omega0/np.pi/MT
45 
46  # component masses of the binary
47  m1_SI = M*MSUN_SI*q/(1.+q)
48  m2_SI = M*MSUN_SI/(1.+q)
49 
50  # spins at fStart
51  s1x, s1y, s1z = chiA0
52  s2x, s2y, s2z = chiB0
53 
54  # integrate as far forward as possible
55  fEnd = 0
56 
57  # initial value of orbital angular momentum unit vector, i.e at fStart
58  lnhatx, lnhaty, lnhatz = 0,0,1
59 
60  # initial value of orbital plane basis vector, i.e at fStart
61  e1x, e1y, e1z = 1, 0, 0
62 
63  # tidal deformability parameters
64  lambda1, lambda2 = 0, 0
65 
66  # spin-induced quadrupole moments
67  quadparam1, quadparam2 = 1, 1
68 
69  # twice PN order of tidal effects
70  tideO = 0
71 
72  # include some known L-S terms
73  lscorr = 1
74 
75  # evolve spins and collect data into a nice format. The input values start
76  # with lower-case letters, while output values start with upper-case
77  # letters.
78  V, Phi, S1x, S1y, S1z, S2x, S2y, S2z, LNhatx, LNhaty, LNhatz, \
79  E1x, E1y, E1z = lalsim.SimInspiralSpinTaylorPNEvolveOrbit(deltaT, \
80  m1_SI, m2_SI, fStart, fEnd, s1x, s1y, s1z, s2x, s2y, s2z, \
81  lnhatx, lnhaty, lnhatz, e1x, e1y, e1z, lambda1, lambda2, \
82  quadparam1, quadparam2, spinO, tideO, phaseO, lscorr, approxTag)
83  V = np.array(V.data.data)
84  Phi = np.array(Phi.data.data)
85  ChiA = np.array([S1x.data.data, S1y.data.data, S1z.data.data]).T
86  ChiB = np.array([S2x.data.data, S2y.data.data, S2z.data.data]).T
87  LNhat = np.array([LNhatx.data.data, LNhaty.data.data, LNhatz.data.data]).T
88  E1 = np.array([E1x.data.data, E1y.data.data, E1z.data.data]).T
89 
90  # orbital frequency
91  Omega = V**3
92  return Omega, Phi, ChiA, ChiB, LNhat
def spin_evolution(q, chiA0, chiB0, omega0, approximant='SpinTaylorT4', dt=0.1, spinO=6, phaseO=7)
Wrapper for PN spin and dynamics evolution in LAL.