GWForge.conversion

Functions

generate_detector_frame_parameters(samples)

Generate detector frame parameters

get_lambda(file, source_mass)

Retrieve Lambda (tidal deformability) for a given source mass from a data file.

get_safe_signal_durations(mass_1, mass_2, spin_1z, ...)

Calculate the safe signal durations for gravitational waveforms.

time_to_coalescence(frequency, chirp_mass, ...[, mode])

Time remaining to merger at a given frequency, to 3.5PN.

chirp_mass_and_symmetric_mass_ratio(parameters)

Extract (chirp_mass, symmetric_mass_ratio) from a parameter dict.

Module Contents

GWForge.conversion.generate_detector_frame_parameters(samples)[source]

Generate detector frame parameters :param sample: :type sample: dict, pandas.DataFrame

Returns:

output_sample

Return type:

dict, pandas.DataFrame

GWForge.conversion.get_lambda(file, source_mass)[source]

Retrieve Lambda (tidal deformability) for a given source mass from a data file.

Parameters:
  • file (str) – The path to the data file containing mass and Lambda information.

  • source_mass (float) – The mass for which to retrieve the corresponding Lambda.

Returns:

The Lambda value interpolated for the given source mass.

Return type:

float

GWForge.conversion.get_safe_signal_durations(mass_1, mass_2, spin_1z, spin_2z, waveform_minimum_frequency, safety=1.1, approximant='IMRPhenomXPHM')[source]

Calculate the safe signal durations for gravitational waveforms.

Parameters:
  • mass_1 (float or array-like) – The mass of the primary compact object(s) in solar masses.

  • mass_2 (float or array-like) – The mass of the secondary compact object(s) in solar masses.

  • spin_1z (float or array-like) – The z-component of the spin of the primary compact object(s).

  • spin_2z ((float or array-like)) – The z-component of the spin of the secondary compact object(s).

  • (float) (waveform_minimum_frequency) – The minimum frequency of the gravitational waveform.

  • (float (safety) – A safety factor to adjust the calculated durations. [Default: 1.1]

  • optional) – A safety factor to adjust the calculated durations. [Default: 1.1]

  • (str (approximant) – The waveform approximant to use. [Default: ‘IMRPhenomXPHM’]

  • optional) – The waveform approximant to use. [Default: ‘IMRPhenomXPHM’]

Returns:

The safe signal durations in seconds.

Return type:

float or array-like

Raises:
  • ValueError: – If any of the input arrays (mass_1, mass_2, spin_1z, spin_2z) is not a float array.

  • RuntimeError: – If the provided waveform approximant is not supported.

GWForge.conversion.time_to_coalescence(frequency, chirp_mass, symmetric_mass_ratio, mode=2)[source]

Time remaining to merger at a given frequency, to 3.5PN.

This is the time-frequency relation that turns the frequency-domain response into a time-dependent one: the bin at frequency \(f\) is emitted \(\tau(f)\) seconds before merger, so the Earth’s orientation there is the orientation at geocent_time - tau(f).

Uses eq. (3.8b) of arXiv:0907.0700.

Parameters:
  • frequency (array_like) – Frequency in Hz.

  • chirp_mass (float) – Detector-frame chirp mass in solar masses.

  • symmetric_mass_ratio (float) – \(\eta = m_1 m_2 / (m_1+m_2)^2\).

  • mode (int) – Harmonic mode number. Mode m reaches a given frequency when the dominant quadrupole is at \(2f/m\), so tau_m(f) = tau_2(2f/m).

Returns:

Seconds before coalescence, positive and decreasing with frequency.

Return type:

numpy.ndarray

GWForge.conversion.chirp_mass_and_symmetric_mass_ratio(parameters)[source]

Extract (chirp_mass, symmetric_mass_ratio) from a parameter dict.

Accepts any of the mass parameterisations GWForge and bilby pass around: component masses, chirp mass with mass ratio, or chirp mass with symmetric mass ratio.

Returns:

None when the masses cannot be determined – e.g. a custom non-CBC source model – in which case the caller falls back to a static response.

Return type:

tuple of float, or None