jesterTOV.inference.priors.parser.parse_prior_file

jesterTOV.inference.priors.parser.parse_prior_file#

parse_prior_file(prior_file, nb_CSE=0)[source]#

Parse .prior file (Python format) and return a ParsedPrior.

The prior file should contain Python variable assignments in bilby-style format:

K_sat = UniformPrior(150.0, 300.0, parameter_names=["K_sat"])
Q_sat = UniformPrior(-500.0, 1100.0, parameter_names=["Q_sat"])
nbreak = UniformPrior(0.16, 0.32, parameter_names=["nbreak"])

# Pin a parameter to a fixed value (not sampled):
lambda_BL = Fixed(0.0, parameter_names=["lambda_BL"])

Parameters declared with Fixed are collected into ParsedPrior.fixed_params and excluded from the sampling prior.

The parser will automatically:

  • Include all NEP parameters (_sat and _sym parameters)

  • Include nbreak only if nb_CSE > 0

  • Add CSE grid parameters (n_CSE_i_u, cs2_CSE_i) if nb_CSE > 0

Parameters:
  • prior_file (str or Path) – Path to .prior specification file (Python format)

  • nb_CSE (int, optional) – Number of CSE parameters (0 for MetaModel only)

Return type:

ParsedPrior

Returns:

ParsedPrior – Parsed prior with sampled CombinePrior and fixed_params dict.

Raises:

Examples

>>> result = parse_prior_file("nep_standard.prior", nb_CSE=8)
>>> print(result.prior.n_dim)  # Number of sampled dimensions
25  # 8 NEP + 1 nbreak + 8*2 CSE grid params
>>> print(result.fixed_params)  # Any fixed parameters
{}