A small jax package for differentiable and fast gravitational wave data analysis.
Project description
Ripple :ocean:
A small jax
package for differentiable and fast gravitational wave data analysis.
Getting Started
Installation
Both waveforms have been tested extensively and match lalsuite
implementations to machine precision across all the parameter space.
Ripple can be installed using
pip3 install ripplegw
Note that by default we do not include enable float64 in `jax`` since we want allow users to use float32 to improve performance. If you require float64, please include the following code at the start of the script:
from jax import config
config.update("jax_enable_x64", True)
See https://jax.readthedocs.io/en/latest/notebooks/Common_Gotchas_in_JAX.html for other common jax
gotchas.
Supported waveforms
- IMRPhenomXAS (aligned spin)
- IMRPhenomD (aligned spin)
- IMRPhenomPv2 (Still finalizing sampling checks)
- TaylorF2 with tidal effects
- IMRPhenomD_NRTidalv2, verified for the low spin regime (chi1, chi2 < 0.05), further testing is required for higher spins
Generating a waveform and its derivative
Generating a waveform is incredibly easy. Below is an example of calling the PhenomXAS waveform model to get the h_+ and h_x polarizations of the waveform model
We start with some basic imports:
import jax.numpy as jnp
from ripple.waveforms import IMRPhenomXAS
from ripple import ms_to_Mc_eta
And now we can just set the parameters and call the waveform!
# Get a frequency domain waveform
# source parameters
m1_msun = 20.0 # In solar masses
m2_msun = 19.0
chi1 = 0.5 # Dimensionless spin
chi2 = -0.5
tc = 0.0 # Time of coalescence in seconds
phic = 0.0 # Time of coalescence
dist_mpc = 440 # Distance to source in Mpc
inclination = 0.0 # Inclination Angle
# The PhenomD waveform model is parameterized with the chirp mass and symmetric mass ratio
Mc, eta = ms_to_Mc_eta(jnp.array([m1_msun, m2_msun]))
# These are the parametrs that go into the waveform generator
# Note that JAX does not give index errors, so if you pass in the
# the wrong array it will behave strangely
theta_ripple = jnp.array([Mc, eta, chi1, chi2, dist_mpc, tc, phic, inclination])
# Now we need to generate the frequency grid
f_l = 24
f_u = 512
del_f = 0.01
fs = jnp.arange(f_l, f_u, del_f)
f_ref = f_l
# And finally lets generate the waveform!
hp_ripple, hc_ripple = IMRPhenomXAS.gen_IMRPhenomXAS_hphc(fs, theta_ripple, f_ref)
# Note that we have not internally jitted the functions since this would
# introduce an annoying overhead each time the user evaluated the function with a different length frequency array
# We therefore recommend that the user jit the function themselves to accelerate evaluations. For example:
import jax
@jax.jit
def waveform(theta):
return IMRPhenomXAS.gen_IMRPhenomXAS_hphc(fs, theta)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file ripplegw-0.0.9.tar.gz
.
File metadata
- Download URL: ripplegw-0.0.9.tar.gz
- Upload date:
- Size: 452.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f0514364a1f5c530294f0c46e0efde01fecf05e8ee7bd04db256f44e0428de55 |
|
MD5 | 575865cbf53f91a9d1ff3748ce29ae44 |
|
BLAKE2b-256 | 52680a8d7851a44c8ed6bcdd353337d2dc4e0a891e7cc2895f7fe9bbe17cbbd3 |
File details
Details for the file ripplegw-0.0.9-py3-none-any.whl
.
File metadata
- Download URL: ripplegw-0.0.9-py3-none-any.whl
- Upload date:
- Size: 906.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cd87ff6b3adb8d0651fc2bbbf7b4a21abc2c5bdc0680c8ec9c7b63d6d744b01a |
|
MD5 | f9807cb34db0a3d0832f530a18c4c023 |
|
BLAKE2b-256 | b91cbff356a2a6d8ce804d36778d35e8492e8309cd0f824b4f2669f408b16a3c |