Skip to main content

Python package to extract remnant black hole properties from gravitational waveforms

Project description

gw_remnant logo

gw_remnant

Documentation PyPI License: MIT

During binary-black-hole (BBH) mergers, energy and momenta are carried away from the binary system as gravitational radiation. Access to the radiated energy and momenta allows us to accurately predict the properties of the remnant black hole.

gw_remnant is an easy-to-use Python package to efficiently extract the remnant mass, remnant spin, peak luminosity and the final kick imparted on the remnant black hole directly from the gravitational radiation.

Documentation: https://tousifislam.github.io/gw_remnant/

Installation

Install from PyPI:

pip install gw_remnant

Install with optional dependencies for waveform surrogates:

pip install gw_remnant[surrogates]

Install with optional dependencies for numerical relativity catalogs:

pip install gw_remnant[nr]

Install all optional dependencies:

pip install gw_remnant[all]

Install from source (development):

git clone https://github.com/tousifislam/gw_remnant.git
cd gw_remnant
pip install -e .[dev]

Dependencies

Core (always installed):

Package Version
Python >= 3.8
numpy >= 1.20.0
scipy >= 1.7.0
matplotlib >= 3.3.0
gwtools

Optional extras:

Install option Packages Purpose
pip install gw_remnant[surrogates] gwsurrogate, surfinBH Waveform surrogate models and remnant fits
pip install gw_remnant[nr] sxs, mayawaves Numerical relativity catalog access
pip install gw_remnant[dev] pytest, pytest-cov, black, flake8, ipython, jupyter Development and testing
pip install gw_remnant[docs] sphinx, pydata-sphinx-theme, sphinx-autodoc-typehints, nbsphinx, pandoc, ipykernel Building documentation
pip install gw_remnant[eob] pyseobnr Effective-one-body waveforms
pip install gw_remnant[all] gwsurrogate, surfinBH, sxs, mayawaves, pyseobnr All non-dev optional dependencies

Quick Start

import numpy as np
from gw_remnant.gw_remnant_calculator import GWRemnantCalculator

# Provide time array and waveform modes (e.g. from a surrogate model)
# time: 1D array in geometric units (M)
# h_dict: dictionary of complex waveform modes, e.g. {(2,2): h22(t), ...}
calc = GWRemnantCalculator(time, h_dict, q=2.0,
                           chi1=[0, 0, 0.5])

# Print summary
calc.print_remnants()

# Access individual properties
props = calc.get_remnant_properties()
print(f"Remnant mass: {props['remnant_mass']:.6f} M")
print(f"Remnant spin: {props['remnant_spin']:.6f}")

# Plot diagnostics (optionally save to file)
calc.plot_mass_energy(save_path='mass_energy.png')

See the Quick Start guide for more details.

Architecture

The package uses a mixin-based class hierarchy that composes into a single entry point:

GWRemnantCalculator   (gw_remnant_calculator.py)
 ├── GWPlotter                    — diagnostic plots (mass, momentum, spin, kick, trajectory)
 ├── PeakLuminosityCalculator     — peak dE/dt via spline interpolation
 ├── AngularMomentumCalculator    — J_dot, Joft, remnant spin (scalar + 3-vector)
 ├── TrajectoryCalculator         — center-of-mass displacement x(t) = ∫v dt
 ├── LinearMomentumCalculator     — P_dot, Poft, kick velocity v(t) = P/M(t)
 ├── RemnantMassCalculator        — dE/dt, E_rad(t), Bondi mass M(t), remnant mass
 └── InitialEnergyMomenta         — initial E, L from post-Newtonian (PN) expressions

Everything is computed eagerly in __init__ — constructing a GWRemnantCalculator runs the full pipeline bottom-up.

gw_remnant/
├── gw_remnant/                        # Main package directory
│   ├── __init__.py                    # Package initialization
│   ├── gw_remnant_calculator.py       # Main calculator class
│   ├── gw_waveform_generator.py       # Waveform generation utilities
│   │
│   ├── gw_utils/                      # Utility functions
│   │   ├── __init__.py
│   │   ├── waveform_generator.py      # Waveform generation helpers
│   │   └── gw_plotter.py             # Plotting utilities
│   │
│   └── remnant_calculators/           # Remnant property calculators
│       ├── __init__.py
│       ├── remnant_mass_calculator.py
│       ├── remnant_spin_calculator.py
│       ├── kick_velocity_calculator.py
│       ├── trajectory_calculator.py
│       ├── peak_luminosity_calculator.py
│       └── initial_energy_momenta.py
│
├── docs/                              # Sphinx documentation source
├── tutorials/                         # Example notebooks and tutorials
├── tests/                             # Unit tests
├── pyproject.toml                     # Packaging configuration
├── README.md                          # This file
├── LICENSE                            # License information
└── .gitignore                         # Git ignore rules

Supported Waveform Models

The package includes built-in waveform generators for NRHybSur3dq8, NRSur7dq4, BHPTNRSur1dq1e4, and BHPTNRSur2dq1e3. It can also accept waveforms generated by any other method — see Providing Waveform Data.

Tutorials

Example notebooks are provided in the tutorials/ directory:

# Notebook Waveform source
1 Remnant from default waveforms Built-in surrogate generators (BHPTNRSur1dq1e4, NRHybSur3dq8)
2 Remnant from NRSur7dq4 waveforms NRSur7dq4 (precessing surrogate)
3 Remnant from NRHybSur3dq8 waveforms NRHybSur3dq8 (aligned-spin surrogate)
4 Remnant from SXS quasi-circular simulations SXS NR catalog (non-spinning, aligned-spin, precessing)
5 Remnant from SXS eccentric simulations SXS NR catalog (eccentric orbits)
6 Remnant from Maya catalog waveforms Maya/Georgia Tech NR catalog
7 Remnant from pySEOBNR waveforms pySEOBNR EOB models (SEOBNRv5HM/PHM/EHM)

These are also rendered in the online documentation.

BHPTNRremnant

gw_remnant has been used in developing an NR-tuned perturbation-based remnant model that provides faithful estimates of the remnant properties for binaries with mass ratios ranging from q=3 to q=1000.

Citation

If you make use of any module from the Toolkit in your research please acknowledge using:

This work makes use of the Black Hole Perturbation Toolkit.

If you make use of the gw_remnant package or BHPTNRremnant surrogate models please cite the following paper:

@article{Islam:2022laz,
    author = "Islam, Tousif and Field, Scott E. and Khanna, Gaurav.",
    title = "{Remnant black hole properties from numerical-relativity-informed perturbation theory and implications for waveform modelling}",
    eprint = "https://arxiv.org/abs/2301.07215",
    archivePrefix = "arXiv",
    primaryClass = "gr-qc",
    month = "1",
    year = "2023"
}

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

gw_remnant-0.4.0.tar.gz (36.6 kB view details)

Uploaded Source

Built Distribution

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

gw_remnant-0.4.0-py3-none-any.whl (38.0 kB view details)

Uploaded Python 3

File details

Details for the file gw_remnant-0.4.0.tar.gz.

File metadata

  • Download URL: gw_remnant-0.4.0.tar.gz
  • Upload date:
  • Size: 36.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for gw_remnant-0.4.0.tar.gz
Algorithm Hash digest
SHA256 dc4490ccf6c45fbba7bc269bb2fd66991402561427ded0429f1d1541c1971659
MD5 82ad9cda18c528c8c87ae226887f93e1
BLAKE2b-256 0453f88b29d65f3d5928c63c0a9d1c67beecc01f7921ba12cb34f168e6360c4e

See more details on using hashes here.

Provenance

The following attestation bundles were made for gw_remnant-0.4.0.tar.gz:

Publisher: publish.yml on tousifislam/gw_remnant

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file gw_remnant-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: gw_remnant-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 38.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for gw_remnant-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 259ead12e55b1002edca5ffd95b8923c3ea592a60d7ce5555538226be5cc747c
MD5 2bdcfaa1d68b6af2599c4f696084b4a7
BLAKE2b-256 d01c33cf67d5b5736d62966c1782b47b088093bb8a301863854b5516be9be9ce

See more details on using hashes here.

Provenance

The following attestation bundles were made for gw_remnant-0.4.0-py3-none-any.whl:

Publisher: publish.yml on tousifislam/gw_remnant

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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