From Cobaya Assistant
Cobaya cosmological Bayesian framework — likelihoods, theories, samplers, MCMC/PolyChord, Planck/CLASS/CAMB integration. Use when writing or debugging cobaya YAML, Likelihood subclasses, sampler config, chain analysis with getdist, or cobaya-run/cobaya-install invocations.
How this skill is triggered — by the user, by Claude, or both
Slash command
/cobaya:explainWhen to use
User mentions cobaya, MCMC convergence, Rminus1, Planck likelihoods, classy/camb theory, getdist, chain plotting, derived parameters, external priors, or cobaya-install.
This skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Help the user with the Cobaya Bayesian-analysis framework (docs: https://cobaya.readthedocs.io · source: https://github.com/CobayaSampler/cobaya).
Help the user with the Cobaya Bayesian-analysis framework (docs: https://cobaya.readthedocs.io · source: https://github.com/CobayaSampler/cobaya).
Every cobaya run has four blocks:
params — fixed / sampled (with prior) / derived (lambda or theory output)theory — camb, classy, or a cobaya.theory.Theory subclasslikelihood — built-in (planck_2018_lowl.TT, sn.pantheon) or Likelihood subclassessampler — usually mcmc (Metropolis with covmat learning), polychord for nested, evaluate/minimize otherwiseOutputs land at output: chains/<name> as <name>.{1,2,...}.txt plus .input.yaml, .updated.yaml, .progress.
YAML, run with cobaya-run my.yaml:
likelihood:
gaussian_mixture: { means: [0.2, 0], covs: [[0.1, 0.05], [0.05, 0.2]] }
params:
a: { prior: {min: -0.5, max: 3}, ref: 0.5, proposal: 0.3 }
b: { prior: {dist: norm, loc: 0, scale: 1}, ref: 0, proposal: 0.5 }
sampler:
mcmc: { Rminus1_stop: 0.01, max_tries: 1000, covmat: auto }
output: chains/run1
Python:
from cobaya import run
updated_info, sampler = run(info)
For non-sampling evaluation: cobaya.model.get_model(info).logposterior(params).
from cobaya.likelihood import Likelihood
class MyLike(Likelihood):
sigma: float = 0.1 # class attrs are YAML-overridable
def initialize(self): ... # called once
def get_requirements(self):
return {"Cl": {"tt": 2500}}
def logp(self, **params_values):
cl = self.provider.get_Cl(ell_factor=True)
return float(...)
Wire it in:
likelihood:
my_like:
external: import_module('my_module').MyLike
sigma: 0.05
output_params: [Map_Cl_at_500] # declare any derived it computes
from cobaya.theory import Theory
class MyTheory(Theory):
def get_requirements(self): return {}
def calculate(self, state, want_derived=True, **params_values):
state["my_quantity"] = compute(...)
def get_can_provide(self): return ["my_quantity"]
params:
logA: { prior: {min: 2, max: 4}, ref: {dist: norm, loc: 3.05, scale: 0.001}, proposal: 0.001, drop: true, latex: '\log(10^{10} A_s)' }
A_s: { value: 'lambda logA: 1e-10*np.exp(logA)', latex: 'A_s' }
n_s: { prior: {min: 0.8, max: 1.2}, ref: {dist: norm, loc: 0.96, scale: 0.004}, proposal: 0.002 }
H0: { prior: {min: 40, max: 100}, ref: {dist: norm, loc: 70, scale: 2}, proposal: 2 }
omega_b: { prior: {min: 0.005, max: 0.1}, ref: {dist: norm, loc: 0.0221, scale: 0.0001}, proposal: 0.0001 }
omega_cdm: { prior: {min: 0.001, max: 0.99}, ref: {dist: norm, loc: 0.12, scale: 0.001}, proposal: 0.0005 }
m_ncdm: { renames: mnu, value: 0.06 }
tau_reio: { prior: {min: 0.01, max: 0.8}, ref: {dist: norm, loc: 0.06, scale: 0.01}, proposal: 0.005 }
debug: True in YAMLtheory: {camb: {stop_at_error: True}} to surface theory crashesRminus1_stop for quick tests (0.05 instead of 0.01)covmat: auto to bootstrap from cobaya's cosmology covmat databaseproposal for tight priors, raise max_tries.progress files for acceptance rate (~0.2–0.3 is healthy)from getdist import loadMCSamples
s = loadMCSamples("chains/run1", settings={"ignore_rows": 0.3})
print(s.getTable(limit=1).tableTex())
output: null keeps chains in memory only — they vanish at exitdrop: true prevents a param from being passed to the theory (used for logA when deriving A_s)value and prior on the same paramstop_at_error: false (theory default) silently returns -inf on theory failurerenames: mnu lets one parameter answer to multiple names (cosmology mappings between CAMB and CLASS)theta_MC_100 or theta rather than sampling H0 directly when comparing to Planck<dir>/cobaya/ and run python from <dir>, Python's PEP 420 namespace-package machinery treats cobaya as an empty namespace package shadowing the editable install. Symptoms: cobaya.__file__ is None, dir(cobaya) is empty, from cobaya import LoggedError fails, and downstream packages (e.g. soliket) blow up on import. Fix: cd somewhere without a cobaya/ subdir (/tmp, your workdir, etc.) before invoking python or cobaya-run.Common scenario: a known-good YAML from another machine has absolute paths that don't exist locally. To make it runnable in a self-contained workdir:
<workdir>/reference/<name>.yaml as a read-only baseline.<workdir>/reference/<name>.local.yaml.<workdir>/data/<workdir>/<module>.py and update the dotted refcovmat: → drop it, or point at a covmat copied into <workdir>/reference/output: → <workdir>/chains/<name>.localcd <workdir> before running so vendored modules are importable.cobaya-run --test <…>.local.yaml first — catches all path/import errors in seconds; then run for real.For full YAML schema, all sampler options, PolyChord nested sampling, Planck likelihood module names, and Provider API see reference.md.
Provides UI/UX resources: 50+ styles, color palettes, font pairings, guidelines, charts for web/mobile across React, Next.js, Vue, Svelte, Tailwind, React Native, Flutter. Aids planning, building, reviewing interfaces.
Fetches up-to-date documentation from Context7 for libraries and frameworks like React, Next.js, Prisma. Use for setup questions, API references, and code examples.
npx claudepluginhub borisbolliet/cobaya-claude-plugin --plugin cobaya