diff --git a/.github/workflows/refresh-counts.yml b/.github/workflows/refresh-counts.yml index 051aa25..2f83543 100644 --- a/.github/workflows/refresh-counts.yml +++ b/.github/workflows/refresh-counts.yml @@ -1,5 +1,5 @@ # Keeps the research-sources and agent-skills tiles, each repo's lines of code, the -# break-even, crossover, landform, sources, value and launch charts and the activity and languages panels in step with their repos, and the +# break-even, crossover, landform, sources, surveys, value and launch charts and the activity and languages panels in step with their repos, and the # flyby chart with NASA/JPL's close approaches for the week ahead, and the badges with shields.io's # drawing of each repo's latest release. The private repos' counts are # refreshed by running loc.py and refresh_activity.py locally. The activity panel runs to @@ -45,6 +45,7 @@ jobs: - run: python tools/crossover.py docs - run: python tools/landforms.py docs - run: python tools/sources.py docs + - run: python tools/surveys.py docs - run: python tools/value.py docs - run: python tools/launch.py docs - run: python tools/loc.py --public-only diff --git a/README.md b/README.md index 494931e..28416e0 100644 --- a/README.md +++ b/README.md @@ -68,6 +68,12 @@ The first five repos work together to estimate whether an uncrewed asteroid mini +**What the catalog is built from.** The bodies each survey supplies to AsteroidCatalog's latest release, data-2026-11-13, out of its 1,580,325 asteroids. JPL SBDB knows every one of them; NEOWISE, the fewest, 143,015. Only 149,718 (9.5%) have a measured diameter; the rest are estimated from brightness and an assumed albedo. + +
+
diff --git a/docs/surveys-compact.svg b/docs/surveys-compact.svg
new file mode 100644
index 0000000..4955522
--- /dev/null
+++ b/docs/surveys-compact.svg
@@ -0,0 +1,54 @@
+
diff --git a/docs/surveys.svg b/docs/surveys.svg
new file mode 100644
index 0000000..9f5e206
--- /dev/null
+++ b/docs/surveys.svg
@@ -0,0 +1,59 @@
+
diff --git a/tools/README.md b/tools/README.md
index 651cd04..1f03641 100644
--- a/tools/README.md
+++ b/tools/README.md
@@ -19,6 +19,7 @@ Mondays) fetches it again and redraws them.
| crossover chart in Planetary science | `refresh_counts.py`, `crossover.py` | asteroid-belt-gradient's `results/summary.json` | weekly |
| 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 |
| 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 |
@@ -28,7 +29,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, economicspace's destinations, the paper's crossover fits, the sources by domain and tier, 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, 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
@@ -43,6 +44,7 @@ python tools/breakeven.py docs # economicspace's cost per dollar earned
python tools/crossover.py docs # where the belt turns from S-types to C-types, raw and corrected, plus -compact
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/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
@@ -88,7 +90,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, value, launch, flybys, repo diagram) open with
+The wide panels (activity, languages, break-even, crossover, landforms, sources, surveys, 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
@@ -188,6 +190,17 @@ with no domain or an unknown tier. The README's sentences above it (the total, t
T1 and T2, and what the largest domain leans on) are written from the same counts. A new
domain gets a name from its folder; `NAMES` in `sources.py` shortens the long ones.
+`surveys.py` draws what AsteroidCatalog's latest release is built from: one bar for each
+source survey, across the whole catalog, filled for the bodies it supplies (JPL's SBDB, the
+backbone every row is keyed to, fills it), and below them the share of the catalog with a
+measured diameter, gold, against the rest, hollow, which the catalog estimates from
+brightness and an assumed albedo. Its headline is that share. `refresh_counts.py` reads it
+all from the release's `manifest.json` (the same file the catalog tile's size comes from)
+into `counts.json` (`"catalog"`), and stops if the release tag isn't a `data-` tag, a
+survey supplies more bodies than the catalog holds, or a count is missing. What each survey
+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.
+
`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/check.py b/tools/check.py
index a322e19..4c359eb 100644
--- a/tools/check.py
+++ b/tools/check.py
@@ -61,6 +61,7 @@
"crossover.py": ".",
"landforms.py": ".",
"sources.py": ".",
+ "surveys.py": ".",
"value.py": ".",
"launch.py": ".",
"flybys.py": ".",
@@ -142,6 +143,7 @@ def check_counts(readme):
("crossover", lambda m: m.update_readme(readme)),
("landforms", lambda m: m.update_readme(readme)),
("sources", lambda m: m.update_readme(readme)),
+ ("surveys", 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)),
@@ -153,7 +155,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", "value": "refresh_counts", "launch": "refresh_counts",
+ "crossover": "refresh_counts", "landforms": "refresh_counts", "sources": "refresh_counts", "surveys": "refresh_counts", "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():
diff --git a/tools/counts.json b/tools/counts.json
index d28550d..bb8d9ff 100644
--- a/tools/counts.json
+++ b/tools/counts.json
@@ -1496,5 +1496,29 @@
"svm": 0.4584
}
]
+ },
+ "catalog": {
+ "release": "data-2026-11-13",
+ "rows": 1580325,
+ "measured_diameters": 149718,
+ "rejected_rows": 275,
+ "sources": [
+ {
+ "name": "JPL SBDB",
+ "bodies": 1580325
+ },
+ {
+ "name": "SsODNet",
+ "bodies": 1563656
+ },
+ {
+ "name": "NEOWISE",
+ "bodies": 143015
+ },
+ {
+ "name": "MP3C",
+ "bodies": 1335052
+ }
+ ]
}
}
diff --git a/tools/panel.py b/tools/panel.py
index 6132ba6..6cffecb 100644
--- a/tools/panel.py
+++ b/tools/panel.py
@@ -1,5 +1,5 @@
"""The frame the profile's wide panels share: activity.py, breakeven.py, crossover.py,
-flybys.py, landforms.py, languages.py, pipeline.py, sources.py, value.py and launch.py all start their SVG with `background`, and all but
+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`.
It draws the tiles' navy gradient in a rounded border, a field of still stars, and a few
diff --git a/tools/refresh_counts.py b/tools/refresh_counts.py
index 446cc80..fb7f412 100644
--- a/tools/refresh_counts.py
+++ b/tools/refresh_counts.py
@@ -15,6 +15,10 @@
- skills, skill_categories: the opening line of Hermes_Skills' README.
- catalog_rows: the row count in the manifest of AsteroidCatalog's latest release, shown
everywhere as millions to two places ("1.58M", "about 1.58 million").
+- catalog: from the same manifest, the release's tag, how many bodies each source survey
+ supplied, how many have a measured diameter and how many rows validation refused.
+ surveys.py draws it; this also writes that chart's alt text and the sentence above it,
+ so run surveys.py afterwards.
- economics: the destinations table in economicspace's README, the latest full-catalog
run for each place the pipeline delivers to (best cost per dollar of revenue, the
winning asteroid, the median body's). breakeven.py draws it; this also writes that
@@ -77,13 +81,14 @@ def live_counts():
if sources < 100:
sys.exit(f"sources.csv has only {sources} rows; refusing to publish that")
with urllib.request.urlopen(MANIFEST, timeout=30) as r:
- rows = int(json.loads(r.read().decode("utf-8"))["rows"])
- if rows < 1_000_000:
- sys.exit(f"AsteroidCatalog's latest manifest says {rows} rows; refusing to publish that")
+ catalog_manifest = r.read().decode("utf-8")
+ built = surveys(catalog_manifest)
+ rows = built["rows"]
tag = price_release()
manifest = download(tag, "manifest.json")
tables = {dest: download(tag, f"mineral_value_catalog.{dest}.csv") for dest in json.loads(manifest)["destinations"]}
return {"sources": sources, "research": research(registry), "skills": int(m[1]), "skill_categories": int(m[2]), "catalog_rows": rows,
+ "catalog": built,
"economics": destinations(fetch("economicspace/main/README.md")),
"belt": crossovers(fetch("asteroid-belt-gradient/main/results/summary.json")),
"value": prices(tag, manifest, tables),
@@ -96,6 +101,27 @@ def millions(rows):
return f"{rows / 1e6:.2f}"
+def surveys(manifest):
+ """What AsteroidCatalog's latest release is built from, from its manifest: {release, rows,
+ measured_diameters, rejected_rows, sources: [{name, bodies}]}, the sources in the
+ manifest's order (JPL first, the backbone every row is keyed to)."""
+ try:
+ m = json.loads(manifest)
+ data = {"release": str(m["release_tag"]), "rows": int(m["rows"]), "measured_diameters": int(m["measured_diameters"]),
+ "rejected_rows": int(m["rejected_rows"]),
+ "sources": [{"name": str(name), "bodies": int(n)} for name, n in m["sources"].items()]}
+ except (ValueError, KeyError, TypeError, AttributeError) as e:
+ sys.exit(f"AsteroidCatalog's latest manifest no longer says what it is built from in the form expected: {e!r}")
+ rows = data["rows"]
+ if rows < 1_000_000:
+ sys.exit(f"AsteroidCatalog's latest manifest says {rows} rows; refusing to publish that")
+ if (not re.fullmatch(r"data-\d{4}-\d{2}-\d{2}\w*", data["release"]) or len(data["sources"]) < 2
+ or not all(s["name"] and 0 < s["bodies"] <= rows for s in data["sources"])
+ or not 0 < data["measured_diameters"] <= rows or data["rejected_rows"] < 0):
+ sys.exit(f"AsteroidCatalog's latest manifest doesn't look right: {data}")
+ return data
+
+
def destinations(readme):
"""The rows of economicspace's destinations table: [{dest, best, winner, median}].
Bold, code marks and footnote signs are dropped; the winner is the asteroid and its
@@ -336,14 +362,16 @@ def main():
# counts.json also holds loc.py's line counts; keep them.
data = json.loads(path.read_text(encoding="utf-8")) | counts
write(path, json.dumps(data, indent=2) + "\n")
- import breakeven, crossover, landforms, launch, sources, value # read the counts just written
- for chart in (breakeven, crossover, landforms, sources, value, launch):
+ import breakeven, crossover, landforms, launch, sources, surveys, value # read the counts just written
+ for chart in (breakeven, crossover, landforms, sources, surveys, value, launch):
write(readme_path, chart.update_readme(readme_path.read_text(encoding="utf-8")))
- print(" ".join(f"{k}={v}" for k, v in counts.items() if k not in ("economics", "belt", "research", "value", "launch", "mars")))
+ print(" ".join(f"{k}={v}" for k, v in counts.items() if k not in ("economics", "belt", "research", "value", "launch", "mars", "catalog")))
print(" ".join(f"{r['dest']}={r['best']}" for r in counts["economics"]))
print(" ".join(f"{r['sample']}={r['a50']}" for r in counts["belt"]["crossover"]))
print(counts["value"]["release"], " ".join(f"{r['dest']}={r['prices']['water']}" for r in counts["value"]["rows"]))
- print("Mars", " ".join(f"{m}={v['accuracy']}" for m, v in counts["mars"]["models"].items()))
+ print(counts["catalog"]["release"], " ".join(f"{s['name']}={s['bodies']}" for s in counts["catalog"]["sources"]),
+ f"measured={counts['catalog']['measured_diameters']}")
+ print("Mars"," ".join(f"{m}={v['accuracy']}" for m, v in counts["mars"]["models"].items()))
print("spacecost", counts["launch"]["version"], " ".join(f"{r['name']}={r['usd_per_kg']}" for r in counts["launch"]["rows"][:5]))
diff --git a/tools/surveys.py b/tools/surveys.py
new file mode 100644
index 0000000..da47d25
--- /dev/null
+++ b/tools/surveys.py
@@ -0,0 +1,173 @@
+"""Generate the surveys chart (docs/surveys.svg, docs/surveys-compact.svg): what
+AsteroidCatalog's latest release is built from, one bar for each source survey, and how
+few of its asteroids have a measured diameter.
+
+Each survey's bar runs across the whole catalog, filled for the bodies that survey supplies,
+the most first: JPL's SBDB is the backbone every row is keyed to, so it fills the track.
+Below them, one bar splits the catalog's diameters into the measured (gold) and those the
+catalog estimates from brightness and an assumed albedo (hollow), so the two read apart
+without colour. On desktop each survey is named with what it supplies; phones get the names
+and shorter counts.
+
+The numbers are refresh_counts.py's, read from the latest release's manifest.json and kept
+in tools/counts.json ("catalog"), so this draws the same thing until a new release. When
+the chart loads the bars grow from the left, a row at a time; with reduced motion they are
+drawn finished.
+
+`surveys.svg` is for desktop widths. `surveys-compact.svg` drops the descriptions and uses
+larger text, for phones; the README swaps it in with