Source code for GUIBRUSHR.Retrieval.ExofastMCMC.StructReturnExofast

"""
Module containing the StructReturnExofast class for MCMC return data structure.

This module defines a data structure used to store and manage the results
from Exofast MCMC (Markov Chain Monte Carlo) computations.
"""


[docs] class StructReturnExofast: """ Data structure for storing Exofast MCMC return values. This class encapsulates the results from an Exofast MCMC run, including acceptance statistics, parameters, log-likelihood values, and log-prior values. """ # Class attributes initialized to None (default values) naccept = None oldpars = None old_lhood = None # IDL: chi2 (was misnamed; this is log-likelihood, higher = better) # IDL: 'determinant' — renamed log_prior to reflect true semantics # (log of Gaussian prior product; was computed in linear space in IDL, # causing underflow; stored in log-space here for numerical stability) old_log_prior = None
[docs] def __init__(self, naccept, pars, lhood, log_prior): """ Initialize the StructReturnExofast instance. Args: naccept: Number of accepted MCMC steps pars: Current parameter values lhood: Current log-likelihood value # IDL: chi2 log_prior: Log of the Gaussian prior product — IDL called this 'determinant' """ # Store the acceptance count self.naccept = naccept # Store current parameter values self.pars = pars # Store current log-likelihood value (IDL: chi2 — renamed; higher = better) self.lhood = lhood # IDL: chi2 # IDL: self.det = det (product of Gaussian priors, underflows for N≳150 params) # Now stored as log sum: log_prior = Σ -0.5*((θ-μ)/σ)², never underflows self.log_prior = log_prior