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.3.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.3-py3-none-any.whl (124.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: phenomxpy-2.0.3.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.3.tar.gz
Algorithm Hash digest
SHA256 5c5bf075028e7b351d9db64d96b1849174ef2c35508944e40fb282de234457f9
MD5 b228825ef8da8551855630d5b515f070
BLAKE2b-256 6f4c04089aef80f62f4e38e139c95b7a7eaa813292cf52a405aae85c8ed13ac2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: phenomxpy-2.0.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 6e70fbbeb471ef486032bd065ea0345ae7c5281b65e07adc46ec940c1fbd781d
MD5 5cd2acd8b32612805aea2bdf48ca9935
BLAKE2b-256 7d04c570bc71682268e6160eb818241d1064fa6e8d0447a1fe3f93ed2a374884

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