<jupyter_start><jupyter_text>Example usage of NRHybSur3dq8T model, a tidally spliced surrogate model<jupyter_code>import numpy as np
import matplotlib.pyplot as P
%matplotlib inline

import gwsurrogate<jupyter_output>setting __package__ to gwsurrogate.new so relative imports work
__name__ = gwsurrogate.new.spline_evaluation
__package__= gwsurrogate.new
setting __package__ to gwsurrogate.new so relative imports work
setting __package__ to gwsurrogate.new so relative imports work<jupyter_text>Download surrogate data, this only needs to be done once<jupyter_code># The tidal spliced model uses this surrogate as the base
# This can take a few minutes
gwsurrogate.catalog.pull('NRHybSur3dq8')<jupyter_output><empty_output><jupyter_text>Load the surrogate, only needs to be done once at start of script<jupyter_code>sur = gwsurrogate.LoadSurrogate('NRHybSur3dq8Tidal')<jupyter_output>Loaded NRHybSur3dq8Tidal model<jupyter_text>Read the documentation<jupyter_code>help(sur)<jupyter_output>Help on NRHybSur3dq8Tidal in module gwsurrogate.surrogate object:

class NRHybSur3dq8Tidal(SurrogateEvaluator)
 |  A class for the NRHybSur3dq8Tidal model presented in Barkett et al.,
 |  arxiv:xxxx.xxxx #FIXME.
 |  
 |  Generates inspiralling gravitational waveforms corresponding to binary neutron
 |  stars/black hole-neutron star systems. This model is based on the aligned-spin
 |  BBH surrogate model of Varma et al. 2018, arxiv:1812.07865. Analytic TaylorT2
 |  PN tidal expressions are then utilized to modify the orbital evolution and
 |  waveform modes.
 |  
 |  This model includes the following spin-weighted spherical harmonic modes:
 |  (2,2), (2,1), (2,0), (3,3), (3,2), (3,1), (3,0), (4,4) (4,3), (4,2) and (5,5).
 |  The m<0 modes are deduced from the m>0 modes.
 |  
 |  The parameter space of validity is:
 |  q \in [1, 8] and chi1z/chi2z \in [-.7, .7] and lambda1/lambda2 \in [0,10000],
 |  where q is the mass ratio and chi1z/chi2z are the spins of the heavier/lighter
 |  BH, re[...]<jupyter_text>Evaluate Waveform  Evaluate waveform modes in dimensionless units (default)<jupyter_code>q = 1.9
chi1z = [0,0,0.2]
chi2z = [0,0,-0.15]
lambda1 = 600
lambda2 = 2000
tidOpts = {'Lambda1': lambda1, 'Lambda2': lambda2}
dt = 0.25        # step size, Units of M
f_low = 3e-3    # initial frequency, Units of cycles/M
t, h, dyn = sur(q, chi1z, chi2z, dt=dt, f_low=f_low, tidal_opts=tidOpts)
# Let's see all available modes (m<0 modes will be included automatically if inclination/phi_ref arguments are given)
print( sorted(h.keys()) )
P.plot(t, h[(2,2)].real, label='l2m2 real')
P.plot(t, h[(3,3)].real, label='l3m3 real')
P.plot(t, h[(4,4)].real, label='l4m4 real')
P.ylabel('Re[$h_{lm}$]', fontsize=18)
P.xlabel('t [M]', fontsize=18)
P.legend()<jupyter_output><empty_output><jupyter_text>Evaluate waveform on fixed time array<jupyter_code>q = 1.9
chi1z = [0,0,0.2]
chi2z = [0,0,-0.15]
lambda1 = 600
lambda2 = 2000
tidOpts = {'Lambda1': lambda1, 'Lambda2': lambda2}
f_low = 3e-3  # this will be ignored and the wavefrom will be returned on the times given below
times = np.arange(-10000,-500,0.1)
t, h, dyn = sur(q, chi1z, chi2z, times=times, f_low=f_low, tidal_opts=tidOpts)

P.plot(times, h[(2,2)].real, label='l2m2 real')
P.plot(times, h[(3,3)].real, label='l3m3 real')
P.plot(times, h[(4,4)].real, label='l4m4 real')
P.ylabel('Re[$h_{lm}$]', fontsize=18)
P.xlabel('t [M]', fontsize=18)
P.legend()<jupyter_output><empty_output><jupyter_text>Evaluate modes in physical units<jupyter_code>q = 1.9
chi1z = [0,0,0.2]
chi2z = [0,0,-0.15]
lambda1 = 600
lambda2 = 2000
tidOpts = {'Lambda1': lambda1, 'Lambda2': lambda2}
M = 20             # Total masss in solar masses
dist_mpc = 100     # distance in megaparsecs
dt = 1./4096       # step size in seconds
f_low = 20         # initial frequency in Hz
t, h, dyn = sur(q, chi1z, chi2z, dt=dt, f_low=f_low, mode_list=[(2,2), (2,1), (3, 3)], M=M,
                dist_mpc=dist_mpc, units='mks', tidal_opts=tidOpts)

P.plot(t, h[(2,2)].real, label='l2m2 real')
P.plot(t, h[(3,3)].real, label='l3m3 real')
P.plot(t, h[(2,1)].real, label='l2m1 real')
P.ylabel('Re[$h_{lm}$]', fontsize=18)
P.xlabel('t [s]', fontsize=18)
P.legend()<jupyter_output><empty_output><jupyter_text>Evaluate waveform at a point on sky<jupyter_code>q = 1.9
chi1z = [0,0,0.2]
chi2z = [0,0,-0.15]
lambda1 = 600
lambda2 = 2000
tidOpts = {'Lambda1': lambda1, 'Lambda2': lambda2}
M = 40             # Total masss in solar masses
dist_mpc = 100     # distance in megaparsecs
dt = 1./4096       # step size in seconds
f_low = 20         # initial frequency in Hz
inclination = np.pi/4
phi_ref = np.pi/5

# Will only include modes given in mode_list argument as well as the m<0 counterparts.
# If mode_list is not specified, uses all available modes.
# Returns h_+ -i h_x
t, h, dyn = sur(q, chi1z, chi2z, dt=dt, f_low=f_low, mode_list=[(2,2), (2,1), (3, 3)], M=M, dist_mpc=dist_mpc, 
           inclination=inclination, phi_ref=phi_ref, units='mks', tidal_opts=tidOpts)

P.plot(t, h.real)
P.ylabel('$h_{+}$ $(\iota, \phi_{ref})$', fontsize=18)
P.xlabel('t [s]', fontsize=18)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1402582159624413, 'fraction_numerical': 0.056533646322378714, 'mean_word_length': 4.850114416475972, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '8', 'dir': 'jupyter-structured-clean-dedup', 'id': '544492', 'license': 'MIT', 'n_tokens_mistral': 2160, 'n_tokens_neox': 1984, 'n_words': 545, 'path': 'tutorial/website/NRHybSur3dq8Tidal.ipynb', 'repo_name': 'tousifislam/gwsurrogate', 'size': '5112'}