Skip to main content

Waveform generator for IMRPhenom models

Project description

Pipeline Status Docs coverage report

phenomxpy

Python implementation of the IMRPhenomT family of waveform models.

Available both for CPU and GPU.
The CPU version is accelerated with numba by default, the GPU version with cupy.
The parallelization happens at the level of the time array since each time point is independent.

Installation

From PyPI:

pip install phenomxpy

From source:

git clone https://gitlab.com/imrphenom-dev/phenomxpy.git
cd phenomxpy
pip install .

For GPU support, user needs to install cupy according to the CUDA version of their installation (e.g. 12 or 13):

pip install cupy-cuda12x
pip install cupy-cuda13x

The CUDA installation might need cuda-toolkit.

Constants backend

Physical constants can be read from different backends: lisaconstants, astropy or hardcoded.

To change the backend:

from phenomxpy.constants import reset_constants, load_constants
reset_constants()
load_constants("astropy")

or with an evironment variable at kernel initialization:

import os
os.environ["PHENOMXPY_CONSTANTS"] = "astropy"
import phenomxpy

or

PHENOMXPY_CONSTANTS=astropy python myscript.py

If no backend is provided, the priority is: lisaconstants, astropy, hardcoded. If the packages is not installed, it will try the next one

Simple usage

import phenomxpy

# Initialize approximant class
# Available approximants are: IMRPhenomT, IMRPhenomTHM, IMRPhenomTP, IMRPhenomTPHM
phen = IMRPhenomTHM(eta=..., total_mass=..., s1=...., s2=..., f_lower=..., option1=..., option2=...)

# Compute time domain polarizations
hp, hc = phen.compute_polarizations(times)

# Compute Fourier domain polarizations
hpf, hcf, frequencies = phen.compute_fd_polarizations(times)

# Compute individual modes in time domain
hlms = phen.compute_hlms(times)

# In the case of precessing approximants, we can compute modes in different frames
hlms = phen.compute_CPmodes(times)
hlms = phen.compute_Jmodes(times)
hlms = phen.compute_L0modes(times)

The time array times can be a custom array. If None, then it computes an equispaced array with delta_t given in the class initialization.

If total_mass is not provided it assumes input arguments in NR units (i.e. f_lower, delta_t in mass units) and returns the waveform in NR units.

If total_mass and distance are provided, it returns the waveform in SI units.

NOTE: Fourier domain only support SI units.

IMRPhenomT class details

An instance of the IMRPhenomT class initializes the amplitude and phase coefficients of the ansatzes. In this step there is no evaluation on any time array.

phen = IMRPhenomT(waveform parameters and options)

One can generate the hlm mode and the polarizations in a custom time array as

phen.compute_hlm(times)
phen.compute_polarizations(times)

In the initialization of PhenomT, the structures needed for the amplitude and phase coefficients are also initialized:

IMRPhenomT
   - pWF
   - pPhase
   - pAmp

For the initialization of these clases, we employ "internal" methods denoted with an initial underscore, e.g. _set_inspiral_coefficients(). These methods are only employed in the initialization and only called by the __init__ method.

These classes also define the ansatzes for each region, which can be evaluated in a custom time array. E.g.:

pAmp.inspiral_ansatz(times)
pAmp.intermediate_ansatz(times)
pAmp.ringdown_ansatz(times)

and for the full imr region that is a piecewise function of the ansatzes above:

pAmp.imr_amplitude(times)

For the phase and frequency we have e.g.:

pPhase.inspiral_ansatz(times)
pPhase.inspiral_ansatz_omega(times)

pPhase.imr_phase(times)
pPhase.imr_omega(times)

If times=None, then an internally computed equispaced array is used.

The pAmp.imr_amplitude and pPhase.imr_phase are called when evaluating phen.compute_hlm.

Manual docs built

  • sphinx-quickstart
  • sphinx-apidoc -o source/ ../phenomxpy
  • Add extensions and them to the generated conf.py
  • Add modules or other content to index.rst
  • make html

Authors and acknowledgment

Cecilio García Quirós

If you use phenomxpy please cite

@article{79kn-53nt,
  title = {GPU-accelerated LISA parameter estimation with full time-domain response},
  author = {Garc\'{\i}a-Quir\'os, Cecilio and Tiwari, Shubhanshu and Babak, Stanislav},
  journal = {Phys. Rev. D},
  volume = {112},
  issue = {6},
  pages = {064017},
  numpages = {21},
  year = {2025},
  month = {Sep},
  publisher = {American Physical Society},
  doi = {10.1103/79kn-53nt},
  url = {https://link.aps.org/doi/10.1103/79kn-53nt}
}

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

phenomxpy-2.0.2.tar.gz (981.5 kB view details)

Uploaded Source

Built Distribution

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

phenomxpy-2.0.2-py3-none-any.whl (124.3 kB view details)

Uploaded Python 3

File details

Details for the file phenomxpy-2.0.2.tar.gz.

File metadata

  • Download URL: phenomxpy-2.0.2.tar.gz
  • Upload date:
  • Size: 981.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for phenomxpy-2.0.2.tar.gz
Algorithm Hash digest
SHA256 20ba9ee858fafbaf0b56e65848135fedc12eddf916d95104342d3263f743fd1e
MD5 6113ccc48a86b3914791ad1063590483
BLAKE2b-256 87d08379dd29c26cc94a0ba9b45dc384cdc9ddae1c46667e402a8ed5c6930440

See more details on using hashes here.

File details

Details for the file phenomxpy-2.0.2-py3-none-any.whl.

File metadata

  • Download URL: phenomxpy-2.0.2-py3-none-any.whl
  • Upload date:
  • Size: 124.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for phenomxpy-2.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 62c010f9f1cc55189adb3448df921b369905050547f0c1345b986cf2120a8a37
MD5 2b76e5f27d11d6415b2aeec490c832d9
BLAKE2b-256 a05ebcde502fc178471e9da180bdb6f9ba89239498072000d22814f8992036aa

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