bahamas_inference¶
BAHAMAS Inference Module This module provides functionality for performing Bayesian inference using various sampling methods. It includes methods for setting up and running inference, as well as plotting results. It is designed to work with the BAHAMAS framework for analyzing gravitational wave signals. It supports both Hamiltonian Monte Carlo (HMC) and nested sampling methods. It also includes functions for loading configuration files, running inference, and saving results.
- Classes:
Method: Handles different methods of inference. BayesianInference: Manages the entire inference process, including loading configurations, running inference, and saving results.
- Usage:
The script can be run from the command line with the following arguments: –config: Path to the YAML configuration file. –sources: Path to the YAML sources file. The script will load the configuration and sources files, run the inference, and save the results.
- class bahamas.bahamas_inference.BayesianInference(config_file, sources_file)¶
Bases:
object
Class to manage the entire Bayesian inference process.
- load_config_files()¶
Load the configuration and sources files.
- run()¶
Run the entire inference process.
- run_inference()¶
Run the inference method.
Returns: - np.ndarray: Posterior samples.
- save_results()¶
Save the posterior samples to a file.
- class bahamas.bahamas_inference.Method(config, log_like, **kwargs)¶
Bases:
object
Class to handle the different methods of inference.
- get_likelihood()¶
Compute and print the marginalized log-likelihood.
- plot_autocorrelation()¶
Create and save an autocorrelation plot of the posterior samples.
- plot_corner()¶
Create and save a corner plot of the posterior samples.
- run()¶
Run the inference method and return the posterior samples.
Returns: - np.ndarray: Posterior samples.
- setup()¶
Set up the inference method based on the sampler specified in the configuration.