openghg_inversions.models.priors#
Reusable prior helpers for PyMC model construction.
- openghg_inversions.models.priors.lognormal_mu_sigma(mean: float, stdev: float) tuple[float, float]#
Convert lognormal mean and stdev into PyMC’s
muandsigma.- Parameters:
mean – Requested mean of the lognormal distribution.
stdev – Requested standard deviation of the lognormal distribution.
- Returns:
A
(mu, sigma)tuple suitable forpm.Lognormal.
- openghg_inversions.models.priors.parse_prior(name: str, prior_params: dict[str, str | float | bool], **kwargs) TensorVariable#
Create a continuous PyMC prior from a prior-parameter dictionary.
- Parameters:
name – Name of the user-facing PyMC variable to create.
prior_params – Prior specification including
pdfand any distribution parameters accepted by the chosen PyMC distribution.**kwargs – Additional keyword arguments forwarded to the created PyMC variable, such as
dims.
- Returns:
The created PyMC random variable or deterministic transform.
- Raises:
ValueError – If
prior_params["pdf"]does not name a supported PyMC continuous distribution.
This helper must be called inside an active
pm.Modelcontext because it registers the created variable with the current model.