From e490c7bfd850c7764227d2db3b06528b2b0f203b Mon Sep 17 00:00:00 2001
From: loggger101
Date: Mon, 30 Nov 2026 14:16:42 -0500
Subject: [PATCH] Chart what the catalog knows from a survey, and what it
estimates
coverage.py draws, for each property of AsteroidCatalog's latest release,
the bodies a survey supplied it for (filled) and those the catalog
estimates it for (hollow), on a log scale: every asteroid has an orbit,
9.5% a measured diameter and 524 a measured mass. catalog_profile.py
counts it by hand from the release's parquet into catalog_profile.json,
like the footer's belt, and check.py --fresh turns red when the manifest
the weekly refresh reads names a newer release than the JSON counts.
Co-Authored-By: Claude Opus 5.5
---
README.md | 6 ++
docs/coverage-compact.svg | 90 ++++++++++++++++++
docs/coverage.svg | 100 ++++++++++++++++++++
tools/README.md | 21 ++++-
tools/catalog_profile.json | 82 ++++++++++++++++
tools/catalog_profile.py | 83 +++++++++++++++++
tools/check.py | 22 ++++-
tools/coverage.py | 186 +++++++++++++++++++++++++++++++++++++
tools/panel.py | 2 +-
tools/test_tools.py | 24 +++++
10 files changed, 610 insertions(+), 6 deletions(-)
create mode 100644 docs/coverage-compact.svg
create mode 100644 docs/coverage.svg
create mode 100644 tools/catalog_profile.json
create mode 100644 tools/catalog_profile.py
create mode 100644 tools/coverage.py
diff --git a/README.md b/README.md
index 28416e0..5a40444 100644
--- a/README.md
+++ b/README.md
@@ -74,6 +74,12 @@ The first five repos work together to estimate whether an uncrewed asteroid mini
+**What the catalog knows.** How many of the 1,580,325 asteroids in AsteroidCatalog's data-2026-11-13 have each property from a survey (filled), and how many more the catalog estimates it for (hollow), on a log scale. Every one has an orbit; 149,718 (9.5%) a measured diameter, 46,159 a rotation period and 524 a measured mass, so nearly every mass in it is an estimate from size and taxonomy.
+
+
+
+
+
**What a kilogram is worth.** spacevalue's price for a kilogram of water, iron and platinum at each place you could deliver it, from its latest tables, on a log scale. A filled mark is sold or used where it is, which off Earth saves launching it there; an open one is flown home and sold, less the trip. Water is worth more than platinum on the Moon's surface and on the surface of Mars; on the surface of Mars, platinum is worth nothing, since the trip home costs more than it sells for.
diff --git a/docs/coverage-compact.svg b/docs/coverage-compact.svg
new file mode 100644
index 0000000..3ded9f2
--- /dev/null
+++ b/docs/coverage-compact.svg
@@ -0,0 +1,90 @@
+
diff --git a/docs/coverage.svg b/docs/coverage.svg
new file mode 100644
index 0000000..32369ad
--- /dev/null
+++ b/docs/coverage.svg
@@ -0,0 +1,100 @@
+
diff --git a/tools/README.md b/tools/README.md
index 1f03641..79628b5 100644
--- a/tools/README.md
+++ b/tools/README.md
@@ -20,6 +20,7 @@ Mondays) fetches it again and redraws them.
| landform chart in Planetary science | `refresh_counts.py`, `landforms.py` | the Mars project's `score_metrics_v3_unet.json` and `_svm.json` | weekly |
| sources chart in Space economics | `refresh_counts.py`, `sources.py` | General_Research's `sources.csv`: each source's domain and tier | weekly |
| surveys chart in Space economics | `refresh_counts.py`, `surveys.py` | the manifest of AsteroidCatalog's latest release | weekly |
+| coverage chart in Space economics | `catalog_profile.py`, `coverage.py` | the latest AsteroidCatalog release's parquet (`pyarrow`), counted into `catalog_profile.json` | by hand, with a new catalog release |
| value chart in Space economics | `refresh_counts.py`, `value.py` | the price tables in spacevalue's newest `prices-YYYY-MM-DD` release | weekly |
| launch chart in Space economics | `refresh_counts.py`, `launch.py` | spacecost's `reference/launch_vehicles.csv` | weekly |
| flyby chart | `refresh_flybys.py`, `flybys.py` | NASA/JPL's close-approach API | weekly |
@@ -29,7 +30,7 @@ Run from the repo root. Fetch the data first (each writes `counts.json` and the
alt text):
```bash
-python tools/refresh_counts.py # research sources, agent skills, the catalog's size and surveys, economicspace's destinations, the paper's crossover fits, the sources by domain and tier, the catalog's surveys and their wording, spacevalue's prices, spacecost's launch prices, the Mars maps' scores
+python tools/refresh_counts.py # research sources, agent skills, the catalog's size and surveys, economicspace's destinations, the paper's crossover fits, the sources by domain and tier, the catalog's surveys and their wording, the coverage chart's wording, spacevalue's prices, spacecost's launch prices, the Mars maps' scores
python tools/loc.py # lines of code and total lines per repo, and by language (--public-only skips the private two)
python tools/refresh_activity.py # every commit of mine to each repo, by week, and the latest few (--public-only as above)
python tools/refresh_flybys.py # NASA/JPL's close approaches to Earth for the week ahead
@@ -45,6 +46,7 @@ python tools/crossover.py docs # where the belt turns from S-types to C-
python tools/landforms.py docs # how the Mars project's U-Net and SVM score on each landform, plus -compact
python tools/sources.py docs # General_Research's sources by domain, split by tier, plus -compact
python tools/surveys.py docs # the bodies each survey supplies to the catalog, and its measured diameters, plus -compact
+python tools/coverage.py docs # what the catalog knows from a survey and what it estimates, property by property, plus -compact
python tools/value.py docs # what a kilogram of water, iron and platinum is worth at each of spacevalue's destinations, plus -compact
python tools/launch.py docs # what a kilogram to LEO costs on each rocket any buyer can book, from spacecost, plus -compact
python tools/activity.py docs # every commit so far as orbits, plus -compact
@@ -54,6 +56,7 @@ python tools/flybys.py docs # the week's close approaches, plus -comp
python tools/gallery.py docs/gallery # project cards (three animated) and, into docs/figures, the figure grids; name some (mars sim-launch) to make only those
python tools/banner.py docs # the banner, plus -compact
python tools/typing_line.py docs/typing.svg
+python tools/catalog_profile.py # what a catalog release knows, counted for the coverage chart (needs the release on disk)
python tools/belt_profile.py # the main belt, binned for the footer (needs the release on disk, as gallery.py does)
python tools/footer.py docs # the strip that closes the page, plus -compact
python tools/links.py docs/links # the link buttons (Website, CV, LinkedIn, Kaggle, Contact form)
@@ -90,7 +93,7 @@ OneDrive lock can't leave a file cut off), and if the run stops part way, Ctrl+C
every file it touched goes back as it was. The weekly workflow commits only `README.md`,
`docs/` and `counts.json`, and fails rather than commit if anything else changed.
-The wide panels (activity, languages, break-even, crossover, landforms, sources, surveys, value, launch, flybys, repo diagram) open with
+The wide panels (activity, languages, break-even, crossover, landforms, sources, surveys, coverage, value, launch, flybys, repo diagram) open with
`panel.background` from `panel.py`: the frame, the stars and the reduced-motion rule, which
stops every class a panel names as animated. Change the frame there. `panel.keep_clear`
then takes out the stars that would land on a panel's text or marks; the tiles place theirs
@@ -201,6 +204,20 @@ survey supplies more bodies than the catalog holds, or a count is missing. What
supplies is `SUPPLIES` in `surveys.py`, from the catalog's README; a new survey is drawn
without one. The README's sentence above the chart and its alt text follow a new release.
+`coverage.py` draws what the catalog knows about its asteroids, one row for each property,
+the best known first: the bar is filled gold up to the bodies a survey supplied the
+property for, and runs on hollow to those the catalog estimates it for (a diameter from
+brightness and an assumed albedo, a taxonomy class from albedo or orbit, a mass and a
+density from those), as on the surveys chart. The axis is logarithmic, from 100 bodies to
+just past the whole catalog, since everything has an orbit and only a few hundred bodies
+have a measured mass, the chart's headline. Counting it needs the whole release, so it is
+done by hand, like the footer's belt: download the latest release's
+`asteroid_catalog.parquet` and run `catalog_profile.py` on it with the release's tag, which
+writes `catalog_profile.json` (each property's counts, and which surveys supplied it;
+`PROPERTIES` there says which columns count), then `coverage.py`, which also writes the
+README's sentence and alt text. `check.py --fresh` turns red when the manifest the weekly
+refresh reads names a newer release than the JSON counts.
+
`value.py` draws what spacevalue's price tables say a kilogram is worth at each place they
price it, from Earth's surface out to the surface of Mars, for three things an asteroid
holds: water, iron and platinum (`MATERIALS` in `refresh_counts.py`). That is eight rows, one
diff --git a/tools/catalog_profile.json b/tools/catalog_profile.json
new file mode 100644
index 0000000..4f695e0
--- /dev/null
+++ b/tools/catalog_profile.json
@@ -0,0 +1,82 @@
+{
+ "release": "data-2026-11-13",
+ "rows": 1580325,
+ "properties": {
+ "orbit": {
+ "measured": 1580325,
+ "estimated": null,
+ "providers": {
+ "JPL SBDB": 1580324,
+ "SsODNet": 1
+ }
+ },
+ "brightness": {
+ "measured": 1580319,
+ "estimated": null,
+ "providers": {
+ "JPL SBDB": 1579860,
+ "SsODNet": 228,
+ "NEOWISE": 188,
+ "MP3C": 43
+ }
+ },
+ "proper": {
+ "measured": 1031597,
+ "estimated": null,
+ "providers": {}
+ },
+ "taxonomy": {
+ "measured": 171109,
+ "estimated": 1409216,
+ "providers": {}
+ },
+ "diameter": {
+ "measured": 149718,
+ "estimated": 1430607,
+ "providers": {
+ "JPL SBDB": 139147,
+ "SsODNet": 10418,
+ "MP3C": 149,
+ "shape model": 3,
+ "NEOWISE": 1
+ }
+ },
+ "albedo": {
+ "measured": 149695,
+ "estimated": 1430560,
+ "providers": {
+ "JPL SBDB": 138415,
+ "SsODNet": 11151,
+ "MP3C": 125,
+ "NEOWISE": 4
+ }
+ },
+ "family": {
+ "measured": 139961,
+ "estimated": null,
+ "providers": {}
+ },
+ "rotation": {
+ "measured": 46159,
+ "estimated": null,
+ "providers": {
+ "JPL SBDB": 34563,
+ "SsODNet": 11596
+ }
+ },
+ "mass": {
+ "measured": 524,
+ "estimated": 1579797,
+ "providers": {
+ "SsODNet": 512,
+ "MP3C": 11,
+ "JPL SBDB": 1
+ }
+ },
+ "density": {
+ "measured": 508,
+ "estimated": 1579813,
+ "providers": {}
+ }
+ }
+}
diff --git a/tools/catalog_profile.py b/tools/catalog_profile.py
new file mode 100644
index 0000000..fdbf2a8
--- /dev/null
+++ b/tools/catalog_profile.py
@@ -0,0 +1,83 @@
+"""Count what an AsteroidCatalog release knows about its asteroids (tools/catalog_profile.json),
+for the coverage chart (coverage.py).
+
+For each property in PROPERTIES: how many bodies have a value a survey supplied, which
+surveys supplied them, and how many more the catalog fills in by estimate (a diameter from
+brightness and an assumed albedo, a taxonomy class from albedo or orbit, a mass and a
+density from those). Properties the catalog doesn't estimate have no estimated count.
+
+Run by hand with each new catalog release, like belt_profile.py: it needs the release's
+asteroid_catalog.parquet on disk and pyarrow, which CI hasn't got, so coverage.py reads the
+JSON this writes instead. `check.py --fresh` says when the catalog has a newer release than
+this JSON counts.
+
+ gh release download data-2026-11-13 -R loggger101/AsteroidCatalog -p asteroid_catalog.parquet -D
+ python tools/catalog_profile.py /asteroid_catalog.parquet data-2026-11-13
+"""
+import json
+import sys
+from pathlib import Path
+
+import pyarrow.compute as pc
+import pyarrow.parquet as pq
+
+OUT = Path(__file__).parent / "catalog_profile.json"
+
+# key: (the column that is set where a survey supplied the value, or a boolean column true
+# there; the column naming the survey that supplied it, if the catalog keeps one; the column
+# set wherever the catalog has a value, estimated or not, if it estimates the rest).
+PROPERTIES = {
+ "orbit": ("semi_major_axis_au", "orbit_provider", None),
+ "brightness": ("absolute_magnitude_h", "h_provider", None),
+ "proper": ("proper_semi_major_axis_au", None, None),
+ "taxonomy": ("spectral_complex", None, "spectral_type"),
+ "diameter": ("diameter_provider", "diameter_provider", "diameter_km"),
+ "albedo": ("albedo_provider", "albedo_provider", "albedo_assumed_for_diameter"),
+ "family": ("family", None, None),
+ "rotation": ("rotation_period_provider", "rotation_period_provider", None),
+ "mass": ("mass_measured", "mass_provider", "estimated_mass_kg"),
+ "density": ("density_measured", None, "density_gcm3"),
+}
+
+
+def has(table, column):
+ """Rows where column holds a value: true, for a boolean column."""
+ col = table.column(column)
+ return pc.fill_null(col, False) if col.type == "bool" else pc.is_valid(col)
+
+
+def profile(table):
+ """{key: {measured, estimated, providers}} for each of PROPERTIES."""
+ out = {}
+ for key, (known, provider, filled) in PROPERTIES.items():
+ measured = has(table, known)
+ n = pc.sum(measured).as_py() or 0
+ row = {"measured": n, "estimated": None, "providers": {}}
+ if filled:
+ # Filled in but not supplied: what the catalog estimates.
+ row["estimated"] = pc.sum(pc.and_(has(table, filled), pc.invert(measured))).as_py() or 0
+ if provider:
+ counts = pc.value_counts(pc.filter(table.column(provider), measured)).to_pylist()
+ row["providers"] = {d["values"]: d["counts"] for d in sorted(counts, key=lambda d: -d["counts"]) if d["values"]}
+ out[key] = row
+ return out
+
+
+def main():
+ parquet, release = Path(sys.argv[1]), sys.argv[2]
+ columns = sorted({c for spec in PROPERTIES.values() for c in spec if c} | {"catalog_date"})
+ table = pq.read_table(parquet, columns=columns)
+ dates = pc.unique(table.column("catalog_date")).to_pylist()
+ if len(dates) != 1 or not release.startswith(f"data-{dates[0]}"):
+ sys.exit(f"{parquet.name} was built on {dates}, which isn't release {release}")
+ props = profile(table)
+ if any(p["measured"] > table.num_rows for p in props.values()) or props["orbit"]["measured"] < 0.99 * table.num_rows:
+ sys.exit(f"the counts don't look right: {props}")
+ OUT.write_text(json.dumps({"release": release, "rows": table.num_rows, "properties": props}, indent=1) + "\n",
+ encoding="utf-8", newline="\n")
+ print(f"{OUT.name}: {release}, {table.num_rows:,} rows; "
+ + ", ".join(f"{k} {p['measured']:,}" for k, p in props.items()))
+
+
+if __name__ == "__main__":
+ main()
diff --git a/tools/check.py b/tools/check.py
index 4c359eb..1d44851 100644
--- a/tools/check.py
+++ b/tools/check.py
@@ -9,8 +9,9 @@
2. Every docs/ file the README uses exists, and every file in docs/ is used.
3. The README's numbers are the ones in tools/counts.json: rewriting the README from the
stored counts, with refresh_counts.py's, loc.py's, activity.py's, languages.py's,
- breakeven.py's, crossover.py's, sources.py's, value.py's, launch.py's, flybys.py's and sparks.py's own
- code (the last nine write the images' alt text), changes nothing. And each
+ breakeven.py's, crossover.py's, landforms.py's, sources.py's, surveys.py's, coverage.py's, value.py's,
+ launch.py's, flybys.py's and sparks.py's own code (all but the first two also write the
+ images' alt text), changes nothing. And each
repo's lines of code by language (the languages panel) add up to its lines of code.
4. The typing line's matches the SVG's width, and the Astropy, pygame and
MATLAB badges carry the logos badge_logos.py draws.
@@ -29,6 +30,7 @@
The flyby step may fail without stopping the others, so this is what notices if it
keeps failing; a week the whole refresh missed shows here too. And no phrase in DATED
is still in the README after its last day, so "due 8 December" can't outlive December.
+ And the coverage chart, counted by hand, counts AsteroidCatalog's latest release.
Prints each problem and exits 1 if there are any.
"""
@@ -62,6 +64,7 @@
"landforms.py": ".",
"sources.py": ".",
"surveys.py": ".",
+ "coverage.py": ".",
"value.py": ".",
"launch.py": ".",
"flybys.py": ".",
@@ -144,6 +147,7 @@ def check_counts(readme):
("landforms", lambda m: m.update_readme(readme)),
("sources", lambda m: m.update_readme(readme)),
("surveys", lambda m: m.update_readme(readme)),
+ ("coverage", lambda m: m.update_readme(readme)),
("value", lambda m: m.update_readme(readme)),
("launch", lambda m: m.update_readme(readme)),
("flybys", lambda m: m.update_readme(readme)),
@@ -155,7 +159,7 @@ def check_counts(readme):
continue
if rewritten != readme:
rerun = {"activity": "refresh_activity", "languages": "loc", "breakeven": "refresh_counts",
- "crossover": "refresh_counts", "landforms": "refresh_counts", "sources": "refresh_counts", "surveys": "refresh_counts", "value": "refresh_counts", "launch": "refresh_counts",
+ "crossover": "refresh_counts", "landforms": "refresh_counts", "sources": "refresh_counts", "surveys": "refresh_counts", "coverage": "catalog_profile", "value": "refresh_counts", "launch": "refresh_counts",
"flybys": "refresh_flybys", "sparks": "refresh_activity"}.get(name, name)
problems.append(f"README numbers differ from tools/counts.json (rerun {rerun}.py)")
for repo, n in counts["loc"].items():
@@ -371,6 +375,18 @@ def check_fresh(today=None, readme=None):
age = (today - dt.date.fromisoformat(day)).days
if age > FRESH_DAYS:
problems.append(f"{what} was last refreshed on {day}, {age} days ago: is {step} failing in the weekly workflow?")
+ check_catalog_counted(counts["catalog"]["release"])
+
+
+def check_catalog_counted(latest, counted=None):
+ """The coverage chart counts the catalog's latest release. It is counted by hand from
+ the release's parquet (catalog_profile.py); the weekly refresh reads the latest
+ release's manifest, so it knows when there is a newer one to count."""
+ if counted is None:
+ counted = json.loads((TOOLS / "catalog_profile.json").read_text(encoding="utf-8"))["release"]
+ if counted != latest:
+ problems.append(f"AsteroidCatalog's latest release is {latest}, but the coverage chart counts {counted}: "
+ "download its parquet and rerun catalog_profile.py, then coverage.py")
# LinkedIn answers every script with 999; a 999 from it says nothing about the link.
diff --git a/tools/coverage.py b/tools/coverage.py
new file mode 100644
index 0000000..a025e23
--- /dev/null
+++ b/tools/coverage.py
@@ -0,0 +1,186 @@
+"""Generate the coverage chart (docs/coverage.svg, docs/coverage-compact.svg): what
+AsteroidCatalog knows about its asteroids from a survey, property by property, and what it
+estimates for the rest.
+
+Each row is a property, the best known first. Its bar is filled gold up to the bodies a
+survey supplied it for, and runs on hollow to the bodies the catalog estimates it for (a
+diameter from brightness and an assumed albedo, a taxonomy class from albedo or orbit, a
+mass and a density from those), as on the surveys chart, so the two read apart without
+colour. The axis is logarithmic, since the counts run from every body down to a few hundred
+measured masses, and a dashed line marks the whole catalog.
+
+The numbers are catalog_profile.py's, counted from a release's parquet by hand and kept in
+tools/catalog_profile.json, so this draws the same thing until the next release is counted;
+`check.py --fresh` says when one is out. When the chart loads the bars grow from the left,
+a row at a time; with reduced motion they are drawn finished.
+
+`coverage.svg` is for desktop widths. `coverage-compact.svg` drops the shares and the
+descriptions and uses larger text, for phones; the README swaps it in with .
+"""
+import html
+import json
+import math
+import re
+import sys
+from pathlib import Path
+
+import panel
+
+FONT = "'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif"
+TEXT, DIM, GOLD, LABEL = "#dbe3f5", "#7d8fb3", "#e8c27a", "#b9c6e4"
+SMALL = panel.SMALL
+
+PROFILE = json.loads((Path(__file__).parent / "catalog_profile.json").read_text(encoding="utf-8"))
+RELEASE, ROWS = PROFILE["release"], PROFILE["rows"]
+# Each property's name on the chart, and on phones.
+NAMES = {
+ "orbit": ("Orbit", "Orbit"),
+ "brightness": ("Brightness (H)", "Brightness"),
+ "proper": ("Proper elements", "Proper orbit"),
+ "taxonomy": ("Taxonomy class", "Taxonomy"),
+ "diameter": ("Diameter", "Diameter"),
+ "albedo": ("Albedo", "Albedo"),
+ "family": ("Collisional family", "Family"),
+ "rotation": ("Rotation period", "Rotation"),
+ "mass": ("Mass", "Mass"),
+ "density": ("Density", "Density"),
+}
+PROPS = sorted(({"key": k, **p} for k, p in PROFILE["properties"].items()), key=lambda p: (-p["measured"], p["key"]))
+MASS = PROFILE["properties"]["mass"]
+LO, HI = 100, ROWS * 1.15 # the axis, in bodies: the whole catalog near its end
+TICKS = {100: "100", 1_000: "1k", 10_000: "10k", 100_000: "100k", 1_000_000: "1M"}
+
+
+def name(key, full=True):
+ return NAMES.get(key, (key.replace("_", " ").capitalize(),) * 2)[0 if full else 1]
+
+
+def pct(n, of=ROWS):
+ """A share as the profile writes it: 100%, >99.9% for all but a few, 9.5%, 0.033%."""
+ v = 100 * n / of
+ return "100%" if n == of else ">99.9%" if v >= 99.95 else f"{v:.1f}%" if v >= 0.95 else f"{v:.2g}%"
+
+
+def short(n):
+ return f"{n / 1e6:.2f}M" if n >= 1e6 else f"{n / 1e3:.0f}k" if n >= 1e3 else f"{n}"
+
+
+def how_many(n, of):
+ return "every one" if n == of else f"{n:,}"
+
+
+def sentence(profile):
+ """The README's sentence on the chart, after its bold lead, from the numbers."""
+ rows, p = profile["rows"], profile["properties"]
+ return (f"How many of the {rows:,} asteroids in AsteroidCatalog's {profile['release']} have each property from a "
+ f"survey (filled), and how many more the catalog estimates it for (hollow), on a log scale. "
+ f"{how_many(p['orbit']['measured'], rows)[:1].upper() + how_many(p['orbit']['measured'], rows)[1:]} has an "
+ f"orbit; {p['diameter']['measured']:,} ({pct(p['diameter']['measured'], rows)}) a measured diameter, "
+ f"{p['rotation']['measured']:,} a rotation period and {p['mass']['measured']:,} a measured mass, so nearly "
+ f"every mass in it is an estimate from size and taxonomy.")
+
+
+ALT = (f"What AsteroidCatalog's {RELEASE} release knows about its {ROWS:,} asteroids from a survey, and what it estimates: "
+ + "; ".join(f"{name(p['key'])} {p['measured']:,} from a survey ({pct(p['measured'])})"
+ + (f", {p['estimated']:,} more estimated" if p["estimated"] else "") for p in PROPS) + ".")
+
+
+def background(w, h, seed):
+ return panel.background(w, h, seed, ALT, rules=panel.GROW, animated=("grow",))
+
+
+def render(w, seed, pad, big, size, row_gap, name_w, count_w, full):
+ small = size * SMALL
+ head = pad + big * 0.8
+ top = head + size * 2.6 + row_gap * 1.6
+ bottom = top + (len(PROPS) - 1) * row_gap + row_gap * 0.6
+ h = round(bottom + size * 4.6 + pad * 0.6)
+ x0 = pad + name_w
+ track = w - pad - count_w - x0
+ at = lambda n: x0 + track * (math.log10(max(n, LO)) - math.log10(LO)) / (math.log10(HI) - math.log10(LO))
+ bar = size * 0.62
+ parts = [background(w, h, seed), f'',
+ f'{MASS["measured"]:,}',
+ f''
+ + html.escape(f"of the catalog's {ROWS:,} asteroids have a measured mass; it estimates the rest"
+ if full else f"of {short(ROWS)} asteroids have a measured mass", quote=False) + '',
+ f''
+ + html.escape(f"AsteroidCatalog {RELEASE}: each property from a survey (filled) or estimated (hollow), "
+ "bodies on a log scale." if full else f"{RELEASE}, log scale:", quote=False) + '']
+ upper = top - row_gap * 0.6
+ # The scale, with faint guides up through the rows, and the whole catalog dashed.
+ for v, label in TICKS.items():
+ x = at(v)
+ parts.append(f'')
+ parts.append(f'{label}')
+ parts.append(f'')
+ parts.append(f'{"the whole catalog" if full else "all"}')
+ for k, p in enumerate(PROPS):
+ y = top + k * row_gap
+ parts.append(f''
+ f'{html.escape(name(p["key"], full))}')
+ parts.append(f'')
+ xm = at(p["measured"])
+ parts.append(f'')
+ if p["estimated"]:
+ xe = at(p["measured"] + p["estimated"])
+ if xe - xm > 4:
+ parts.append(f'')
+ parts.append("")
+ ty = y + size * 0.35
+ if full:
+ parts.append(f'{p["measured"]:,}')
+ parts.append(f''
+ f'{pct(p["measured"])}')
+ else:
+ parts.append(f''
+ f'{short(p["measured"])}')
+ # What the two parts of a bar are.
+ ly = bottom + size * 3.5
+ s = size * 0.8
+ parts.append(f'')
+ parts.append(f''
+ + ("from a survey" if full else "survey") + '')
+ lx = pad + size * (9 if full else 5.6)
+ parts.append(f'')
+ parts.append(f''
+ + ("estimated by the catalog: a size from brightness, a class from albedo or orbit, a mass from both"
+ if full else "estimated") + '')
+ parts.append("\n\n")
+ return panel.keep_clear("\n".join(parts), pad=24)
+
+
+def update_readme(readme):
+ """The README with this chart's alt text written in, and the sentence above it, so the
+ prose follows a newly counted release. check.py checks it."""
+ readme = panel.write_alt(readme, "coverage.svg", ALT)
+ readme, n = re.subn(r"(?m)^(\*\*What the catalog knows\.\*\* ).*$", lambda m: m[1] + sentence(PROFILE), readme)
+ if n != 1:
+ sys.exit(f"README's sentence above the coverage chart matched {n} times, expected 1")
+ return readme
+
+
+def files():
+ return {
+ "coverage.svg": render(1200, 71, 40, 52, 19, 40, 220, 190, True),
+ "coverage-compact.svg": render(680, 72, 36, 60, 24, 46, 170, 90, False),
+ }
+
+
+def main():
+ out = Path(sys.argv[1])
+ out.mkdir(parents=True, exist_ok=True)
+ for file, svg in files().items():
+ (out / file).write_text(svg, encoding="utf-8", newline="\n")
+ print(file)
+
+
+if __name__ == "__main__":
+ main()
diff --git a/tools/panel.py b/tools/panel.py
index 6cffecb..28028f6 100644
--- a/tools/panel.py
+++ b/tools/panel.py
@@ -1,4 +1,4 @@
-"""The frame the profile's wide panels share: activity.py, breakeven.py, crossover.py,
+"""The frame the profile's wide panels share: activity.py, breakeven.py, coverage.py, crossover.py,
flybys.py, landforms.py, languages.py, pipeline.py, sources.py, surveys.py, value.py and launch.py all start their SVG with `background`, and all but
pipeline.py write their alt text into the README with `write_alt`.
diff --git a/tools/test_tools.py b/tools/test_tools.py
index 836bb9e..d3f7572 100644
--- a/tools/test_tools.py
+++ b/tools/test_tools.py
@@ -181,6 +181,24 @@ def MANIFEST(**over):
eq("README sentence follows", sv.sentence(sv.CATALOG) in sv.update_readme(profile), True)
stops("README sentence gone", sv.update_readme, profile.replace("**What the catalog is built from.**", "**What it's built from.**"))
+# What the catalog knows (catalog_profile.json, counted by hand) and what the coverage
+# chart says of it (coverage.py).
+cv = load("coverage")
+PROP = lambda measured, estimated=None: {"measured": measured, "estimated": estimated, "providers": {}}
+KNOWN = {"release": "data-2026-11-13", "rows": 1000, "properties": {
+ "orbit": PROP(1000), "diameter": PROP(95, 905), "rotation": PROP(30), "mass": PROP(2, 998)}}
+eq("coverage sentence", cv.sentence(KNOWN),
+ "How many of the 1,000 asteroids in AsteroidCatalog's data-2026-11-13 have each property from a survey (filled), "
+ "and how many more the catalog estimates it for (hollow), on a log scale. Every one has an orbit; 95 (9.5%) a "
+ "measured diameter, 30 a rotation period and 2 a measured mass, so nearly every mass in it is an estimate from "
+ "size and taxonomy.")
+eq("not every orbit", cv.sentence({**KNOWN, "properties": {**KNOWN["properties"], "orbit": PROP(999)}}).split(". ")[1][:22],
+ "999 has an orbit; 95 (")
+eq("coverage shares", [cv.pct(n, 1580325) for n in (1580325, 1580319, 149718, 524)], ["100%", ">99.9%", "9.5%", "0.033%"])
+eq("an unnamed property is named from its key", cv.name("spin_axis"), "Spin axis")
+eq("README sentence follows", cv.sentence(cv.PROFILE) in cv.update_readme(profile), True)
+stops("README sentence gone", cv.update_readme, profile.replace("**What the catalog knows.**", "**What it knows.**"))
+
# The Mars project's landform scores (refresh_counts.py) and what the chart says of them
# (landforms.py), so a rescored map can't leave the old words, and a score file that grows
# a second held-out map, or scores the two on different polygons, stops the refresh.
@@ -356,6 +374,12 @@ def badge(label):
ck.check_fresh(today=last + dt.timedelta(days=1), readme="the paper, handed in.")
eq("dated phrase rewritten", [p for p in ck.problems if "true only until" in p], [])
ck.problems.clear()
+# The coverage chart, counted by hand, is flagged once the catalog has a newer release.
+ck.check_catalog_counted("data-2026-11-13", counted="data-2026-11-13")
+eq("coverage counts the latest release", ck.problems, [])
+ck.check_catalog_counted("data-2026-12-04", counted="data-2026-11-13")
+eq("a newer release flagged", ["data-2026-12-04" in p and "catalog_profile.py" in p for p in ck.problems], [True])
+ck.problems.clear()
# Quoted figures (check.py FACTS): the README holds each phrase; a source that drops its
# figure, or can't be read, is reported.