Run files and CLI
A YAML run file describes a model and what to do with it. Everything in Models and priors and Samplers has a run-file form.
run.yaml
theory:
W0WaCDM: {rdrag: fit, m_nu: 0.06}
likelihood:
DESIDR2BAO: null
PlanckPR4EarlyLCDM: null
params:
h: {prior: {min: 0.5, max: 0.9}, ref: 0.66, latex: h}
omega_b: {prior: {min: 0.018, max: 0.026}, ref: 0.0222}
omega_cdm: {prior: {min: 0.08, max: 0.16}, ref: 0.119}
w0: {prior: {min: -3.0, max: 1.0}, ref: -0.8}
wa: {prior: {min: -3.0, max: 2.0}, ref: -0.7}
Omega_m: # derived: a Defined parameter
value: "lambda h, omega_b, omega_cdm: (omega_b + omega_cdm + 0.06 / 93.14) / h**2"
latex: '\Omega_\mathrm{m}'
sampler:
nuts: {num_warmup: 1000, num_samples: 2000, num_chains: 4}
maximize: {num_starts: 4}
profile: {params: {w0: {min: -1.4, max: -0.2, n: 41}}}
output: chains/run
seed: 0
- A bare number fixes a parameter.
priortakes{min, max}or{dist: norm, loc, scale}. refis the start point.latexis the label.- A
valuelambda defines a parameter from others, asDefineddoes. - Unknown theory and likelihood names are import paths (
module:attribute), so your own classes work. - Several files merge left to right, so a base file plus a variant is two arguments.
Commands
| Command | Does |
|---|---|
cosmonuts install NAME... [--all] [--path P] |
Download datasets |
cosmonuts sample run.yaml |
Sample with the sampler block |
cosmonuts maximize run.yaml |
Best fit, written to <output>.bestfit.yaml |
cosmonuts profile run.yaml |
Profile likelihood |
cosmonuts plot triangle\|trace\|profile\|stats ... |
Figures and tables from saved chains |
cosmonuts info theories\|likelihoods\|samplers |
What a run file can name and set |
cosmonuts sample run.yaml --test # build, evaluate once, stop
cosmonuts sample run.yaml # run
cosmonuts sample run.yaml sampler.nuts.num_samples=200 seed=3 # key.path=value overrides
cosmonuts sample run.yaml --resume # continue; --force overwrites
From Python, config.run does the same as cosmonuts sample.
--device cpu|gpu, --seed and --output override the file.