PySEOBNR introduction

The notebook shows how to get started with pyseobnr.

[1]:
import warnings

# silence warnings coming from LAL
warnings.filterwarnings("ignore", "Wswiglal-redir-stdio")

import numpy as np
from matplotlib import pyplot as plt

# import the library
from pyseobnr.generate_waveform import GenerateWaveform
[2]:
# Start with the usual parameter definitions
# Masses in solar masses
m1 = 50.0
m2 = 30.0
s1x, s1y, s1z = 0.0, 0.0, 0.5
s2x, s2y, s2z = 0.0, 0.0, 0.8

deltaT = 1.0 / 2048.0
f_min = 20.0
f_max = 1024.0

distance = 1000.0  # Mpc
inclination = np.pi / 3.0
phiRef = 0.0
approximant = "SEOBNRv5HM"

params_dict = {
    "mass1": m1,
    "mass2": m2,
    "spin1x": s1x,
    "spin1y": s1y,
    "spin1z": s1z,
    "spin2x": s2x,
    "spin2y": s2y,
    "spin2z": s2z,
    "deltaT": deltaT,
    "f22_start": f_min,
    "phi_ref": phiRef,
    "distance": distance,
    "inclination": inclination,
    "f_max": f_max,
    "approximant": approximant,
}
[3]:
# We call the generator with the parameters
wfm_gen = GenerateWaveform(params_dict)

# Generate mode dictionary
times, hlm = wfm_gen.generate_td_modes()

Plot some modes

[4]:
plt.figure()
plt.plot(times, hlm[(2, 2)].real)
plt.xlabel("Time (seconds)")
plt.ylabel(r"$\Re[h_{22}]$")
plt.grid(True)
plt.show()
../../_images/source_notebooks_getting_started_5_0.png
[5]:
plt.figure()
plt.plot(times, hlm[(3, 3)].imag)
plt.xlabel("Time (seconds)")
plt.ylabel(r"$\Im[h_{33}]$")
plt.grid(True)
plt.show()
../../_images/source_notebooks_getting_started_6_0.png

Expert mode

[6]:
from pyseobnr.generate_waveform import generate_modes_opt

q = 5.3
chi_1 = 0.9
chi_2 = 0.3
omega0 = 0.0137  # This is the orbital frequency in geometric units with M=1

_, _, model = generate_modes_opt(q, chi_1, chi_2, omega0, debug=True)
model
[6]:
<pyseobnr.models.SEOBNRv5HM.SEOBNRv5HM_opt at 0x7fc9fb743a00>
[7]:
t, r, phi, pr, pphi, H, Omega, _ = model.dynamics.T
[8]:
import pandas as pd

frame_dynamics = pd.DataFrame(
    data=model.dynamics,
    columns="t, r, phi, pr, pphi, H, Omega, Omega_circular".replace(" ", "").split(","),
)
frame_dynamics
[8]:
t r phi pr pphi H Omega Omega_circular
0 0.000000 17.371216 0.000000 -0.000325 4.436354 7.460756 0.013700 0.013700
1 91.725333 17.343818 1.258109 -0.000325 4.433223 7.460713 0.013732 0.013732
2 183.450666 17.316357 2.519172 -0.000327 4.430076 7.460670 0.013764 0.013764
3 275.175999 17.288693 3.783213 -0.000330 4.426911 7.460626 0.013797 0.013797
4 366.901332 17.260762 5.050276 -0.000333 4.423729 7.460582 0.013830 0.013830
... ... ... ... ... ... ... ... ...
2817 14876.703802 2.068674 326.993301 -0.239332 2.168579 7.334024 0.208492 0.215997
2818 14876.803802 2.058138 327.014190 -0.243386 2.167153 7.333669 0.209257 0.217061
2819 14876.903802 2.047304 327.035156 -0.247578 2.165686 7.333300 0.210051 0.218176
2820 14877.003802 2.036154 327.056200 -0.251914 2.164176 7.332916 0.210878 0.219348
2821 14877.103802 2.024674 327.077326 -0.256398 2.162620 7.332516 0.211740 0.220580

2822 rows × 8 columns

[ ]: