/cms:hepdatafrom cms
Helps prepare, validate, and upload HEPData records for CMS papers, PAS, or Open Data studies using hepdata_lib and hepdata-validate. Handles YAML conversion, keywords, qualifiers, asymmetric uncertainties, and common errors.
Ships in cms. 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.
A HEPData record is a submission.yaml, plus one YAML file per table, plus
optional images. Each table has independent variables (x: bins or labels)
and dependent variables (y: values with uncertainties). Build it in Python
with hepdata_lib, check it with hepdata-validate, then upload the
archive to the HEPData sandbox for review.
assets/make_hepdata.py is a tested template with helpers for binned spectra, asymmetric errors, efficiencies and per-category tables. It has NaN and file guards and runs the validator automatically.
summary.json, hist objects, ROOT files) into tables| Piece | What to put there |
|---|---|
| Table | One per figure panel or paper table. Name it after the paper object (Figure 3a). The name becomes the file name. |
description, location | What is shown, the selection and normalisation, and Data from Figure 3a |
| Keywords | observables (e.g. N, EFF, SIG), reactions (P P --> JET JET), cmenergies (13000.0), phrases |
| Independent variable | Bins (low, high) with units, or string labels (categories) |
| Dependent variable | Values plus uncertainties, with qualifiers such as SQRT(S) and the selection/category |
| Uncertainty | Symmetric ±x, or asymmetric (minus, plus) with minus negative. Label stat, syst, or named sources. |
| License | hepdata_lib 0.20 writes CC0 by default. Use table.add_data_license(name, url) to change it per table. |
source /cvmfs/sft.cern.ch/lcg/views/LCG_109/x86_64-el9-gcc15-opt/setup.sh # hepdata_lib 0.20.0 + hepdata-validate
# or: python3 -m pip install hepdata_lib (pulls hepdata-validator)
cp <skill>/assets/make_hepdata.py my_hepdata.py # fill build(); inputs arrive as args.input
python3 my_hepdata.py -o hepdata --input summary.json --input plots --no-tar # TABLES=6 OUTDIR=hepdata VALID=1
python3 <skill>/assets/make_hepdata.py --demo -o /tmp/hd_demo # toy record: shows every helper
The core of a table, with hepdata_lib 0.20:
from hepdata_lib import Submission, Table, Variable, Uncertainty
t = Table("Figure 5a"); t.description = "..."; t.location = "Data from Figure 5a."
t.keywords["observables"] = ["N"]; t.keywords["reactions"] = ["P P --> JET JET"]; t.keywords["cmenergies"] = [13000.0]
x = Variable("$m_{jj}$", is_independent=True, is_binned=True, units="GeV")
x.values = list(zip(edges[:-1], edges[1:]))
y = Variable("Events", is_independent=False, is_binned=False, units="Events") # keywords only in 0.20
y.values = counts
u = Uncertainty("stat", is_symmetric=False); u.values = [(-d, u_) for d, u_ in zip(down, up)]
y.add_uncertainty(u); y.add_qualifier("SQRT(S)", "13000 GeV")
t.add_variable(x); t.add_variable(y); t.add_image("plots/mjj_2b.pdf")
sub = Submission(); sub.add_table(t); sub.create_files("hepdata", remove_old=True)
hist objectsfrom hepdata_lib.hist_utils import create_hist_base_table, hist_as_variable
t = create_hist_base_table("Figure 5a", h, axes_rename={"mjj": "$m_{jj}$"}, axes_units={"mjj": "GeV"})
t.add_variable(hist_as_variable("Data", h, uncertainty={"stat": "poisson_sym"}))
Tested with a Var-axis Weight() histogram. The result validates.
category_x).Table 2).cd hepdata && hepdata-validate -d . # "<dir> is valid", exit 0; run from inside: no absolute paths in the log
tar czf ../submission.tar.gz * # YAML + images; upload this archive
Upload the archive at https://www.hepdata.net/record/sandbox (CERN or ORCID login) and check every table renders. For a CMS paper, the HEPData contact creates the real record. See references/cms-procedure.md.
Variable.__init__() takes 2 positional arguments but 4 were given:
hepdata_lib 0.20 takes keyword arguments only. Older scripts with
Variable("Data", False, False, "Events") break. Write
is_independent=..., is_binned=..., units=....Error: Got unexpected extra argument (dir): the validator takes
hepdata-validate -d <dir> (or -a <archive>), not a positional path.float("nan") is written as .nan and
hepdata-validate says "valid". Empty-denominator efficiencies are the
usual source. Drop the bin or explain it; the template's finite() guard
stops the build.AssertionError: The tar ball is not valid from create_files(): the
YAML was written but fails validation. Run hepdata-validate -d to see the
table, e.g. Inconsistent length of 'values' list: independent_variables [2], dependent_variables [3].submission.tar.gz appears in the current directory, not in the
output directory. The template chdirs to the parent of the output dir.b-tag efficiency vs Z' mass gives
b-tag_efficiency_vs_z'_mass.yaml. Use ASCII without quotes, and name tables
after the paper object. Without a paper (Open Data, a note), use short
descriptive names such as mjj spectrum 2b.add_image writes a PNG and a thumbnail (about
1.2 MB for 6 figures here). Commit them only if the record is meant to be
browsed from the repository.zero_ok=True to the
template's y_var. That sets hepdata_lib's zero_uncertainties_warning=False.Figure 1) if it
shows those. Say which in the description. For low counts, Garwood is the
honest choice.RuntimeError: File plots/x.pdf does not exist! from add_image with
a relative path after a chdir. The template's figure_table makes image
paths absolute when the table is built. Do the same in your own code.phrases (free-text search terms) is a keyword reviewers expect.
figure_table(..., phrases=[...]) sets it.["1 b tag", "2 b tags"]) rather than an encoded integer index.add_image needs ImageMagick (convert) for PDF → PNG and thumbnails.
The LCG view has it.submission.comment
and every description. Never claim a CMS paper identity, and never add a
CMS INSPIRE id to an Open Data study.require_files() them so a missing input fails loudly.figure_table, binned_x, y_var, add_sym, add_asym, category_x,
guards (require_files, finite), --input, --no-tar, --demo,
main(argv) for use from another script, and automatic validation
(VALID=1, exit 0/1/2).What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub cms-ml/marketplace --plugin cms10 skills in this plugin
/analysis-spec-builderUse when a user wants to plan, scope or write down a CMS physics analysis or plotting task before coding it: creating or updating an analysis specification, turning a quick request ("plot the dimuon mass in 2016 data vs DY", "find the best trijet in ttbar") into a structured document, listing datasets, triggers, selections, histograms, corrections and statistical treatment, or producing a specification.md for later implementation./awkward-arrayUse when working with jagged or variable-length arrays in Python with Awkward Array 2 (import awkward as ak): reading CMS NanoAOD or other ROOT ntuples into arrays with uproot, building per-object records with ak.zip, selecting objects or events with masks, counting with ak.num or ak.count, pairing objects with ak.combinations or ak.cartesian (dilepton masses, deltaR, jet cleaning), taking the leading object or argmax per event, following NanoAOD index branches such as Jet_muonIdx1, flattening for histograms, writing Parquet or JSON, or debugging awkward errors such as "cannot slice", "index out of range" or None values appearing in results./cmsswUse when setting up or working inside a CMSSW release area (cmsrel, cmsenv, scram), choosing a CMSSW release or SCRAM_ARCH for a dataset, running an old release inside a cmssw-el7/el8 container, checking out or patching CMSSW packages with git cms-addpkg or git cms-merge-topic, writing or building an EDAnalyzer, EDProducer or EDFilter, writing or debugging a cmsRun Python configuration (_cfg.py, _cfi.py, _cff.py), inspecting EDM ROOT files (MiniAOD, AOD, RECO) with edm* tools, or installing extra Python packages on top of a CMSSW release.Other plugins' skills for the same job