sage.data.waveform.approximants.IMRPhenomD
Filename : IMRPhenomD.py Description : Short description of the file
Created on 2026-01-22 10:38:25
__author__ = Narenraju Nagarajan __copyright__ = Copyright 2026, ProjectName __license__ = MIT Licence __version__ = 0.0.1 __maintainer__ = Narenraju Nagarajan __affiliation__ = N/A __email__ = N/A __status__ = [‘inProgress’, ‘Archived’, ‘inUsage’, ‘Debugging’]
GitHub Repository: NULL
Documentation: NULL
Classes
GPU-native batched IMRPhenomD frequency-domain waveform model. |
Module Contents
- class IMRPhenomD(f, f_ref, **kwargs)[source]
Bases:
sage.data.waveform.approximants.phenom.PhenomConstantsGPU-native batched IMRPhenomD frequency-domain waveform model.
Implements the IMRPhenomD aligned-spin binary black hole waveform approximant entirely in PyTorch, allowing batch generation of
(hp, hc)polarisations on GPU without any Python-level loops. Inherits all pre-allocated constants and QNM interpolation tables fromPhenomConstants.The waveform is computed on the frequency grid
fsupplied at construction time. Low-frequency bins belowf[0]are zero-padded so that the output arrays span[0, f_max]inclusive.- Parameters:
f (torch.Tensor, shape
(B, F)) – Frequency grid in Hz for the batch.f_ref (torch.Tensor, shape
(B, 1)) – Reference frequency for the phase calculation.**kwargs – Forwarded to
PhenomConstants.
- get_hphc(theta, reproduce_lal=False)[source]
Compute the FD plus and cross polarisations for a parameter batch.
- Parameters:
theta (torch.Tensor, shape
(B, P)) – Batch of waveform parameters:[m1, m2, chi1, chi2, distance, tc, inclination, ...].reproduce_lal (bool) – If
True, skip FD tapering andtcapplication to reproduce raw LALSuite output (defaultFalse).
- Returns:
hp, hc – Plus and cross polarisations in the frequency domain.
- Return type:
torch.Tensor, shape
(B, F)complex
- apply_tc(hp, hc, tc)[source]
Apply a frequency-domain phase shift equivalent to a time-domain shift by tc.
- pad_missing_frequencies(hp, hc)[source]
Zero-pad hp and hc below
f_min(DC to the starting frequency).
- compute_derived_parameters(theta)[source]
Compute mass-related derived quantities from the parameter batch.
Returns
[m1_s, m2_s, M_s, eta_s]where each column uses SI-scaled masses (m * G / c³).
- get_coeffs(chi1, chi2, eta)[source]
Compute the IMRPhenomD phenomenological coefficient matrix.
Builds monomials in
(chiPN - 1)andetaup to third order, then multiplies by the pre-loaded coefficient table to produce a(B, N_coeffs)tensor of phenomenological fitting coefficients.
- get_components(theta, coeffs, derived)[source]
Compute the amplitude A, phase Psi, and frequency cutoff fcut_true.
Evaluates the full IMRPhenomD frequency-domain waveform components from the parameter batch, phenomenological coefficients, and derived mass quantities. Returns tensors ready for combining into h+ and hx.
- static DPhiMRD(f, coeffs, eta, fx_Ms, Rholm=1.0, Taulm=1.0)[source]
First frequency derivative of PhiMRDAnsatzInt
- get_transition_frequencies(theta, derived, gamma2, gamma3)[source]
Return the six IMRPhenomD transition frequencies
[f1, f2, f3, f4, f_RD, f_damp]in Hz for a parameter batch.
- get_fRD_fdamp(chi1, chi2, m1_s, m2_s, M_s, eta_s)[source]
Return the ringdown frequency and damping frequency by interpolating the pre-loaded QNM table with the final-spin estimate.
- static final_spin_0815_s(eta, S)[source]
Phenomological final-spin fit (Eq. 3.6, arXiv:1508.07250).
- static erad_rational_0815(eta, chi1, chi2)[source]
Rational-function fit for the dimensionless radiated mass (arXiv:1508.07250).
- static get_phi_IIa(f_Ms, eta, coeffs, beta1corr)[source]
IMRPhenomD intermediate-region IIa phase including the
beta1continuity correction.
- static get_IIa_raw_phase(f_Ms, eta, coeffs)[source]
Raw intermediate region IIa phase ansatz (without continuity correction).
- static get_IIb_raw_phase(f_Ms, eta, coeffs, fx_Ms)[source]
Raw merger-ringdown region IIb phase ansatz.
- phase(theta, coeffs, derived, f_Ms, fx_Ms)[source]
Compute the full IMRPhenomD gravitational-wave phase across all frequency regions.
Stitches together inspiral, intermediate (IIa), and merger-ringdown (IIb) phase contributions with C¹-continuity corrections.
- DPhiInsAnsatzInt(fxi_Ms, coeffs, TF2_coeffs, TF2_log_coeffs, eta)[source]
First frequency derivative of PhiInsAnsatzInt
- Parameters:
Mf – Tensor, shape (B,1) or (B,)
coeffs – Tensor, shape (B, Nc)
pn_v – Tensor, shape (B, 8)
pn_vlogv – Tensor, shape (B, 8)
- Returns:
Tensor of same shape as Mf
- static DPhiIntAnsatz(fxi_Ms, coeffs, eta)[source]
First frequency derivative of PhiIntAnsatz
- Parameters:
Mf – tensor of shape (B, 1) or (B,)
coeffs – tensor of shape (B, N) containing beta coefficients
eta – tensor of shape (B, 1) or (B,)
- Returns:
Tensor of same shape as Mf
- static DPhiIntTemp(fxi_Ms, coeffs, eta, beta1corr)[source]
Temporary first frequency derivative of PhiIntAnsatz used to enforce C(1) continuity between regions.
- Parameters:
ff – Tensor of shape (B, 1) or (B,)
coeffs – Tensor of shape (B, N) with PhenomD coefficients
eta – Tensor of shape (B, 1) or (B,)
- Returns:
Tensor of same shape as ff
- spin_spin_3pn_correction(theta, eta_s)[source]
Compute the 3PN spin-spin TaylorF2 correction term subtracted from the PhenomD inspiral phase (LALSimInspiralPNCoefficients.c, v[6]).
- get_inspiral_phase(fxi_Ms, derived, chi, coeffs, phi6corr)[source]
Calculate the inspiral phase for IMRPhenomD exactly equivalent to LAL.
- get_fcut_true(M_s)[source]
Return the physical frequency cutoff in Hz from the dimensionless
fM_CUT.
- amp(f, theta, coeffs, trans_fs, derived, f_Ms, fx_Ms, fcut_true=None)[source]
Computes the amplitude of the PhenomD frequency domain waveform Refer 1508.07253 for more details Note that this waveform also assumes that object one is the more massive.
- get_inspiral_Amp(f_Ms, chi1, chi2, eta_s, coeffs)[source]
Compute the TaylorF2-like inspiral amplitude ansatz (Region I).
Implements the PN series A0…A6 plus three fitted coefficients A7–A9 from LALSimIMRPhenomD_internals.c (lines 302–351).
- Parameters:
f_Ms (torch.Tensor, shape (B, n_freq)) – Dimensionless frequency grid f × M_s.
chi1 (torch.Tensor, shape (B, 1)) – Dimensionless aligned spin of the larger BH.
chi2 (torch.Tensor, shape (B, 1)) – Dimensionless aligned spin of the smaller BH.
eta_s (torch.Tensor, shape (B, 1)) – Symmetric mass ratio.
coeffs (torch.Tensor, shape (B, 7+)) – PhenomD fit coefficients; columns 0–2 are A7, A8, A9.
- Returns:
Amp_Ins – Inspiral amplitude (unnormalised, dimensionless).
- Return type:
torch.Tensor, shape (B, n_freq)
- get_IIa_Amp(f_Ms, fx_Ms, theta, derived, coeffs)[source]
Compute the intermediate (IIa) amplitude via the quintic polynomial ansatz.
Solves for the five delta coefficients by matching the values and first derivatives of the inspiral and merger-ringdown amplitudes at the transition frequencies f1 and f3, then evaluates the quintic.
- Parameters:
f_Ms (torch.Tensor, shape (B, n_freq)) – Dimensionless frequency grid for the IIa region.
fx_Ms (torch.Tensor, shape (B, 8)) – Special frequency scale products (fref, f1, f2, f3, f4, fRD, fdamp, fmid).
theta (torch.Tensor, shape (B, 5+)) – Waveform parameters; columns 2–3 are chi1, chi2.
derived (torch.Tensor, shape (B, 4+)) – Derived parameters; column 3 is eta.
coeffs (torch.Tensor, shape (B, 7+)) – PhenomD fit coefficients.
- Returns:
Amp_IIa – Intermediate amplitude on f_Ms.
- Return type:
torch.Tensor, shape (B, n_freq)
- DAmpInsAnsatz(f, chi1, chi2, eta, coeffs)[source]
Analytical derivative of the Inspiral Amplitude. Matches LALSimIMRPhenomD_internals.c: DAmpInsAnsatz.
- static DAmpMRDAnsatz(f, coeffs, fx_Ms)[source]
EXACT analytical derivative of the MRD Amplitude. Matches LALSimIMRPhenomD_internals.c: DAmpMRDAnsatz exactly.
- static get_IIb_Amp(f_Ms, fx_Ms, coeffs)[source]
Compute the merger-ringdown (IIb) amplitude via the Lorentzian ansatz.
- Parameters:
f_Ms (torch.Tensor, shape (B, n_freq)) – Dimensionless frequency grid for the IIb region.
fx_Ms (torch.Tensor, shape (B, 8)) – Special frequency scale products; columns 5–6 are fRD·M_s and fdamp·M_s.
coeffs (torch.Tensor, shape (B, 7+)) – PhenomD coefficients; columns 4–6 are gamma1, gamma2, gamma3.
- Returns:
Amp_IIb – Merger-ringdown amplitude on f_Ms.
- Return type:
torch.Tensor, shape (B, n_freq)
- static get_delta0(f1, f2, f3, v1, v2, v3, d1, d3)[source]
Compute the δ₀ coefficient of the IIa quintic amplitude polynomial.
- static get_delta1(f1, f2, f3, v1, v2, v3, d1, d3)[source]
Compute the δ₁ coefficient of the IIa quintic amplitude polynomial.
- static get_delta2(f1, f2, f3, v1, v2, v3, d1, d3)[source]
Compute the δ₂ coefficient of the IIa quintic amplitude polynomial.
- static get_delta3(f1, f2, f3, v1, v2, v3, d1, d3)[source]
Compute the δ₃ coefficient of the IIa quintic amplitude polynomial.
- static get_delta4(f1, f2, f3, v1, v2, v3, d1, d3)[source]
Compute the δ₄ coefficient of the IIa quintic amplitude polynomial.
- get_Amp0(f_Ms, eta)[source]
Compute the overall GW amplitude prefactor A₀(f, η).
This is the leading-order Newtonian factor that scales the full PhenomD amplitude: A₀ = (2η/3)^(1/2) × (fM_s)^(-7/6) × π^(-1/6).
- Parameters:
f_Ms (torch.Tensor, shape (B, n_freq)) – Dimensionless frequency f × M_s.
eta (torch.Tensor, shape (B, 1)) – Symmetric mass ratio.
- Returns:
Amp0 – Newtonian amplitude prefactor.
- Return type:
torch.Tensor, shape (B, n_freq)