feat(cluster): adopt named-galaxy CSV API across all cluster scripts#189
Merged
Conversation
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>
This was referenced May 19, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 existingpoint_datasets.csvandscaling_galaxies.csv.modeling.pyandstart_here.pycompose their lens model entirely from those CSVs via the new PyAutoGalaxy helpers — no more per-tier JSON centre files. Addsscripts/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 viaal.galaxy_models_to_csv, reads it back, prints the round-trip, and constructsaf.Model[Galaxy]instances ready for non-linear search. Also documentspoint_datasets.csv(existing) andscaling_galaxies.csv(legacy) in the same place.scripts/cluster/simulator.py— write the truth model intomass.csv+light.csv+point.csvafter the dataset simulation completes. Drop the per-tier JSON centre writes (centres are in the CSVs).scripts/cluster/modeling.py— loadmass.csv+point.csvviaal.galaxy_models_from_csv; composeaf.Model[Galaxy]instances viaal.galaxy_af_models_from_csv_tables; mutate selected params into priors. Inlineaf.Model(...)per-galaxy composition replaced. Auto-sim guard now also checks formass.csv.scripts/cluster/start_here.py— same CSV-driven refactor asmodeling.py, intro-script tone preserved.Upstream PR
autogalaxy/galaxy/galaxy_model_csv.pymodule + testsal.*Test Plan
csv_api.pyruns end-to-end and prints the full round-trip.simulator.pyproduces the expected family CSVs alongsidedata.fits+point_datasets.csv; both source datasets still have 3 multiple images at sensible positions.modeling.pycomposes a 13-parameter model from the CSVs (verified by interceptingsearch.fitbefore the Nautilus call).🤖 Generated with Claude Code