Skip to main content

A Python package for calculating gravitational wave signal-to-noise ratios

Project description

gwsnr: Gravitational Wave Signal-to-Noise Ratio Computation Package

Docs PyPI version DOI

Your Logo

Installation

pip install gwsnr

Example Usage

from gwsnr import GWSNR
gwsnr = GWSNR()
snrs = gwsnroptimal_snr(mass_1=30, mass_2=30, distance=1000, psi=0.0, phase=0.0, geocent_time=1246527224.169434, ra=0.0, dec=0.0)
print(f"SNR value: {snrs}")

Summary

Gravitational waves (GWs)—ripples in spacetime predicted by Einstein’s theory of General Relativity—have revolutionized astrophysics since their first direct detection in 2015. These signals, emitted by the mergers of compact objects such as binary black holes (BBHs), binary neutron stars (BNSs), and black hole–neutron star pairs, provide unique insights into the universe. A central quantity in GW data analysis is the signal-to-noise ratio (SNR), which quantifies the strength of a GW signal relative to the noise in detectors like LIGO, Virgo, and KAGRA. Reliable SNR estimation is essential for confirming GW detections and performing astrophysical inference. However, modern GW research—especially in population simulations and hierarchical Bayesian inference with selection effects—requires the computation of SNRs for vast numbers of systems, making traditional methods based on noise-weighted inner products prohibitively slow.

The gwsnr Python package addresses this computational bottleneck, offering a flexible, high-performance, and user-friendly framework for SNR and probability of detection ($P_{\rm det}$) estimation. At its core, gwsnr leverages NumPy vectorization along with Just-In-Time (JIT) compilation via Numba and JAX, as well as Python multiprocessing, to deliver exceptional performance.

Key Features

  • Noise-Weighted Inner Product with Multiprocessing: Provides accurate SNR calculations for arbitrary frequency-domain waveforms, including those with spin precession and higher-order harmonics available in lalsimulation. The method is enhanced with multiprocessing and JIT compilation to accelerate computation, with optional support for JAX-based waveform libraries like ripple.

  • Partial Scaling Interpolation: An innovative and highly efficient interpolation method for accurately calculating the SNR of non-precessing (spinless or aligned-spin) binary systems. This approach dramatically reduces computation time, making large-scale analyses practical.

  • ANN-Based $P_{\rm det}$ Estimation: Employs a trained Artificial Neural Network (ANN) to provide fast probability of detection ($P_{\rm det}$) estimates via SNR calculations for precessing BBH systems. This feature is especially valuable when rapid detection assessments are needed without requiring precise SNR values.

  • Hybrid SNR Recalculation: A balanced approach that combines the speed of the partial scaling method (or ANN-based estimation) with the precision of the noise-weighted inner product, ensuring high accuracy for systems near the detection threshold.

  • Horizon Distance Calculation: Implements both analytical and numerical methods to compute the horizon distance for gravitational wave sources, allowing users to assess detector sensitivity and detection capabilities across various configurations.

  • Integration and Flexibility: Offers a user-friendly interface to combine various detector noise models, waveform models, detector configurations, and signal parameters.

These capabilities make gwsnr an invaluable tool for GW data analysis, particularly for determining the rates of lensed and unlensed GW events (as demonstrated by its use in the ler package and related works), and for modeling selection biases in hierarchical Bayesian frameworks.

Documentation

The gwsnr package documentation is available at ReadTheDocs.

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

gwsnr-0.3.7.tar.gz (130.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gwsnr-0.3.7-py3-none-any.whl (14.0 MB view details)

Uploaded Python 3

File details

Details for the file gwsnr-0.3.7.tar.gz.

File metadata

  • Download URL: gwsnr-0.3.7.tar.gz
  • Upload date:
  • Size: 130.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.18

File hashes

Hashes for gwsnr-0.3.7.tar.gz
Algorithm Hash digest
SHA256 8b26eb6e94efcbf958cc0b313131c7094bff26132ca0772daaeace72c11bdc1f
MD5 a454eb70bf2171b698e1375a2ccf8ef4
BLAKE2b-256 250297e5baf3fbbb6f7d3250eea41cfff3cb95c9e35c54887b89ed61a719aa1e

See more details on using hashes here.

File details

Details for the file gwsnr-0.3.7-py3-none-any.whl.

File metadata

  • Download URL: gwsnr-0.3.7-py3-none-any.whl
  • Upload date:
  • Size: 14.0 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.18

File hashes

Hashes for gwsnr-0.3.7-py3-none-any.whl
Algorithm Hash digest
SHA256 cdfb37e5064147c650add9fe4e830efb846feff3947d3524820fef4ef6db0ef2
MD5 7201f46353a7a4cc4771af40f7a1f809
BLAKE2b-256 3b631420539eb69ed8147191e329c9ba2f77fa85c61cd8b8053d8a83cebd1447

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page