A Python package for calculating gravitational wave signal-to-noise ratios
Project description
gwsnr: Gravitational Wave Signal-to-Noise Ratio Computation Package
Installation
pip install gwsnr
How to use? (Simple Example)
from gwsnr import GWSNR
gwsnr = GWSNR()
snrs = gwsnr.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.
-
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
Release history Release notifications | RSS feed
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gwsnr-0.3.5.tar.gz.
File metadata
- Download URL: gwsnr-0.3.5.tar.gz
- Upload date:
- Size: 13.8 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dbc5ee7fd53c92738b6696f8f1cf6cfffee41b26b9396559911a32e940e696ee
|
|
| MD5 |
470c13412ef995828d8bf3f2e1b6aaed
|
|
| BLAKE2b-256 |
1657edc5a6c9167b07bcf065d81a071da5080bc4d008ffddd62f1ab3608fe291
|
File details
Details for the file gwsnr-0.3.5-py3-none-any.whl.
File metadata
- Download URL: gwsnr-0.3.5-py3-none-any.whl
- Upload date:
- Size: 13.9 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
11092238a9e405e3b7e2761200c10b8c2e9f9202909e1aec6c4ede763f0790c1
|
|
| MD5 |
cb377d9224de34e46bce91d18c983c17
|
|
| BLAKE2b-256 |
82bb057101578dd1c7d9199e30503c2473edf119589a143a73263a4215d122fe
|