gwsnr.mlx.mlx_interpolators

Module Contents

Functions

find_index_1d_mlx(x_array, x_new)

spline_interp_4pts_mlx(x_eval, x_pts, y_pts, condition_i)

spline_interp_4x4x4x4pts_mlx(q_array, mtot_array, ...)

Helper function that performs the FULL 4D interpolation for a SINGLE point.

spline_interp_4x4x4x4pts_batched_mlx(q_array, ...)

Perform batched 4D cubic spline interpolation using JAX vectorization.

get_interpolated_snr_aligned_spins_mlx(mass_1, mass_2, ...)

Calculate interpolated signal-to-noise ratio (SNR) for aligned spin gravitational wave signals using JAX.

get_interpolated_snr_aligned_spins_helper(mass_1, ...)

Calculate interpolated signal-to-noise ratio (SNR) for aligned spin gravitational wave signals using JAX.

spline_interp_4x4pts_mlx(q_array, mtot_array, ...)

Helper function that performs the FULL 2D interpolation for a SINGLE point.

spline_interp_4x4pts_batched_mlx(q_array, mtot_array, ...)

Perform batched 2D cubic spline interpolation using MLX vectorization.

get_interpolated_snr_no_spins_mlx(mass_1, mass_2, ...)

Calculate interpolated signal-to-noise ratio (SNR) for aligned spin gravitational wave signals using JAX.

get_interpolated_snr_no_spins_helper(mass_1, mass_2, ...)

Calculate interpolated signal-to-noise ratio (SNR) for non-spinning gravitational wave signals using JAX.

gwsnr.mlx.mlx_interpolators.find_index_1d_mlx(x_array, x_new)[source]
gwsnr.mlx.mlx_interpolators.spline_interp_4pts_mlx(x_eval, x_pts, y_pts, condition_i)[source]
gwsnr.mlx.mlx_interpolators.spline_interp_4x4x4x4pts_mlx(q_array, mtot_array, a1_array, a2_array, snrpartialscaled_array, q_new, mtot_new, a1_new, a2_new)[source]

Helper function that performs the FULL 4D interpolation for a SINGLE point. This function finds indices, slices data, and then uses vmap internally to perform interpolation efficiently without Python loops.

gwsnr.mlx.mlx_interpolators.spline_interp_4x4x4x4pts_batched_mlx(q_array, mtot_array, a1_array, a2_array, snrpartialscaled_array, q_new_batch, mtot_new_batch, a1_new_batch, a2_new_batch)[source]

Perform batched 4D cubic spline interpolation using JAX vectorization.

gwsnr.mlx.mlx_interpolators.get_interpolated_snr_aligned_spins_mlx(mass_1, mass_2, luminosity_distance, theta_jn, psi, geocent_time, ra, dec, a_1, a_2, detector_tensor, snr_partialscaled, ratio_arr, mtot_arr, a1_arr, a_2_arr, batch_size=100000)[source]

Calculate interpolated signal-to-noise ratio (SNR) for aligned spin gravitational wave signals using JAX. This function computes the SNR for gravitational wave signals with aligned spins across multiple detectors using 4D cubic spline interpolation. It calculates the effective distance, partial SNR, and combines results from multiple detectors to produce the effective SNR.

Parameters:
mass_1jax.numpy.ndarray

Primary mass of the binary system in solar masses.

mass_2jax.numpy.ndarray

Secondary mass of the binary system in solar masses.

luminosity_distancejax.numpy.ndarray

Luminosity distance to the source in Mpc.

theta_jnjax.numpy.ndarray

Inclination angle between the orbital angular momentum and line of sight in radians.

psijax.numpy.ndarray

Polarization angle in radians.

geocent_timejax.numpy.ndarray

GPS time of coalescence at the geocenter in seconds.

rajax.numpy.ndarray

Right ascension of the source in radians.

decjax.numpy.ndarray

Declination of the source in radians.

a_1jax.numpy.ndarray

Dimensionless spin magnitude of the primary black hole.

a_2jax.numpy.ndarray

Dimensionless spin magnitude of the secondary black hole.

detector_tensorjax.numpy.ndarray

Detector tensor array containing detector response information. Shape: (n_detectors, …)

snr_partialscaledjax.numpy.ndarray

Pre-computed scaled partial SNR values for interpolation. Shape: (n_detectors, …)

ratio_arrjax.numpy.ndarray

Mass ratio grid points for interpolation (q = m2/m1).

mtot_arrjax.numpy.ndarray

Total mass grid points for interpolation.

a1_arrjax.numpy.ndarray

Primary spin grid points for interpolation.

a_2_arrjax.numpy.ndarray

Secondary spin grid points for interpolation.

Returns:
snrjax.numpy.ndarray

SNR values for each detector. Shape: (n_detectors, n_samples)

snr_effectivejax.numpy.ndarray

Effective SNR combining all detectors. Shape: (n_samples,)

snr_partial_jax.numpy.ndarray

Interpolated partial SNR values for each detector. Shape: (n_detectors, n_samples)

d_effjax.numpy.ndarray

Effective distance for each detector accounting for antenna response. Shape: (n_detectors, n_samples)

Notes

  • Uses 4D cubic spline interpolation for efficient SNR calculation

  • Assumes aligned spins (no precession)

  • Effective SNR is calculated as sqrt(sum(SNR_i^2)) across detectors

  • Chirp mass and inclination-dependent factors are computed analytically

gwsnr.mlx.mlx_interpolators.get_interpolated_snr_aligned_spins_helper(mass_1, mass_2, luminosity_distance, theta_jn, a_1, a_2, snr_partialscaled, ratio_arr, mtot_arr, a1_arr, a_2_arr, Fp, Fc, detector_tensor, batch_size)[source]

Calculate interpolated signal-to-noise ratio (SNR) for aligned spin gravitational wave signals using JAX. This function computes the SNR for gravitational wave signals with aligned spins across multiple detectors using 4D cubic spline interpolation. It calculates the effective distance, partial SNR, and combines results from multiple detectors to produce the effective SNR.

Parameters:
mass_1jax.numpy.ndarray

Primary mass of the binary system in solar masses.

mass_2jax.numpy.ndarray

Secondary mass of the binary system in solar masses.

luminosity_distancejax.numpy.ndarray

Luminosity distance to the source in Mpc.

theta_jnjax.numpy.ndarray

Inclination angle between the orbital angular momentum and line of sight in radians.

psijax.numpy.ndarray

Polarization angle in radians.

geocent_timejax.numpy.ndarray

GPS time of coalescence at the geocenter in seconds.

rajax.numpy.ndarray

Right ascension of the source in radians.

decjax.numpy.ndarray

Declination of the source in radians.

a_1jax.numpy.ndarray

Dimensionless spin magnitude of the primary black hole.

a_2jax.numpy.ndarray

Dimensionless spin magnitude of the secondary black hole.

detector_tensorjax.numpy.ndarray

Detector tensor array containing detector response information. Shape: (n_detectors, …)

snr_partialscaledjax.numpy.ndarray

Pre-computed scaled partial SNR values for interpolation. Shape: (n_detectors, …)

ratio_arrjax.numpy.ndarray

Mass ratio grid points for interpolation (q = m2/m1).

mtot_arrjax.numpy.ndarray

Total mass grid points for interpolation.

a1_arrjax.numpy.ndarray

Primary spin grid points for interpolation.

a_2_arrjax.numpy.ndarray

Secondary spin grid points for interpolation.

Returns:
snrjax.numpy.ndarray

SNR values for each detector. Shape: (n_detectors, n_samples)

snr_effectivejax.numpy.ndarray

Effective SNR combining all detectors. Shape: (n_samples,)

snr_partial_jax.numpy.ndarray

Interpolated partial SNR values for each detector. Shape: (n_detectors, n_samples)

d_effjax.numpy.ndarray

Effective distance for each detector accounting for antenna response. Shape: (n_detectors, n_samples)

Notes

  • Uses 4D cubic spline interpolation for efficient SNR calculation

  • Assumes aligned spins (no precession)

  • Effective SNR is calculated as sqrt(sum(SNR_i^2)) across detectors

  • Chirp mass and inclination-dependent factors are computed analytically

gwsnr.mlx.mlx_interpolators.spline_interp_4x4pts_mlx(q_array, mtot_array, snrpartialscaled_array, q_new, mtot_new)[source]

Helper function that performs the FULL 2D interpolation for a SINGLE point. This function finds indices, slices data, and then uses vmap internally to perform interpolation efficiently without Python loops.

gwsnr.mlx.mlx_interpolators.spline_interp_4x4pts_batched_mlx(q_array, mtot_array, snrpartialscaled_array, q_new_batch, mtot_new_batch)[source]

Perform batched 2D cubic spline interpolation using MLX vectorization.

gwsnr.mlx.mlx_interpolators.get_interpolated_snr_no_spins_mlx(mass_1, mass_2, luminosity_distance, theta_jn, psi, geocent_time, ra, dec, a_1, a_2, detector_tensor, snr_partialscaled, ratio_arr, mtot_arr, a1_arr, a_2_arr, batch_size=100000)[source]

Calculate interpolated signal-to-noise ratio (SNR) for aligned spin gravitational wave signals using JAX. This function computes the SNR for gravitational wave signals with aligned spins across multiple detectors using 4D cubic spline interpolation. It calculates the effective distance, partial SNR, and combines results from multiple detectors to produce the effective SNR.

Parameters:
mass_1jax.numpy.ndarray

Primary mass of the binary system in solar masses.

mass_2jax.numpy.ndarray

Secondary mass of the binary system in solar masses.

luminosity_distancejax.numpy.ndarray

Luminosity distance to the source in Mpc.

theta_jnjax.numpy.ndarray

Inclination angle between the orbital angular momentum and line of sight in radians.

psijax.numpy.ndarray

Polarization angle in radians.

geocent_timejax.numpy.ndarray

GPS time of coalescence at the geocenter in seconds.

rajax.numpy.ndarray

Right ascension of the source in radians.

decjax.numpy.ndarray

Declination of the source in radians.

a_1jax.numpy.ndarray

Dimensionless spin magnitude of the primary black hole.

a_2jax.numpy.ndarray

Dimensionless spin magnitude of the secondary black hole.

detector_tensorjax.numpy.ndarray

Detector tensor array containing detector response information. Shape: (n_detectors, …)

snr_partialscaledjax.numpy.ndarray

Pre-computed scaled partial SNR values for interpolation. Shape: (n_detectors, …)

ratio_arrjax.numpy.ndarray

Mass ratio grid points for interpolation (q = m2/m1).

mtot_arrjax.numpy.ndarray

Total mass grid points for interpolation.

a1_arrjax.numpy.ndarray

Primary spin grid points for interpolation.

a_2_arrjax.numpy.ndarray

Secondary spin grid points for interpolation.

Returns:
snrjax.numpy.ndarray

SNR values for each detector. Shape: (n_detectors, n_samples)

snr_effectivejax.numpy.ndarray

Effective SNR combining all detectors. Shape: (n_samples,)

snr_partial_jax.numpy.ndarray

Interpolated partial SNR values for each detector. Shape: (n_detectors, n_samples)

d_effjax.numpy.ndarray

Effective distance for each detector accounting for antenna response. Shape: (n_detectors, n_samples)

Notes

  • Uses 4D cubic spline interpolation for efficient SNR calculation

  • Assumes aligned spins (no precession)

  • Effective SNR is calculated as sqrt(sum(SNR_i^2)) across detectors

  • Chirp mass and inclination-dependent factors are computed analytically

gwsnr.mlx.mlx_interpolators.get_interpolated_snr_no_spins_helper(mass_1, mass_2, luminosity_distance, theta_jn, snr_partialscaled, ratio_arr, mtot_arr, Fp, Fc, detector_tensor, batch_size)[source]

Calculate interpolated signal-to-noise ratio (SNR) for non-spinning gravitational wave signals using JAX. This function computes the SNR for gravitational wave signals without spins across multiple detectors using 4D cubic spline interpolation. It calculates the effective distance, partial SNR, and combines results from multiple detectors to produce the effective SNR.