Fixed Dataset Training

This module provides the functionality to train a model using a fixed set of parameter - waveform pairs (p_i, w_i).

The first step towards this is to make the parameters into a ParameterSet, and the waveforms into FDWaveforms.

Once these are initialized, they can be used with the make_fixed_generation_pair() function, which will return a FixedParameterGenerator and a FixedWaveformGenerator.

The parameter generator is an iterator, yielding IndexedWaveformParameters; these can be passed to the waveform generator.

The waveform generator will only look at the index to retrieve the correct waveform, and the parameters are kept only for reference.

class IndexedWaveformParameters(index: int, parameter_generator: FixedParameterGenerator, *args, **kwargs)[source]

A simple subclass of WaveformParameters including an extra index, used to communicate information between a FixedParameterGenerator and a FixedWaveformGenerator.

class FixedParameterGenerator(dataset: Dataset, parameter_set: mlgw_bns.dataset_generation.ParameterSet, seed: Optional[int] = None, loop: bool = True)[source]

Generate waveform parameters by going through a fixed list.

Parameters
  • dataset (Dataset) – Reference dataset.

  • parameter_set (ParameterSet) – The parameters which will be sequentially generated.

  • seed (Optional[int], optional) – RNG seed - included for compatibility, do not use. By default None.

    Default: None

parameter_set_cls

alias of mlgw_bns.fixed_dataset_training.IndexedParameterSet

class FixedWaveformGenerator(frequencies: numpy.ndarray, waveforms: mlgw_bns.data_management.FDWaveforms, parameter_generator: mlgw_bns.fixed_dataset_training.FixedParameterGenerator)[source]

Generate waveforms from a given dataset.

Parameters
  • frequencies (np.ndarray) – In natural units.

  • waveforms (FDWaveforms) – Reference waveforms.

  • parameter_generator (FixedParameterGenerator) – Reference parameter generator.

effective_one_body_waveform(params: mlgw_bns.fixed_dataset_training.IndexedWaveformParameters, frequencies: Optional[numpy.ndarray] = None)[source]

Waveform computed according to the comparatively slower effective-one-body method.

Parameters
  • params (WaveformParameters) – Parameters of the binary system for which to generate the waveform.

  • frequencies (np.ndarray, optional) – Frequencies at which to compute the waveform, in natural units. Defaults to None, which means the EOB generator will choose the frequencies at which to compute the waveform.

    Default: None

Returns

  • frequencies (np.ndarray) – Frequencies at which the waveform is given, in natural units: the quantity here is \(Mf\) (with \(G = c = 1\)).

  • amplitude (np.ndarray) – Amplitude of the plus-polarized waveform. The normalization for the amplitude is the same as discussed in post_newtonian_amplitude().

  • phase (np.ndarray) – Phase of the plus-polarized waveform, in radians, given as a continuously-varying array (so, not constrained between 0 and 2pi).

make_fixed_generation_pair(frequencies: np.ndarray, parameter_set: ParameterSet, waveforms: FDWaveforms, reference_mass: float = 2.8) tuple[FixedParameterGenerator, FixedWaveformGenerator][source]

Make a fixed parameter and waveform generator pair.

Parameters
  • frequencies (np.ndarray) – In natural units.

  • parameter_set (ParameterSet) –

  • waveforms (FDWaveforms) –

  • reference_mass (float, optional) – Reference mass in solar masses, by default Dataset.total_mass

    Default: 2.8

Returns

parameter_generator, waveform_generator

Return type

tuple[FixedParameterGenerator, FixedWaveformGenerator]