Model Validation
- class ValidateModel(model: mlgw_bns.model.Model, psd_name: str = 'ET')[source]
Functionality for the validation of a model.
- Parameters
model (Model) – Model to validate.
psd_name (str, optional) – Name of the power spectral density to use in the computation of the mismatches. Currently only ‘ET’ (default) is supported
Default:'ET'- mismatch(waveform_1: numpy.ndarray, waveform_2: numpy.ndarray, frequencies: Optional[numpy.ndarray] = None, max_delta_t: float = 0.07) float[source]
Compute the mismatch between two Cartesian waveforms.
The mismatch between waveforms \(a\) and \(b\) is defined as the minimum value of \(1 - (a|b) / \sqrt{(a|a)(b|b)}\), where the time shift of one of the two waveforms is changed arbitrarily, and where the product \((a|b)\) is the Wiener product.
A custom implementation is used as opposed to the pycbc one since that one is not accurate enough, see this issue.
The implementation here uses scipy’s scalar minimizer to find the minimum of the mismatch.
- Parameters
waveform_1 (np.ndarray) – First Cartesian waveform to compare.
waveform_2 (np.ndarray) – Second Cartesian waveform to compare.
frequencies (np.ndarray, optional) – Frequencies at which the two waveforms are sampled, in Hz. If None (default), it is assumed that the waveforms are sampled at the attribute
frequenciesof this object.Default:Nonemax_delta_t (float, optional) – Maximum time shift for the two waveforms which are being compared, in seconds. Defaults to 0.07.
Default:0.07- mismatch_array(waveform_array_1: FDWaveforms, waveform_array_2: FDWaveforms) list[float][source]
Compute the mismatches between each of the waveforms in these two lists.
- Parameters
waveform_array_1 (FDWaveforms) – First set of waveforms to compare.
waveform_array_2 (FDWaveforms) – Second set of waveforms to compare.
- Returns
Mismatches between the waveforms, in order.
- Return type
- param_set(number_of_parameter_tuples: int, seed: Optional[int] = None) mlgw_bns.dataset_generation.ParameterSet[source]
Generate a random set of parameters, using the parameter generator in
model.dataset.- Parameters
number_of_parameter_tuples (int) – How many tuples of parameters to generate
seed (int, optional) – Seed used to initialize the parameter generator. By default None, which means the seed is computed from the dataset’s default RNG.
Default:None- Returns
A set of uniform parameter tuples
- Return type
- post_newtonian_waveforms(param_set: mlgw_bns.dataset_generation.ParameterSet) mlgw_bns.data_management.FDWaveforms[source]
Waveforms corresponding to the given parameter set, computed according to the post-Newtonian baseline.
- Parameters
param_set (ParameterSet) – Parameters at which to generate the waveforms.
- Returns
PN Waveforms at the given parameters.
- Return type
- predicted_waveforms(param_set: mlgw_bns.dataset_generation.ParameterSet) mlgw_bns.data_management.FDWaveforms[source]
Waveforms corresponding to the given parameter set, reconstruced by the
model.- Parameters
param_set (ParameterSet) – Parameters at which to generate the waveforms.
- Returns
Reconstructed waveforms at the given parameters.
- Return type
- property psd_at_frequencies: Callable[[numpy.ndarray], numpy.ndarray]
Compute the given PSD
- Parameters
frequencies (np.ndarray) – Frequencies at which to compute the PSD, in Hz.
- Returns
Values of the PSD, \(S_n(f_i)\).
- Return type
np.ndarray
- true_waveforms(param_set: mlgw_bns.dataset_generation.ParameterSet) mlgw_bns.data_management.FDWaveforms[source]
Waveforms corresponding to the given parameter set, computed according to the EOB generator.
- Parameters
param_set (ParameterSet) – Parameters at which to generate the waveforms.
- Returns
EOB waveforms at the given parameters.
- Return type
- validation_mismatches(number_of_validation_waveforms: int, seed: Optional[int] = None, true_waveforms: Optional[FDWaveforms] = None, zero_residuals: bool = False) list[float][source]
Validate the model by computing the mismatch between theoretical waveforms and waveforms reconstructed by the model.
- Parameters
number_of_validation_waveforms (int) – How many validation waveforms to use.
true_waveforms (FDWaveforms, optional) – True waveforms to compare to. This parameter should be used in order to not recompute the true waveforms each time when comparing different models; do not use the same waveforms for different models, since the downsampling indices may be different. Defaults to None, which means the true waveforms are recomputed.
Default:Nonezero_residuals (bool, optional) – Whether to set the residuals to zero, meaning that the model is not used at all, instead just comparing the EOB waveforms to the PN baseline. Defaults to False.