feat: load scaling-relation centres + luminosities from CSV via galaxy_table#143
Merged
Merged
Conversation
…y_table
Issue PyAutoGalaxy#392 / library PRs PyAutoGalaxy#393 + PyAutoLens#502.
Updates the scaling_relation simulators to emit scaling_galaxies.csv and
extra_galaxies.csv alongside the existing centre JSONs, and updates the
modeling.py + modeling_for_luminosities.py consumers to read them via the
new al.galaxy_table_from_csv helper.
Both modeling.py files show two equally-supported flows side by side:
- Option A (default): CSV via al.galaxy_table_from_csv
- Option B (commented): JSON centres + hardcoded luminosity list (the
original API, fine for tiny tutorials)
modeling_for_luminosities.py now writes its fit results to
scaling_galaxies.csv -- the same file modeling.py consumes -- so the two
scripts chain end-to-end with no manual paste.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This was referenced May 10, 2026
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
Adds CSV-driven loading of galaxy centres + luminosities to the scaling_relation tutorial scripts using the new
al.galaxy_table_from_csv/al.galaxy_table_to_csvhelpers shipped in PyAutoGalaxy#393 + PyAutoLens#502.Both modeling.py files show two equally-supported flows side by side so users see they have a choice:
al.galaxy_table_from_csv-- scales naturally to populations of tens or hundreds of galaxies, single editable file as source of truth.modeling_for_luminosities.pynow writes its fitted luminosities directly toscaling_galaxies.csv-- the same file modeling.py consumes via Option A -- so the two scripts chain end-to-end with no manual copy/paste.Closes PyAutoGalaxy#392.
Scripts Changed
scripts/imaging/features/scaling_relation/simulator.py-- emitsextra_galaxies.csvandscaling_galaxies.csvalongside the centre JSONs (truth-value luminosities written by the simulator, kept in sync with the simulated tracer).scripts/imaging/features/scaling_relation/modeling.py-- adds Option A (CSV viaal.galaxy_table_from_csv, default) and Option B (JSON + hardcoded list, commented out) for the scaling-relation tier; updated header docstring and prose.scripts/group/features/scaling_relation/simulator.py-- same as imaging simulator: emitsextra_galaxies.csvandscaling_galaxies.csvfor the three-tier dataset.scripts/group/features/scaling_relation/modeling.py-- same Option A / Option B side-by-side for the scaling tier; updated section header and prose.scripts/group/features/scaling_relation/modeling_for_luminosities.py-- switches output fromscaling_galaxies_luminosities.jsontoscaling_galaxies.csvviaal.galaxy_table_to_csv, so the chain to modeling.py needs no manual paste. Drops unusedimport json.Upstream PRs
galaxy_tablemodule + testsTest Plan
python -m py_compileclean for all 5 scripts.extra_galaxies.csv+scaling_galaxies.csv(CSV contents inspected -- schemay, x, luminositywith truth values from the simulator).modeling.pyfiles run TEST_MODE=2 cleanly (likelihood function called once with prior means; structure verified).modeling_for_luminosities.pyruns TEST_MODE=2 cleanly and writes a validscaling_galaxies.csv(the chain-point file).scripts/check_sizes.shclean.🤖 Generated with Claude Code