Skip to content

feat: load scaling-relation centres + luminosities from CSV via galaxy_table#143

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/scaling-relation-csv-loader
May 10, 2026
Merged

feat: load scaling-relation centres + luminosities from CSV via galaxy_table#143
Jammy2211 merged 1 commit into
mainfrom
feature/scaling-relation-csv-loader

Conversation

@Jammy2211
Copy link
Copy Markdown
Collaborator

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_csv helpers 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:

  • Option A (default): CSV via al.galaxy_table_from_csv -- scales naturally to populations of tens or hundreds of galaxies, single editable file as source of truth.
  • Option B (commented out): JSON centres + hardcoded luminosity list -- the original API, fine for short fixed-length tutorials.

modeling_for_luminosities.py now writes its fitted luminosities directly to scaling_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 -- emits extra_galaxies.csv and scaling_galaxies.csv alongside 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 via al.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: emits extra_galaxies.csv and scaling_galaxies.csv for 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 from scaling_galaxies_luminosities.json to scaling_galaxies.csv via al.galaxy_table_to_csv, so the chain to modeling.py needs no manual paste. Drops unused import json.

Upstream PRs

Test Plan

  • python -m py_compile clean for all 5 scripts.
  • Both simulators run end-to-end and emit the expected extra_galaxies.csv + scaling_galaxies.csv (CSV contents inspected -- schema y, x, luminosity with truth values from the simulator).
  • Both modeling.py files run TEST_MODE=2 cleanly (likelihood function called once with prior means; structure verified).
  • modeling_for_luminosities.py runs TEST_MODE=2 cleanly and writes a valid scaling_galaxies.csv (the chain-point file).
  • scripts/check_sizes.sh clean.
  • Smoke tests pass.

🤖 Generated with Claude Code

…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>
@Jammy2211 Jammy2211 added the pending-release PR queued for the next release build label May 10, 2026
@Jammy2211 Jammy2211 merged commit 4a6ab97 into main May 10, 2026
5 checks passed
@Jammy2211 Jammy2211 deleted the feature/scaling-relation-csv-loader branch May 10, 2026 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pending-release PR queued for the next release build

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant