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 0x7f62dd164af0>
[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
... ... ... ... ... ... ... ... ...
2838 14876.611713 2.078110 326.974132 -0.235719 2.169854 7.334338 0.207813 0.215060
2839 14876.711713 2.067839 326.994952 -0.239651 2.168466 7.333996 0.208553 0.216080
2840 14876.811713 2.057290 327.015846 -0.243713 2.167039 7.333640 0.209319 0.217148
2841 14876.911713 2.046448 327.036816 -0.247912 2.165571 7.333271 0.210114 0.218265
2842 14877.011713 2.035300 327.057864 -0.252252 2.164060 7.332888 0.210941 0.219438

2843 rows × 8 columns

[ ]: