gwkokab.analysis.core.synthetic_pe¶
Attributes¶
Type alias for the error function registry mapping. |
Classes¶
Mixin class that provides a random number generator key and seed management for |
|
Mixin class that provides a random number generator key and seed management for |
Functions¶
|
Calculates the Jensen-Shannon divergence between the discrete and analytical |
|
Build a normalized histogram-based discrete PDF. |
|
Jensen-Shannon divergence using natural log. |
Command-line interface for generating synthetic discrete parameter estimation |
Module Contents¶
- class gwkokab.analysis.core.synthetic_pe.SyntheticAnalyticalPE(filename: str, discrete_waveform: str, coords: tuple[str, Ellipsis] | None = None)¶
Bases:
gwkokab.analysis.core.utils.PRNGKeyMixinMixin class that provides a random number generator key and seed management for classes that require random number generation.
This mixin allows classes to initialize a random key based on a seed and provides a property to access the current random key, which is automatically split to ensure independent random streams across different parts of the code.
- generate_parameter_estimates()¶
- coords = None¶
- discrete_waveform¶
- filename¶
- waveform_name = 'GWKokabSyntheticAnalyticalPE'¶
- class gwkokab.analysis.core.synthetic_pe.SyntheticDiscretePE(filename: str, dataset: Literal['events', 'buffer_events'], error_params_filename: str, size: int, derive_parameters: bool = False, coords: list[str] | None = None, is_delta_error: bool = False)¶
Bases:
gwkokab.analysis.core.utils.PRNGKeyMixinMixin class that provides a random number generator key and seed management for classes that require random number generation.
This mixin allows classes to initialize a random key based on a seed and provides a property to access the current random key, which is automatically split to ensure independent random streams across different parts of the code.
- generate_parameter_estimates()¶
Generates parameter estimates based on the defined error functions.
This method should be implemented in subclasses to generate parameter estimates using the error functions defined in the error_function_registry property.
- coords = None¶
- dataset¶
- derive_parameters = False¶
- property error_function_registry: ErrorFunctionRegistryType¶
Returns a dictionary mapping parameters to their corresponding error functions.
The keys of the dictionary can be either strings representing parameter names, tuples of strings representing multiple parameter names, or instances of the Parameters enum (P) or tuples of such instances. The values are callable functions that define how to apply errors to the corresponding parameters.
- Returns:
A dictionary mapping parameters to their error functions.
- Return type:
- error_params_filename¶
- filename¶
- is_delta_error = False¶
- root_dir¶
- size¶
- waveform_name = 'GWKokabSyntheticDiscretePE'¶
- gwkokab.analysis.core.synthetic_pe.calculate_js_metrics(discrete_samples: numpy.ndarray, analytical_samples: numpy.ndarray, bins: int) numpy.ndarray¶
Calculates the Jensen-Shannon divergence between the discrete and analytical samples for each parameter.
- Parameters:
discrete_samples (np.ndarray) – Discrete samples from the parameter estimation, shape (num_samples, num_parameters).
analytical_samples (np.ndarray) – Analytical samples generated from the error model, shape (num_samples, num_parameters).
bins (int) – Number of bins to use for the histogram estimation of the PDFs.
- Returns:
Array of Jensen-Shannon divergences for each parameter.
- Return type:
np.ndarray
- gwkokab.analysis.core.synthetic_pe.histogram_pdf(samples: numpy.ndarray, bins: int, value_range: tuple[float, float], weights: numpy.ndarray | None = None) tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray]¶
Build a normalized histogram-based discrete PDF.
- gwkokab.analysis.core.synthetic_pe.js_divergence_from_histograms(p: numpy.ndarray, q: numpy.ndarray) numpy.ndarray¶
Jensen-Shannon divergence using natural log.
Range: [0, ln(2)].
- gwkokab.analysis.core.synthetic_pe.synthetic_analytical_pe_main()¶
- gwkokab.analysis.core.synthetic_pe.synthetic_discrete_pe_main()¶
Command-line interface for generating synthetic discrete parameter estimation samples.