Skip to main content
Glama
Weak Lensing Surveys MCP Server

Weak Lensing Surveys MCP Server

measure_shear_correlation

Compute xi+ and xi- cosmic-shear correlation functions per tomographic bin pair from a shear catalogue, with c-term removal, m-bias correction, and optional B-mode null test.

Instructions

Measure xi+(theta) and xi-(theta) per tomographic bin pair from a shear catalogue (optional B-mode test).

Use to turn fetch_shear_catalog output into your own cosmic-shear
data vector. Weighted treecorr GG correlation with per-bin additive
c-term removal and multiplicative-bias correction xi / ((1+m_i)(1+m_j)).
Output CSV has the fetch_wl_datavector layout (bin1, bin2, angbin, x,
value, error) for xip and xim, so plot_shear_correlation and
compare_measured_with_published_xi read it directly. Errors are
shape noise (or jackknife with npatch) and do not include cosmic
variance; a few deg^2 subset gives a noisy, not unbiased-in-area,
estimate vs the 1006 deg^2 release. Sanity: theta*xi+ ~ 1e-4 x
(1-5) arcmin at 10 arcmin for z~0.5-1 pairs (Asgari+21 Fig. 1).
compute_bmodes=True adds *_mapsq_bmodes.csv (bin1, bin2, R_arcmin, mapsq,
mapsq_err, mxsq, mxsq_err, mapmx) and reports chi2(<M_x^2> = 0) per
pair and total (diagonal errors; shape noise only) - a B-mode null
test: PTE > ~0.05 means no detected B modes.
Heavy: with set_dispatch it runs catalogs.kernels.shear_correlation on the facility.

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": {
      "catalog_fits": "<catalog_fits>",
      "output_dir": "<output_dir>"
    },
    "name": "measure_shear_correlation"
  }
}

Input Schema

NameRequiredDescriptionDefault
nbinsNoLog-spaced theta bins (KiDS-1000 release: 9).
npatchNoJackknife patches for errors (0 = shape-noise only; needs >~ 4 deg^2 for >= 10 patches).
max_sepNoMax separation [arcmin] (KiDS-1000 release: 300).
min_sepNoMin separation [arcmin] (KiDS-1000 release: 0.5).
bin_slopNotreecorr bin_slop (accuracy vs speed).
remove_cNoSubtract the weighted mean e1, e2 per bin (additive c-term).
bin_pairsNoTomographic bin pairs, e.g. [[3,3],[4,5]] (default: all auto + cross pairs present).
output_dirYesDirectory where output files are written.
bmode_nbinsNoFine log theta bins for the M_ap conversion.
apply_m_biasNoDivide by (1+m_i)(1+m_j) with the KiDS-1000 per-bin m (Asgari+21 Table 1).
catalog_fitsYesSlim FITS from fetch_shear_catalog (shear catalogue input).
compute_bmodesNoAlso compute aperture-mass E/B modes <M_ap^2>, <M_x^2> (treecorr calculateMapSq, Crittenden filter) and the chi2 of <M_x^2> against zero (B-mode null test).
max_galaxies_per_binNoRandom (seeded) subsample per tomographic bin to keep runtime sane.

Output Schema

NameRequiredDescriptionDefault
filesYes
statusYes
messageYes
metadataYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.2.0

TDQS

A4.4/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 burden and does so: it discloses the estimator (weighted treecorr GG), c-term removal, the exact m-bias division, the error model (shape noise or jackknife, no cosmic variance), the area-dependence caveat against the 1006 deg^2 release, and a numeric sanity check. It also warns the run is heavy and offloads via set_dispatch, and explains what the B-mode files contain and how to read the 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 the first sentence and each subsequent sentence adds distinct information (output layout, error model, caveats, B-mode details, dispatch). It is dense but not padded; the parenthetical asides and long final sentence slightly reduce scannability.

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

Completeness5/5

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

For a 13-parameter, compute-heavy tool with an output schema, the description covers the input provenance, output column layout and file names, statistical caveats, validation guidance, and execution mode. An agent has everything needed to call it correctly and interpret results.

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

Parameters3/5

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

Schema description coverage is 100%, so parameter meaning is already documented; the description only reinforces a few of them (npatch for jackknife errors, compute_bmodes, m-bias correction) without adding new syntax or constraints. Baseline 3 is appropriate when the schema does the heavy lifting.

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 verb and resource: 'Measure xi+(theta) and xi-(theta) per tomographic bin pair from a shear catalogue', plus the optional B-mode extension. This is clearly distinct from siblings such as predict_shear_correlation (forward model) or plot_shear_correlation (visualization).

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

Usage Guidelines4/5

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

'Use to turn fetch_shear_catalog output into your own cosmic-shear data vector' names the upstream producer, and the description states that plot_shear_correlation and compare_measured_with_published_xi consume the output, giving clear placement in a workflow. It stops short of an explicit when-not/alternative rule (e.g. vs predict_shear_correlation), so a 4 rather than a 5.

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