gw.waveform_generator.waveform_generator.WaveformGenerator
gw.waveform_generator.waveform_generator.WaveformGenerator(
approximant,
domain,
f_ref,
f_start=None,
mode_list=None,
transform=None,
spin_conversion_phase=None,
**kwargs,
)Generate polarizations using LALSimulation routines in the specified domain for a single GW coalescence given a set of waveform parameters.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| approximant | str | Waveform “approximant” string understood by lalsimulation This is defines which waveform model is used. | required |
| domain | Domain | Domain object that specifies on which physical domain the waveform polarizations will be generated, e.g. Fourier domain, time domain. | required |
| f_ref | float | Reference frequency for the waveforms | required |
| f_start | float | Starting frequency for waveform generation. This is optional, and if not included, the starting frequency will be set to f_min. This exists so that EOB waveforms can be generated starting from a lower frequency than f_min. | None |
| mode_list | List[Tuple] | A list of waveform (ell, m) modes to include when generating the polarizations. | None |
| spin_conversion_phase | float = None | Value for phiRef when computing cartesian spins from bilby spins via bilby_to_lalsimulation_spins. The common convention is to use the value of the phase parameter here, which is also used in the spherical harmonics when combining the different modes. If spin_conversion_phase = None, this default behavior is adapted. For dingo, this convention for the phase parameter makes it impossible to treat the phase as an extrinsic parameter, since we can only account for the change of phase in the spherical harmonics when changing the phase (in order to also change the cartesian spins – specifically, to rotate the spins by phase in the sx-sy plane – one would need to recompute the modes, which is expensive). By setting spin_conversion_phase != None, we impose the convention to always use phase = spin_conversion_phase when computing the cartesian spins. | None |
Attributes
| Name | Description |
|---|---|
| approximant | |
| approximant_str | |
| domain | |
| f_ref | |
| f_start | |
| full_domain | |
| lal_params | |
| spin_conversion_phase | |
| transform |
Methods
| Name | Description |
|---|---|
| generate_FD_modes_LO | Generate FD modes in the L0 frame. |
| generate_FD_waveform | Generate Fourier domain GW polarizations (h_plus, h_cross). |
| generate_TD_modes_L0 | Generate TD modes in the L0 frame. |
| generate_TD_waveform | Generate time domain GW polarizations (h_plus, h_cross) |
| generate_hplus_hcross | Generate GW polarizations (h_plus, h_cross). |
| generate_hplus_hcross_m | Generate GW polarizations (h_plus, h_cross), separated into contributions from |
| setup_mode_array | Define a mode array to select waveform modes |
generate_FD_modes_LO
gw.waveform_generator.waveform_generator.WaveformGenerator.generate_FD_modes_LO(
parameters,
)Generate FD modes in the L0 frame.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| parameters | Dictionary of parameters for the waveform. For details see see self.generate_hplus_hcross. | required |
Returns
| Name | Type | Description |
|---|---|---|
| hlm_fd | dict | Dictionary with (l,m) as keys and the corresponding FD modes in lal format as values. |
| iota | float |
generate_FD_waveform
gw.waveform_generator.waveform_generator.WaveformGenerator.generate_FD_waveform(
parameters_lal,
target_function,
)Generate Fourier domain GW polarizations (h_plus, h_cross).
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| parameters_lal | Tuple | A tuple of parameters for the lalsimulation waveform generator | required |
| target_function | Callable | Lalsimulation function for waveform generation. | required |
Returns
| Name | Type | Description |
|---|---|---|
| pol_dict | Dict[str, np.ndarray] | A dictionary of generated waveform polarizations |
generate_TD_modes_L0
gw.waveform_generator.waveform_generator.WaveformGenerator.generate_TD_modes_L0(
parameters,
)Generate TD modes in the L0 frame.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| parameters | Dictionary of parameters for the waveform. For details see see self.generate_hplus_hcross. | required |
Returns
| Name | Type | Description |
|---|---|---|
| hlm_td | dict | Dictionary with (l,m) as keys and the corresponding TD modes in lal format as values. |
| iota | float |
generate_TD_waveform
gw.waveform_generator.waveform_generator.WaveformGenerator.generate_TD_waveform(
parameters_lal,
)Generate time domain GW polarizations (h_plus, h_cross)
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| parameters_lal | Tuple | A tuple of parameters for the lalsimulation waveform generator | required |
Returns
| Name | Type | Description |
|---|---|---|
| pol_dict | Dict[str, np.ndarray] | A dictionary of generated waveform polarizations |
generate_hplus_hcross
gw.waveform_generator.waveform_generator.WaveformGenerator.generate_hplus_hcross(
parameters,
catch_waveform_errors=True,
)Generate GW polarizations (h_plus, h_cross).
If the generation of the lalsimulation waveform fails with an “Input domain error”, we return NaN polarizations.
Use the domain, approximant, and mode_list specified in the constructor along with the waveform parameters to generate the waveform polarizations.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| parameters | Dict[str, float] | A dictionary of parameter names and scalar values. The parameter dictionary must include the following keys. For masses, spins, and distance there are multiple options. Mass: (mass_1, mass_2) or a pair of quantities from ((chirp_mass, total_mass), (mass_ratio, symmetric_mass_ratio)) Spin: (a_1, a_2, tilt_1, tilt_2, phi_12, phi_jl) if precessing binary or (chi_1, chi_2) if the binary has aligned spins Reference frequency: f_ref at which spin vectors are defined Extrinsic: Distance: one of (luminosity_distance, redshift, comoving_distance) Inclination: theta_jn Reference phase: phase Geocentric time: geocent_time (GPS time) The following parameters are not required: Sky location: ra, dec, Polarization angle: psi Units: Masses should be given in units of solar masses. Distance should be given in megaparsecs (Mpc). Frequencies should be given in Hz and time in seconds. Spins should be dimensionless. Angles should be in radians. | required |
| catch_waveform_errors | Whether to catch lalsimulation errors | True |
Returns
| Name | Type | Description |
|---|---|---|
| wf_dict | Dict[str, np.ndarray] | A dictionary of generated waveform polarizations |
generate_hplus_hcross_m
gw.waveform_generator.waveform_generator.WaveformGenerator.generate_hplus_hcross_m(
parameters,
)Generate GW polarizations (h_plus, h_cross), separated into contributions from the different modes. This method is identical to self.generate_hplus_hcross, except that it generates the individual contributions of the modes to the polarizations and sorts these according to their transformation behavior (see below), instead of returning the overall sum.
This is useful in order to treat the phase as an extrinsic parameter. Instead of {“h_plus”: hp, “h_cross”: hc}, this method returns a dict in the form of {m: {“h_plus”: hp_m, “h_cross”: hc_m} for m in [-l_max,…,0,…,l_max]}. Each key m contains the contribution to the polarization that transforms according to exp(-1j * m * phase) under phase transformations (due to the spherical harmonics).
Note: - pol_m[m] contains contributions of the m modes and and the -m modes. This is because the frequency domain (FD) modes have a positive frequency part which transforms as exp(-1j * m * phase), while the negative frequency part transforms as exp(+1j * m * phase). Typically, one of these dominates [e.g., the (2,2) mode is dominated by the negative frequency part and the (-2,2) mode is dominated by the positive frequency part] such that the sum of (l,|m|) and (l,-|m|) modes transforms approximately as exp(1j * |m| * phase), which is e.g. used for phase marginalization in bilby/lalinference. However, this is not exact. In this method we account for this effect, such that each contribution pol_m[m] transforms exactly as exp(-1j * m * phase). - Phase shifts contribute in two ways: Firstly via the spherical harmonics, which we account for with the exp(-1j * m * phase) transformation. Secondly, the phase determines how the PE spins transform to cartesian spins, by rotating (sx,sy) by phase. This is not accounted for in this function. Instead, the phase for computing the cartesian spins is fixed to self.spin_conversion_phase (if not None). This effectively changes the PE parameters {phi_jl, phi_12} to parameters {phi_jl_prime, phi_12_prime}. For parameter estimation, a postprocessing operation can be applied to account for this, {phi_jl_prime, phi_12_prime} -> {phi_jl, phi_12}. See also documentation of init method for more information on self.spin_conversion_phase.
Differences to self.generate_hplus_hcross: - We don’t catch errors yet TODO - We don’t apply transforms yet TODO
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| parameters | Dict[str, float] | Dictionary of parameters for the waveform. For details see see self.generate_hplus_hcross. | required |
Returns
| Name | Type | Description |
|---|---|---|
| pol_m | dict | Dictionary with contributions to h_plus and h_cross, sorted by their transformation behaviour under phase shifts: {m: {“h_plus”: hp_m, “h_cross”: hc_m} for m in [-l_max,…,0,…,l_max]} Each contribution h_m transforms as exp(-1j * m * phase) under phase shifts (for fixed self.spin_conversion_phase, see above). |
setup_mode_array
gw.waveform_generator.waveform_generator.WaveformGenerator.setup_mode_array(
mode_list,
)Define a mode array to select waveform modes to include in the polarizations from a list of modes.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| mode_list | a list of (ell, m) modes | required |
Returns
| Name | Type | Description |
|---|---|---|
| lal_params | lal.Dict | A lal parameter dictionary |