Skip to main content
Glama

compute_cmb_residuals

Compute chi-squared and residuals for CMB bandpower data against an LCDM theory spectrum, using full covariance/windows when available; reports chi2, N, and PTE.

Instructions

chi2 of one experiment's bandpowers against an LCDM theory spectrum, plus residuals.

Uses the full covariance when the release has one (ACT DR6 TT/TE/EE block, all lensing
datasets, with Hartlap factors) and the bandpower windows when available; otherwise the
diagonal errors (Planck/SPT plotting products: chi2 is INDICATIVE, correlations ignored;
Planck unbinned uses the mean of the asymmetric errors). Reports chi2, N, PTE.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "output_dir": "<output_dir>"
    },
    "name": "compute_cmb_residuals"
  }
}

Input Schema

NameRequiredDescriptionDefault
binnedNoPlanck: binned (True) or unbinned (False).
datasetNoSpectrum dataset (lensing datasets use spectrum PP).planck_pr3
ell_maxNoDrop bandpowers above this ell (0 = no cut).
ell_minNoDrop bandpowers below this ell.
spectrumNoTT, TE, EE, BB or PP.TT
output_dirYesDirectory for the residual CSV.
theory_fileNoTheory CSV from compute_lcdm_theory_spectrum; default = bundled Planck 2018 best fit.

Output Schema

NameRequiredDescriptionDefault
filesYes
statusYes
messageYes
metadataYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.3/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full behavioral load and does so well: it explains that full covariance with Hartlap factors is used where available, that bandpower windows are used when present, and that the fallback diagonal-error path for Planck/SPT plotting products yields only an INDICATIVE chi2 with correlations ignored. It also specifies the mean-of-asymmetric-errors convention for unbinned Planck and names the reported quantities (chi2, N, PTE).

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The purpose is front-loaded in one line and the following sentences each carry distinct information about covariance treatment and reported outputs. Density of acronyms (PTE, Hartlap) and unusual line breaks cost a point but nothing is padded.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 7-parameter tool with an output schema, the definition covers the computationally surprising behavior (covariance vs diagonal fallback) and the default theory source, so an agent can call it correctly. Minor gaps remain on error/failure behavior and on how ell_min/ell_max interact with window functions in the covariance path.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3; the description nonetheless adds real meaning beyond the schema by explaining the theory_file default source and by clarifying which dataset families get rigorous versus indicative treatment. It reinforces but does not repeat the schema's notes on binned/unbinned and lensing/PP pairing.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific computation (chi2 plus residuals) on a specific resource (one experiment's bandpowers against an LCDM theory spectrum). This cleanly separates it from siblings like compute_lcdm_theory_spectrum, which only generates the theory spectrum this tool consumes.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Usage is implied rather than stated: the theory_file parameter points at compute_lcdm_theory_spectrum output and notes the bundled Planck 2018 default, which gives a workflow cue. However, there is no explicit when-to-use/when-not statement and no guidance on choosing among datasets or spectra for a given question.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.