phenomxpy.phenomt package
Parent class
- class phenomxpy.phenomt.phenomt._PhenomT[source]
Bases:
objectParent class with common methods for the IMRPhenomT family:
IMRPhenomT,IMRPhenomTHM,IMRPhenomTP,IMRPhenomTPHM.- compute_fd_polarizations(f_min_fd=None)[source]
Compute FFT Fourier ransform of the time domain conditioned polarizations hp, hc.
Return only the positive frequencies spectrum since for real time series h(-f)=h*(f).
By default the frequency series starts at 0, but can be changed with the
f_minargument.- Returns:
hp(f), hc(f), frequencies
- Return type:
Tuple of 3 1D ndarrays
- condition_polarizations(hp, hc)[source]
Condition time domain polarizations for proper FFT Fourier Transform.
Two stages conditioning:
Apply tappering at the beginning and a high-pass filter.
Tappering at the end and one cycle at low frequency.
Then resize the series to match the input
delta_fif specified or adjust to a power of 2 length.- Parameters:
hp – 1D arrays with the time series of the polarizations.
hc – 1D arrays with the time series of the polarizations.
resize_series (bool) – If
True, resize the series to match the input delta_f or adjust to a power of 2 length.high_pass_filter_lal (bool) – If
True, apply a high-pass filter using the LALSuite wrapper.
- Returns:
hp(t), hc(t) conditioned polarizations.
- Return type:
Tuple of 2 1D ndarrays
- set_time_array(times=None)[source]
Set time array where to compute hlms and polarizations.
If
timesisNoneanddelta_t>0, compute an internal equispaced time array and stores it asself.times.
IMRPhenomT
- class phenomxpy.phenomt.phenomt.IMRPhenomT(mode=[2, 2], mode22=None, cuda=False, **kwargs)[source]
Bases:
_PhenomTClass for aligned-spin, single harmonic.
Can initialize any harmonic, not only the 22.
The 22 mode is described in [1], while the subdominant modes in [2].
Initialize
pWF,pAmpandpPhaseobjects for a specific harmonic.- Parameters:
mode (list [l,m]) – Indeces for the spherical harmonic to be initialized.
mode22 (IMRPhenomT) – Class with the 22 mode initialized. To be used by the subdominant harmonics.
cuda (bool) – If
True, use GPU and cupy, if not use CPU and numpy.
- pWF
pWF object with common quantities for all modes
- Type:
- pAmp
pAmp object for amplitude coefficients
- Type:
- pPhase
pPhase object for phase coefficients
- Type:
- pPhase22
pPhase object of the 22 mode to be used by higher modes
- Type:
- mode20
Class for the 20 mode
- Type:
phenomxpy.mode20
- compute_hlm(times=None, cache=None, return_cache=False)[source]
Compute hlm mode in time array.
- Parameters:
times (1D ndarray) – Time array where to evaluate the hlm. If None, use the internal one self.times.
cache (Cache) – Cache object with imr_22phase and x_insp, only used for the 22 mode.
return_cache (bool) – If True, return hlm and cache object.
- Returns:
1D ndarray – hlm(t)
(Optionally for the 22 mode)
1Dndarray, Cache – hlm(t), cache object with imr_22phase and x_insp if return_cache=True
- compute_polarizations(times=None)[source]
Compute hp, hc for one mode and its negative counterpart.
- Parameters:
times (1D ndarray or
None) – Time array where to evaluate the polarizations. IfNone, use the internal arryself.times. If notNone, recompute the hlms in the new array.- Returns:
hp(t), hc(t) contribution for one mode and its opposite one
- Return type:
Tuple of 2 1D ndarrays
- static metadata()[source]
IMRPhenomTHM
- class phenomxpy.phenomt.phenomt.IMRPhenomTHM(mode_array=None, add_20_mode=False, cuda=False, pWF_input=None, **kwargs)[source]
Bases:
_PhenomTClass for the IMRPhenomTHM model [2], aligned-spin with subdominant harmonics.
Initialize an
IMRPhenomTclass for each (l,m) harmonic.- Parameters:
mode_array (None, list) – List with the modes to be computed in format [[l,m], [,], …]. If
Noneuse default array (22, 21, 33, 44, 55 and negative moes).add_20_mode (bool) – Add the 20 mode to the list of modes.
cuda (bool) – If
True, use GPU and cupy, if not use CPU and numpy.pWF_input (pWF) – pWF object with common waveform quantities for all the modes.
- phenT_classes
Dictionary with initialiazed
IMRPhenomTclasses for each harmonic. E.g. {‘22’:phen22, ‘21’:phen21, …}. Keys only show positive modes since the class is the same for the negative ones.- Type:
dict
- pWF
pWF object with common quantities for all modes
- Type:
- mode_array
List with the modes to be computed in format [[l,m], [,], …]. For equal black holes cases, odd modes are removed from
mode_array.- Type:
list
- lmax
maximum l in the mode_array
- Type:
int
- times
Internally computed equispaced time array if input time array is
None. Only set if one the evaluation methods is called.- Type:
1D ndarray
- compute_hlms(times=None)[source]
Compute all the hlms modes in a time array.
- Parameters:
times (1D ndarray) – Time array where to evaluate the polarizations. If None, use the internal one self.times.
- Returns:
hlms(t). Each element contains the hlm array for each mode. The keys are the mode strings, e.g. ‘22’, ‘21’, ‘2-2’, etc.
- Return type:
dict
- compute_polarizations(times=None)[source]
Compute hp, hc in a time array.
- Parameters:
times (1D ndarray) – Time array where to evaluate the polarizations. If
None, use the internal oneself.times.compute_hlms_at_once (bool) – If
True, compute all hlms at once and build strain. IfFalse, compute hlms individually in a loop to save memory.
- Returns:
hp(t), hc(t)
- Return type:
Tuple of 2 1D ndarrays
- static metadata()[source]
IMRPhenomTP
IMRPhenomTPHM
- class phenomxpy.phenomt.phenomtp.IMRPhenomTPHM(**kwargs)[source]
Bases:
_PhenomTClass for the IMRPhenomTPHM model [3].
Precessing with subdominant modes in the co-precessing frame
- compute_CPmodes(times=None)[source]
Compute co-precessing modes in a time array
Return dictionary with the co-precessing hlms(t).
- compute_Jmodes(times=None)[source]
Compute hlms(t) in the J-frame
Return dictionary/array with the modes, depending if numba_rotation=False/True.
- compute_L0modes(times=None)[source]
Compute hlms(t) in the L0-frame
Return dictionary/array with the modes, depending if numba_rotation=False/True.
- compute_euler_angles(times=None)[source]
Compute Euler angles alpha, cosbeta, gamma for a time array.
- 3 prescriptions supported:
NNLO
MSA
Numerical/SpinTaylor (default)
- Parameters:
times (1D ndarray) – Time array where to evaluate the angles. If
None, use equispaced gridself.times.- Returns:
\(\\alpha(t)\), \(\cos(\\beta(t))\), \(\\gamma(t)\),
- Return type:
Tuple with 3 1D ndarrays
- compute_polarizations(times=None)[source]
Compute polarizations hp(t), hc(t) in given time array. Equispaced one if
timesisNone.- Parameters:
times (1D ndarray) – Time array where to evaluate the polarizations
polarizations_from ({'L0modes', 'Jmodes', 'CPmodes'}) –
Strategy to compute the polarizations that should return the same output.
LOmodes: method employed in LAL involving two rotations: CP->J, J->L0
Jmodes: similar to PhenomX, rotate modes from CP->J and compute polarizations using theta_JN instead of inclination
CPmodes (default): use efficient method with quaternions from M. Boyle, Appendix B of [4].
use_wigner_from_quaternions (bool) – If
False, then use the method of seobnrv5.compute_CPmodes_at_once (bool) – Compute all the co-precessing modes at once, this is simpler but uses more memory. If False, compute one mode and add its contribution to the polarizations in a loop over modes
compute_ylms_at_once (bool) – Same as for the CPmodes but for the Ylms time series.
- Returns:
hp(t), hc(t) real arrays
- Return type:
Tuple with 2 1D ndarrays
- compute_quaternions(times=None)[source]
Compute quaternions in time array to transform from L to L0 frame and align with the line-of-sight.
For the NNLO and MSA prescriptions, the quaternions are computed from the Euler angles.
For the numerical angles, the default option is to compute them directly from the evolution of the L frame (Z=LNhatev, X=E1ev, Y=ZxX). There is also the option to compute them from the Euler angles. But this involves more computations steps and potential losses of accuracy.
- Parameters:
times (1D ndarray) – Time array to compute quaternions for. If
None, use internal equispaced gridself.times.torch_single_precision (bool) – If
True, use single precision fortorchtensors, slightly faster.
- Returns:
Quaternions evaluated in time array.
- Return type:
(N, 4) ndarray
- static metadata()[source]
phenomxpy.phenomt.internals
- class phenomxpy.phenomt.internals.Cache(**kwargs)[source]
Bases:
objectAuxiliary class to store quantities that will be recycled (e.g. imr_phase22) It transform kwargs into attributes of the object.
- class phenomxpy.phenomt.internals.pAmp(pwf, pphase22)[source]
Bases:
objectClass for computing amplitude coefficients and define amplitude ansatze.
- Parameters:
- _der_complex_amp_orientation(time, return_phase=False)[source]
Compute derivative of complex inspiral amplitude.
Can return the derivative of the absolute value or of the phase.
Derivation in Mathematica.
- Parameters:
time (float or 1D ndarray) – where to evaluate the derivative
return_phase (bool) –
True: return derivative of the phase of the complex amplitude.False: return derivative of the absolutie value
- Returns:
Derivative complex amplitude.
- Return type:
float
- _set_inspiral_coefficients()[source]
Compute coefficients of pseudo-PN terms by solving a system with collocation points.
A c = B A is a matrix with the values of the powers of x at the times of the collocation points. B is a vector with the values of the collocation points: (collocation point fit - pn_ansatz) / fac0 / x c is the solution vector for the free coefficients.
For 3 free coefficients the system is: c1 x1^4 + c2 x1^5 + c3 x1^6 = b1 c1 x2^4 + c2 x2^5 + c3 x2^6 = b2 c1 x3^4 + c2 x3^5 + c3 x3^6 = b3
- _set_inspiral_collocation_points()[source]
Define inspiral collocation points. Set times (-2000, -250, -150)M and read parameter space fits. Fits are for the full strain amplitude without any rescaling.
- _set_inspiral_cut()[source]
Transition time between inspiral and intermediate region for the amplitude (t=-150M).
- _set_intermediate_coefficients()[source]
Compute coefficients for amplitude intermediate ansatz by solving a system with collocation points.
- _set_pn_coefficients()[source]
PN coefficients for complex amplitude
3PN non-spinning Eq 9.4 [5]. 3.5PN non-spinning Eq. 43 :cite:`Faye_2012. 1.5 PN spinning Eq 4.17 [6]. 2 PN spinning Eq. 4.27 :cite:`Buonanno.
Transformation to python code in Mathematica.
There is a factor missing for each mode because they were rotated so that the real part is closer to the absolute value. The factors for each mode to recover the expressions in the paper are: 22 1, 21 i, 33 -i, 44 -1, 55 i. These factors are included through offsets in the phase, see pPhase._set_offsets.
- _set_ringdown_cut()[source]
Transition time between intermediate and ringdown region for the amplitude (from parameter space fits).
- imr_amplitude(times, cache=None)[source]
Amplitude function for full IMR region. Piecewise of inspiral, intermediate and ringdown regions.
- Parameters:
times (float or 1D ndarray) – Times in NR units where to evaluate the ansatz
cache (Cache) – Cache object storing x_insp for the subdominant modes
- Returns:
IMR amplitude for one harmonic.
- Return type:
float or 1Darray
- inspiral_ansatz_amplitude(times, cache=None)[source]
Inspiral ansatz amplitude. PN augmented with 3 pseudo-PN terms. Eq. 14 [2].
The values for x can be read from cache for the subdominant harmonics.
- Parameters:
times (float or 1D ndarray) – Times in NR units where to evaluate the ansatz
cache (Cache) – Cache object storing x_insp for the subdominant modes
- Returns:
Inspiral amplitude
- Return type:
float or 1D ndarray
- class phenomxpy.phenomt.internals.pPhase(pwf, pPhase22=None, omegaCutPNAMP=0, phiCutPNAMP=0)[source]
Bases:
objectClass for computing omega and phase coefficients and define the ansatze.
- Parameters:
pWF (pWF) – pWF structure with waveform parameters
pPhase22 (pPhase) – pPhase object for the 22 mode to be used for the higher modes.
omegaCutPNAMP (float) – Omega contribution from complex amplitude at transtion time
pAmp.inspiral_cut.phiCutPNAMP (float) – Phase contribution from complex amplitude at transtion time
pAmp.inspiral_cut.
- _get_time_of_freq(freq)[source]
Find the time corresponding to an input frequency by numerically solve using imr_omega.
- _set_inspiral_coefficients()[source]
Compute the omega pseudo-PN terms coefficients by solving a system of equations with collocation points. See Eq. 15 [2].
- _set_inspiral_collocation_points()[source]
Define the set of collocation points for omega inspiral See Eq. 11 [2].
- _set_inspiral_cut()[source]
Transition time between inspiral and intermediate regions For the 22= -5/(eta * 0.81^8). For HM = -150.0
- _set_intermediate_coefficients()[source]
Compute coefficients for intermediate ansatz omega by solving a system of equations with collocation points. See Eqs. 28, 29, 31 and surroundings [2].
- _set_offsets()[source]
The PN amplitude coefficients in pAmp._set_pn_coefficients have been multiplied by a factor so that the real part is dominant and positive, approximating the absolute value. The correct complex amplitudes are put back by accordingly correcting the phase. See Eq. 13 in arxiv:2012.11923
E.g.: the complete 21 complex amplitude has a global factor with I. But the PN amplitude coefficient does not have it. An equivalent multiplication by I is achieved by adding pi/2 to the phase.
- _set_phase_continuity()[source]
The phase is the integration of the omega ansatz in each region. Setup the constants of integration so that the phase is continuous between regions.
The intermediate and ringdown regions are shifted respect to the inspiral one.
- _set_pn_coefficients()[source]
Omega PN coefficients for TaylorT3.
Eqs. A5 [1]. Paper misses the term eta3 235925 / 1769472 at 3PN order.
Transformation to python code in Mathematica.
- _set_powers_of_5()[source]
Set useful powers of 5 for phase_inspiral_ansatz. Array stored in self.powers_of_5
- _set_ringdown_cut()[source]
Transition time between intermediate and ringdown regions. Set to zero (peak time of 22).
- imr_omega(times, **kwargs)[source]
Omega function for full IMR region. Piecewise of inspiral, intermediate and ringdown regions.
- Parameters:
times (float or 1D ndarray) – Times in NR units where to evaluate the ansatz
- Returns:
IMR omega.
- Return type:
float or 1D ndarray
- imr_phase(times, cache=None)[source]
Phase function for full IMR region. Piecewise of inspiral, intermediate and ringdown regions.
- Parameters:
times (float or 1D ndarray) – Times in NR units where to evaluate the ansatz
- Returns:
IMR phase.
- Return type:
float or 1D ndarray
- inspiral_ansatz_omega(times)[source]
Inspiral ansatz omega PN ansatz augmented with 6 pseudo-PN terms. Eq. 6b, 7 [2].
- Parameters:
times (float or 1D ndarray) – Times in NR units where to evaluate the ansatz
- Returns:
Inspiral omega.
- Return type:
float or 1D ndarray
- inspiral_ansatz_phase(times, cache=None)[source]
Inspiral ansatz phase. Integration of omega ansatz. For the higher harmonics the 22 phase is rescaled by m/2
- Parameters:
times (float or 1D ndarray) – Times in NR units where to evaluate the ansatz
cache (Cache) – Cache struct storing 22 phase to be used by subdominant harmonics.
- Returns:
Inspiral phase.
- Return type:
float or 1D ndarray
- intermediate_ansatz_omega(times)[source]
Intermediate ansatz omega. Eq. 15 [2].
- Parameters:
times (float or 1D ndarray) – Times in NR units where to evaluate the ansatz
- Returns:
Intermediate omega.
- Return type:
float or 1D ndarray
- intermediate_ansatz_phase(times)[source]
Intermediate ansatz phase. Integration of omega ansatz.
- Parameters:
times (float or 1D ndarray) – Times in NR units where to evaluate the ansatz
- Returns:
Intermediate phase.
- Return type:
float or 1D ndarray
- pn_ansatz_omega(theta)[source]
PN ansatz omega, TaylorT3 based. Eq. 6b [2].
- Parameters:
theta (float or 1D ndarray) – Where to evaluate the ansatz. \(\\theta = (-\eta * t / 5)^{-1/8}\).
- Returns:
TaylorT3 omega.
- Return type:
float or 1D ndarray
- pn_ansatz_phase(thetabar)[source]
PN ansatz phase. Integration of omega ansatz. Only used to compute one value of thetabar needed for
_set_phase_continuity.
- class phenomxpy.phenomt.internals.pWF(eta=None, s1=None, s2=None, f_min=None, f_ref=None, total_mass=0, delta_t=0, delta_f=0, eccentricity=0, mean_anomaly=0, inclination=0, phi_ref=0, polarization_angle=0, distance=0, f_max=None, cuda=False, numba_ansatze=True, condition=False, rtol=1e-12, atol=1e-12, tlow_fit=True, **kwargs)[source]
Bases:
objectStructure storing common waveform quantities and options for all the modes.
- Parameters:
eta (float) – Symmetric mass ratio [0, 0.25].
s1 (floats or (3,) ndarrays) – Spinz components or cartesian spin vectors. s1 corresponds to the most massive object
s2 (floats or (3,) ndarrays) – Spinz components or cartesian spin vectors. s1 corresponds to the most massive object
total_mass (float) – Total mass in solar masses.
f_min (float) – Minimum frequency. In Hz if
total_massis provided, if not in units of mass.f_ref (float) – Reference frequency. In Hz if
total_massis provided, if not in units of mass.delta_t (float) – Time spacing. In seconds if
total_massis provided, if not in units of mass.delta_f (float) – Frequency spacing for Fourier transform in Hz. Only used for conditioning (
condition=True).eccentricity (float) – Initial eccentricity defined at
f_ref. [0, 1]mean_anomaly (float)
inclination (float) – Inclination angle in radians. [0, \(\pi\)]
phi_ref (float) – Azimuthal angle in radians for Ylms defined as \(\pi/2\) -
phi_ref.polarization_angle (float) – Polarization angle in radians.
distance (float) – Distance in Megaparsecs.
cuda (bool) – If True, use cupy if installed to run on the GPU.
numba_ansatze (bool) – When evaluating the ansatze in the full time array, use the numba version. Deactivated when using cuda.
condition (bool) – Compute conditioning parameters and generated conditioned waveforms when evaluated.
rtol (float) – Tolerances used for the solver computing
tminfromf_minandtreffromf_ref.atol (float) – Tolerances used for the solver computing
tminfromf_minandtreffromf_ref.**kwargs – Not used arguments inherited from other class calls
phenomxpy.phenomt.fits
Parameter space fits for collocation points and other quantities.
- phenomxpy.phenomt.fits.IMRPhenomT_fdampfit(finalDimlessSpin, mode)[source]
Damping frequency fundamental mode.
- phenomxpy.phenomt.fits.IMRPhenomT_fdampn2fit(finalDimlessSpin, mode)[source]
Damping frequency of the second overtone
phenomxpy.phenomt.numba_ansatze
Rewrite amplitude, phase ansatze to use numba
There are functions for evaluation in one single point and in a time array, which is parallelize with prange.
Unfortunately this requires some code duplication respect to the ansatze defined in internals.py.
- phenomxpy.phenomt.numba_ansatze.njit_inspiral_22_phase(times, eta, powers_of_5, pn_coefficients, pseudo_pn_coefficients, phOffInsp)[source]
- phenomxpy.phenomt.numba_ansatze.numba_inspiral_22_phase(time, eta, powers_of_5, pn_coefficients, pseudo_pn_coefficients, phOffInsp)[source]
- phenomxpy.phenomt.numba_ansatze.numba_inspiral_ansatz_amplitude(x, fac0, pn_real_coeffs, pn_imag_coeffs, pseudo_pn_coeffs)[source]
- phenomxpy.phenomt.numba_ansatze.numba_inspiral_ansatz_amplitude_array(x, fac0, pn_real_coeffs, pn_imag_coeffs, pseudo_pn_coeffs)[source]
- phenomxpy.phenomt.numba_ansatze.numba_inspiral_ansatz_domega(time, eta, pn_coefficients, coefficients)[source]
- phenomxpy.phenomt.numba_ansatze.numba_inspiral_ansatz_omega(time, eta, pn_coefficients, coefficients)[source]
- phenomxpy.phenomt.numba_ansatze.numba_inspiral_ansatz_omega_array(times, eta, pn_coefficients, pseudo_coefficients)[source]
- phenomxpy.phenomt.numba_ansatze.numba_intermediate_ansatz_amplitude(time, alpha1RD, mergerC1, mergerC2, mergerC3, mergerC4, tshift)[source]
- phenomxpy.phenomt.numba_ansatze.numba_intermediate_ansatz_amplitude_array(times, alpha1RD, mergerC1, mergerC2, mergerC3, mergerC4, tshift)[source]
- phenomxpy.phenomt.numba_ansatze.numba_intermediate_ansatz_omega(times, alpha1RD, omegaPeak, omegaRING, domegaPeak, omegaMergerC1, omegaMergerC2, omegaMergerC3)[source]
- phenomxpy.phenomt.numba_ansatze.numba_intermediate_ansatz_omega_array(times, alpha1RD, omegaPeak, omegaRING, domegaPeak, omegaMergerC1, omegaMergerC2, omegaMergerC3)[source]
- phenomxpy.phenomt.numba_ansatze.numba_intermediate_ansatz_phase(time, alpha1RD, omegaMergerC1, omegaMergerC2, omegaMergerC3, omegaPeak, domegaPeak, omegaRING, phOffMerger)[source]
- phenomxpy.phenomt.numba_ansatze.numba_intermediate_ansatz_phase_array(times, alpha1RD, omegaMergerC1, omegaMergerC2, omegaMergerC3, omegaPeak, domegaPeak, omegaRING, phOffMerger)[source]
- phenomxpy.phenomt.numba_ansatze.numba_pn_ansatz_22_phase(thetabar, eta, powers_of_5, pn_coefficients)[source]
- phenomxpy.phenomt.numba_ansatze.numba_ringdown_ansatz_amplitude(time, c1_prec, c2_prec, c3, c4_prec, alpha1RD_prec, tshift)[source]
- phenomxpy.phenomt.numba_ansatze.numba_ringdown_ansatz_amplitude_array(times, c1_prec, c2_prec, c3, c4_prec, alpha1RD_prec, tshift)[source]
- phenomxpy.phenomt.numba_ansatze.numba_ringdown_ansatz_omega(times, c1, c2, c3, c4, omegaRING)[source]
- phenomxpy.phenomt.numba_ansatze.numba_ringdown_ansatz_omega_array(times, c1, c2, c3, c4, omegaRING)[source]