phenomxpy.gwsignal_wrapper

Define generators to interface with gwsignal.

class phenomxpy.gwsignal_wrapper.PyIMRPhenomT(**kwargs)[source]

Bases: CompactBinaryCoalescenceGenerator

gwsignal generator wrapper for the IMRPhenomT model.

This is the parent class from which all the other IMRPhenomT* models subclass.

Example usage:

from lalsimulation import gwsignal as gws

gen = PyIMRPhenomT()
hp, hc = gws.core.waveform.GenerateTDWaveform(params, gen)
property duration

Duration of the currently initialized waveform model in seconds.

The approximate end of the waveform is 500M after the peak of the 22 amplitude.

If the model is initialized with a deltaT, the duration includes the last sample.

If the model is initialized without deltaT, the duration still reports 500M after merger but it can be evaluated beyond that time.

property epoch

Start time of the currently initialized waveform model in seconds.

The epoch is the time of the peak of the 22 amplitude.

generate_fd_waveform(**parameters)[source]

Generate frequency domain polarizations given kwargs. The child classes will provide these routines.

Parameters:

polarizations (kwargs required for generation of waveform)

Return type:

Waveform polarizations as implemented in the child class

generate_td_waveform(**parameters)[source]

Generate time domain polarizations given kwargs. The child classes will provide these routines.

Parameters:

polarizations (kwargs required for generation of waveform)

Return type:

Waveform polarizations implemented in the child class

initialize_model(times=None, **parameters)[source]

Initialize the waveform model with the given parameters.

Parameters:
  • times (xp.ndarray) – Time array in seconds. Only used here to check for consistent input parameters.

  • **parameters (dict) – Parameters for the waveform model.

Returns:

True if the model is initialized successfully.

Return type:

bool

property metadata
uniform_time_array(delta_t_sec)[source]

Uniform time array of the currently initialized waveform model in seconds.

The time array is generated on demand, not stored.

Parameters:

delta_t_sec (float) – Time spacing in seconds.

Returns:

Uniform time array in seconds.

Return type:

numpy.ndarray

class phenomxpy.gwsignal_wrapper.PyIMRPhenomTFamily(**kwargs)[source]

Bases: PyIMRPhenomT

gwsignal generator wrapper for the IMRPhenomTFamily.

This class permits to use all the models in the IMRPhenomT family with the same generator. One needs to specify the approximant name in the input parameters.

Example usage:

gen = PyIMRPhenomTFamily()

params["approximant"] = "IMRPhenomTHM"
hp, hc = gws.core.waveform.GenerateTDWaveform(params, gen)

params["approximant"] = "IMRPhenomTPHM"
hp, hc = gws.core.waveform.GenerateTDWaveform(params, gen)
property metadata
class phenomxpy.gwsignal_wrapper.PyIMRPhenomTHM(**kwargs)[source]

Bases: PyIMRPhenomT

gwsignal generator wrapper for the IMRPhenomTHM model.

class phenomxpy.gwsignal_wrapper.PyIMRPhenomTP(**kwargs)[source]

Bases: PyIMRPhenomT

gwsignal generator wrapper for the IMRPhenomTP model.

class phenomxpy.gwsignal_wrapper.PyIMRPhenomTPHM(**kwargs)[source]

Bases: PyIMRPhenomT

gwsignal generator wrapper for the IMRPhenomTPHM model.

phenomxpy.gwsignal_wrapper.convert_params_from_gwsignal(input_params)[source]

Convert gwsignal (astropy dictionary) to phenomxpy.

Parameters are transformed to the units in the default_dict of gwsignal.

Units are removed.

Parameters:

input_params (gwsiganl dictionary) – parameters with astropy units.

Returns:

Parameters in phenomxpy format without units.

Return type:

dict

phenomxpy.gwsignal_wrapper.strip_units(waveform_dict)[source]

Remove units from astropy dictionary.

phenomxpy.gwsignal_wrapper.to_numpy(x)[source]

Convert to numpy array.

phenomxpy.common

Utility functions to interface with external softwares

phenomxpy.common.GeneratePolarizations(parameters={}, approximant='IMRPhenomT', domain='TD', return_generator=False, chunk_options={})[source]

Wrapper function to generate hp, hc in time or frequency domain from different interfaces:

  • LALSuite C interface: use swiglal python wrappers

  • LALSuite gwsignal interface: the lalsuite python interface. Can call phenomxpy, FIXME pyseobnr

  • phenomxpy: use phenomxpy directly.

Parameters:
  • parameters (astropy dict) – Waveform parameters with astropy units and extra options

  • approximant (str) – Approximant name

  • domain ({"TD", "FD"}) – Polarizations in time or frequency domain. Will perform an FFT if using a time domain approximant.

  • return_generator (bool) – Return the class object for the python generator.

Returns:

  • Tuple with 2 gwpy Time(Frequency)Series. – hp, hc: polarizations in time or frequency domain.

  • Optionally also return the python generator object.

phenomxpy.common.bilby_frequency_phenomxpy(frequency_array, mass_1, mass_2, luminosity_distance, a_1, a_2, tilt_1, tilt_2, phi_12, phi_jl, theta_jn, phase, eccentricity=0.0, mean_anomaly=0.0, **kwargs)[source]

frequency_domain_model for bilby waveform generator. Same interface as bilby.gw.source.lal_binary_black_hole.

Parameters:
  • frequency_array (array_like) – The frequencies at which we want to calculate the strain

  • mass_1 (float) – The mass of the heavier object in solar masses

  • mass_2 (float) – The mass of the lighter object in solar masses

  • luminosity_distance (float) – The luminosity distance in megaparsec

  • a_1 (float) – Dimensionless primary spin magnitude

  • tilt_1 (float) – Primary tilt angle

  • phi_12 (float) – Azimuthal angle between the two component spins

  • a_2 (float) – Dimensionless secondary spin magnitude

  • tilt_2 (float) – Secondary tilt angle

  • phi_jl (float) – Azimuthal angle between the total binary angular momentum and the orbital angular momentum

  • theta_jn (float) – Angle between the total binary angular momentum and the line of sight

  • phase (float) – The phase at reference frequency or peak amplitude (depends on waveform)

  • kwargs (dict) – Include parameters like reference_frequency, minimum_frequency and waveform_approximant and any extra option accepted by phenomxpy.

Returns:

{“plus”: hplus, “cross”: hcross} the two polarizations in Fourier domain in an equispaced frequency grid.

Return type:

dictionary

phenomxpy.common.bilby_time_phenomxpy(parameters, **waveform_kwargs)[source]

time_domain_model for bilby waveform generator.