Skip to content

feat(cluster): adopt named-galaxy CSV API across all cluster scripts - #189

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/cluster-csv-api
May 19, 2026
Merged

Jammy2211 merged 1 commit into
mainfrom
feature/cluster-csv-api

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Summary

Make CSV the first-class API for cluster lens modelling. The simulator now writes the truth model into three family-level CSVs (mass.csv, light.csv, point.csv) alongside the existing point_datasets.csv and scaling_galaxies.csv. modeling.py and start_here.py compose their lens model entirely from those CSVs via the new PyAutoGalaxy helpers — no more per-tier JSON centre files. Adds scripts/cluster/csv_api.py, a pedagogical guide that walks through every CSV used in the cluster workflow.

Closes #187.

Scripts Changed

  • scripts/cluster/csv_api.py — NEW pedagogical guide. Builds a cluster model in plain Python, writes it to family CSVs via al.galaxy_models_to_csv, reads it back, prints the round-trip, and constructs af.Model[Galaxy] instances ready for non-linear search. Also documents point_datasets.csv (existing) and scaling_galaxies.csv (legacy) in the same place.
  • scripts/cluster/simulator.py — write the truth model into mass.csv + light.csv + point.csv after the dataset simulation completes. Drop the per-tier JSON centre writes (centres are in the CSVs).
  • scripts/cluster/modeling.py — load mass.csv + point.csv via al.galaxy_models_from_csv; compose af.Model[Galaxy] instances via al.galaxy_af_models_from_csv_tables; mutate selected params into priors. Inline af.Model(...) per-galaxy composition replaced. Auto-sim guard now also checks for mass.csv.
  • scripts/cluster/start_here.py — same CSV-driven refactor as modeling.py, intro-script tone preserved.

Upstream PR

Test Plan

  • csv_api.py runs end-to-end and prints the full round-trip.
  • simulator.py produces the expected family CSVs alongside data.fits + point_datasets.csv; both source datasets still have 3 multiple images at sensible positions.
  • modeling.py composes a 13-parameter model from the CSVs (verified by intercepting search.fit before the Nautilus call).

🤖 Generated with Claude Code

Add scripts/cluster/csv_api.py -- a pedagogical guide covering the four
cluster CSVs end to end (point_datasets, mass / light / point family CSVs,
and the legacy scaling_galaxies). Refactor simulator.py, modeling.py, and
start_here.py to write/read the family CSVs via the new PyAutoGalaxy
helpers (al.galaxy_models_to_csv / from_csv / af_models_from_csv_tables).

Drops the per-population JSON centre files (main_lens_centres.json,
host_halo_centre.json, source_centres.json) -- centres now live in mass.csv
and point.csv. scaling_galaxies.csv kept as-is per the locked design.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Jammy2211 Jammy2211 added the pending-release PR queued for the next release build label May 19, 2026
@Jammy2211
Jammy2211 merged commit 484991a into main May 19, 2026
6 checks passed
@Jammy2211
Jammy2211 deleted the feature/cluster-csv-api branch May 19, 2026 11:09
@Jammy2211 Jammy2211 removed the pending-release PR queued for the next release build label Oct 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: CSV-first model API for cluster scripts

1 participant