GUIBRUSHR.Retrieval.ExofastMCMC.exofast_demc module

EXOFAST DEMC (Differential Evolution Markov Chain) Implementation.

This module implements the DEMC posterior sampling algorithm for parameter estimation in exoplanet fitting. The code maintains the exact logic and sequence of operations from the original implementation while improving readability and documentation.

PARALLEL VERSION: The _initialize_first_chain_step function has been parallelized using multiprocessing.Pool for improved performance on multi-core systems.

GUIBRUSHR.Retrieval.ExofastMCMC.exofast_demc.time_left_units(timeleft)[source]

Convert time in seconds to the most convenient time units.

This function takes a time duration in seconds and converts it to the most appropriate unit (seconds, minutes, hours, or days) for display purposes.

Parameters:

timeleft (float) – Remaining time in seconds.

Returns:

A tuple containing (converted_time, units_string).

Return type:

tuple

GUIBRUSHR.Retrieval.ExofastMCMC.exofast_demc.likelihood(model_obj, dontstop=False, nthin=1, removeburn=True, moresteps=False)[source]

Run a DEMC (Differential Evolution Markov Chain) posterior sampling.

This function implements the main DEMC algorithm for Bayesian parameter estimation. It runs multiple chains in parallel, monitors convergence using Gelman-Rubin statistics, and saves intermediate results.

Parameters:
  • model_obj – Model object containing all necessary data and methods for sampling.

  • dontstop (bool, optional) – If True, continue sampling even after convergence. Default is False.

  • nthin (int, optional) – Thinning factor for the chains. Default is 1.

  • removeburn (bool, optional) – If True, remove burn-in period from final results. Default is True.

  • moresteps (bool, optional) – If True, resume from previous sampling run. Default is False.

Returns:

Final parameter chains and chi-squared values as (pars, chi2).

Return type:

tuple