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
Fixedare collected intoParsedPrior.fixed_paramsand excluded from the sampling prior.The parser will automatically:
Include all NEP parameters (
_satand_symparameters)Include
nbreakonly ifnb_CSE > 0Add CSE grid parameters (
n_CSE_i_u,cs2_CSE_i) ifnb_CSE > 0
- Parameters:
- Return type:
ParsedPrior- Returns:
ParsedPrior – Parsed prior with sampled
CombinePriorandfixed_paramsdict.- Raises:
FileNotFoundError – If prior file does not exist
ValueError – If prior file format is invalid or no priors found
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 {}