/core:anestheticfrom core
Creates publication-quality posterior visualizations (corner plots, marginal distributions) from nested sampling or MCMC chains (PolyChord, MultiNest, UltraNest, Cobaya). Computes Bayesian evidence and KL divergence.
Ships in core. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Anesthetic is a Python package for visualizing and analyzing posterior samples from Bayesian inference. It creates publication-quality corner plots, 1D/2D marginal distributions, and computes Bayesian statistics (evidence, KL divergence) from nested sampling or MCMC chains.
Key capabilities:
Workflow position: This skill provides component (4) Visualization in the physics workflow.
First, ensure anesthetic is installed in your environment:
# Using uv (recommended)
uv pip install anesthetic
# Or using pip
pip install anesthetic
# Or using conda
conda install -c conda-forge anesthetic
Optional for faster KDE: uv pip install fastkde
from anesthetic import read_chains, make_2d_axes
import matplotlib.pyplot as plt
# Load posterior chains (auto-detects format)
samples = read_chains('path/to/chains_root')
# Create corner plot (two-step process)
fig, axes = make_2d_axes(['x0', 'x1', 'x2']) # Create axes first
samples.plot_2d(axes) # Then plot onto them
fig.savefig('corner.png')
plt.close(fig)
Important: Always create axes first with make_2d_axes() or make_1d_axes(), then pass them to plot_2d() or plot_1d(). The plot methods return axes, not (fig, axes) tuples.
read_chains() auto-detects format, or use format-specific readersmake_1d_axes() or make_2d_axes()samples.plot_1d() or samples.plot_2d()Detailed documentation is split by topic:
references/loading-chains.md for all supported formats and creating samples from arraysreferences/plotting-guide.md for 1D/2D plots, plot kinds, and multi-chain comparisonsreferences/customization.md for labels, colors, axes, legends, and reference valuesreferences/statistics.md for Bayesian evidence, KL divergence, and MCMC diagnosticsreferences/api-reference.md for complete function signatures and optionsfrom anesthetic import read_chains, make_2d_axes
samples = read_chains('chains/run')
fig, axes = make_2d_axes(['param1', 'param2', 'param3'])
samples.plot_2d(axes, kind='kde')
fig.savefig('corner.png')
samples = read_chains('chains/run') # NestedSamples
prior = samples.prior()
fig, axes = make_2d_axes(['x0', 'x1', 'x2'])
prior.plot_2d(axes, kind='kde', label='Prior', alpha=0.5)
samples.plot_2d(axes, kind='kde', label='Posterior')
axes.iloc[-1, 0].legend(bbox_to_anchor=(len(axes)/2, len(axes)), loc='lower center')
samples1 = read_chains('chains/model1')
samples2 = read_chains('chains/model2')
fig, axes = make_2d_axes(['x0', 'x1'])
samples1.plot_2d(axes, kind='kde', label='Model 1')
samples2.plot_2d(axes, kind='kde', label='Model 2')
axes.iloc[-1, 0].legend()
samples = read_chains('chains/run') # Must be NestedSamples
print(f"log(Z) = {samples.logZ():.2f}")
print(f"D_KL = {samples.D_KL():.2f}")
# With uncertainties
stats = samples.stats(nsamples=1000)
print(f"log(Z) = {stats['logZ'].mean():.2f} +/- {stats['logZ'].std():.2f}")
# stats is a Samples object, so use anesthetic's plot_2d
stats = samples.stats(nsamples=1000)
fig, axes = make_2d_axes(['logZ', 'D_KL', 'd_G'])
stats.plot_2d(axes)
fig.savefig('stats_corner.png')
fig, axes = make_2d_axes(['x0', 'x1', 'x2'])
samples.plot_2d(axes)
truth = {'x0': 0.3, 'x1': 0.8, 'x2': 0.7}
axes.axlines(truth, color='red', linestyle='--')
axes.scatter(truth, marker='*', s=100, c='red')
A complete example script is available at scripts/example_plots.py. Run it with:
python scripts/example_plots.py path/to/chains_root
This creates corner_plot.png, 1d_marginals.png, and prior_posterior.png.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub fundamental-physics/marketplace --plugin core7 skills in this plugin
/adsUse when the user mentions 'ADS', 'NASA ADS', 'Astrophysics Data System', or asks to search astronomy/astrophysics literature, find papers by bibcode, get citation counts from ADS, or retrieve BibTeX from the ADS database./arxivUse when the user mentions 'arxiv' or asks to find, search for, or download arxiv papers (by arxiv ID, author name, or topic), get paper source code, or retrieve LaTeX files from arxiv. Can search for papers to find arxiv IDs when only author/topic is provided, then download them. Prefer source format over PDF./hepdataUse when the user mentions 'HEPData' or asks to find experimental data, download data tables from HEP papers, get digitized plots, or retrieve cross-section measurements. HEPData contains data points behind figures in high-energy physics publications./inspireUse when the user mentions 'INSPIRE', 'INSPIRE-HEP', 'inspirehep', or asks to search high-energy physics literature, find HEP papers, get citation counts, or retrieve BibTeX from INSPIRE. Specializes in particle physics, quantum field theory, and related fields./science-skill-creatorGuide for creating effective skills for fundamental physics research. This skill should be used when users want to create a new skill (or update an existing skill) that extends Claude's capabilities with specialized scientific knowledge, research workflows, or physics tool integrations./zenodoUse when the user mentions 'Zenodo' or asks to find, search, or download datasets, software, or research artifacts with DOIs. Zenodo hosts scientific datasets, code releases, and supplementary materials from publications.Other plugins' skills for the same job