Colormap Topology Audit
Certifies which features a colormap invented or destroyed, per observer including CVD.
The problem
Rainbow colormaps like jet put bright bands in the middle of the value scale, so a smooth data field displays with ridges the data does not contain. The visualization literature has documented these false features qualitatively for decades, but a reviewer looking at a figure still cannot say which displayed features are real and which the colormap invented. The answer also changes for color-vision-deficient viewers, who see a different lightness profile through the same colormap.
The method
The tool computes the colormap's perceived Oklab lightness profile L(v) for each observer, applying Machado 2009 CVD simulation first for protan, deutan, and tritan observers at full severity. If L is strictly monotone, the displayed field is a monotone reparametrization of the data, so critical-point structure is preserved exactly; every interior extremum of L turns a data level set into a ridge the viewer sees but the data lacks. It then runs 0-dimensional persistence on the superlevel-set filtration of both the data field and the displayed lightness field, using union-find with the elder rule on a 4-connected grid, and compares feature counts above a persistence threshold. The colormap literature documents rainbow maps inducing false features qualitatively, and TDA uses persistence to separate real features from noise in data; this joins the two into a per-feature certificate.
What it promises
- A faithful verdict requires both a monotone perceived lightness profile and matching significant feature counts between data and display, checked separately for each observer.
- Audits four observers by default: normal vision plus full-severity protan, deutan, and tritan (Machado 2009 simulation).
- Reports every lightness turnaround with its position and prominence, plus spurious and lost feature counts; fails loudly with a DIMENSION error when the field size does not match width times height.
- On the built-in maps the audit finds jet and rainbow distorted while grayscale and viridis are faithful; the companion audit_colormap_corpus tool ranks a whole corpus by worst offender.
Calling it
{
"tool": "audit_colormap_topology",
"arguments": {
"colormap": "jet",
"field": {
"values": "...1024 scalar values...",
"width": 32,
"height": 32
},
"persistence_threshold": 0.02
}
} Clone the repo, run npm install and npm run build in mcp/, then: claude mcp add maryslab -- node mcp/dist/server.js
Known limits
- Persistence is 0-dimensional only: it tracks maxima and the merging of superlevel components, not loops or higher-order structure.
- Built-in colormaps use coarse control points, adequate for lightness-profile analysis but not exact reproductions of the reference implementations.
- It audits colormaps, not decoded figure images; extracting a colormap from a published figure is out of scope for this server.