pybird.likelihood module
- class pybird.likelihood.Likelihood(config, verbose=True)[source]
Bases:
object
EFT Likelihood for cosmological parameter inference.
This class implements the likelihood calculation for the Effective Field Theory of Large Scale Structure, handling multiple sky patches with correlated priors. It supports both marginalized and non-marginalized approaches for EFT nuisance parameters, and can incorporate BAO reconstruction, loop priors, and various optimization techniques.
- y_all
Concatenated data vector across all sky patches.
- Type:
ndarray
- p_all
Block-diagonal precision matrix combining all sky patches.
- Type:
ndarray
- bg_prior_mean
Prior means for marginalized parameters.
- Type:
ndarray
- bg_prior_sigma
Prior widths for marginalized parameters.
- Type:
ndarray
- bng_prior_mean
Prior means for non-marginalized Gaussian parameters.
- Type:
ndarray
- bng_prior_sigma
Prior widths for non-marginalized Gaussian parameters.
- Type:
ndarray
- bnlog_prior_mean
Prior means for log-normal parameters.
- Type:
ndarray
- bnlog_prior_sigma
Prior widths for log-normal parameters.
- Type:
ndarray
- F2_bg_prior_matrix
Prior precision matrix for marginalized parameters.
- Type:
ndarray
- F1_bg_prior_mean
Prior mean vector for marginalized parameters.
- Type:
ndarray
- prior_inv_corr_matrix
Inverse correlation matrix for correlated skies.
- Type:
ndarray
- kin
k-values for Boltzmann solver input.
- Type:
ndarray
- get_chi2_marg()[source]
Compute chi-squared with analytical marginalization over linear parameters.
- loglkl(free_b, free_b_name, cosmo_engine=None, cosmo_module='class', need_cosmo_update=True, cosmo_dict=None, hessian_type=None)[source]
Compute the log-likelihood for a given set of EFT parameters.
This method is the core function that calculates the log-likelihood given a set of EFT parameters while handling cosmological dependencies. It reconstructs theory predictions, calculates chi-squared values (marginalized or non-marginalized), and computes prior contributions.
- Parameters:
free_b (ndarray) – Array of free EFT parameters, potentially including rs_marg parameter at the beginning followed by parameters for each sky patch.
free_b_name (list) – List of names corresponding to free_b parameters.
cosmo_engine (object, optional) – Boltzmann solver instance (CLASS, CPJ, or Symbolic). Defaults to None.
cosmo_module (str, optional) – Type of cosmology calculation (‘class’, ‘taylor’, etc.). Defaults to ‘class’.
need_cosmo_update (bool, optional) – Whether to update cosmological quantities. Defaults to True.
cosmo_dict (dict, optional) – Dictionary of precomputed cosmological quantities. Defaults to None.
hessian_type (str, optional) – Type of Hessian calculation (‘H’, ‘F’, or ‘FH’). Defaults to None.
- Returns:
Log-likelihood value (including priors).
- Return type:
Notes
The free_b array is reshaped into per-sky parameters after extracting any global parameters like alpha_rs if with_rs_marg is True.
For marginalized likelihood, parameters specified in bg_name are analytically marginalized over using Gaussian priors.
When get_maxlkl is True, the marginalized parameters are calculated and stored.
BAO reconstruction alphas are included if with_bao_rec is True.
Loop corrections are included if with_loop_prior is True.