Skip to content

feat: add galaxy_table CSV reader/writer for galaxy populations - #393

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

Jammy2211 merged 1 commit into
mainfrom
feature/scaling-relation-csv-loader

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Summary

Adds a typed CSV reader/writer for galaxy populations -- GalaxyTable dataclass plus galaxy_table_from_csv / galaxy_table_to_csv. Schema columns are y, x, luminosity, redshift?. Wraps autoconf.csvable for the underlying I/O; partial-redshift handling mirrors the convention used by autolens.point.dataset.

Closes #392.

API Changes

Purely additive. Three new public symbols on autogalaxy:

  • ag.GalaxyTable -- dataclass with centres, luminosities, redshifts fields
  • ag.galaxy_table_from_csv(file_path) -> GalaxyTable
  • ag.galaxy_table_to_csv(centres, luminosities, file_path, redshifts=None) -> None

No removals, no renames, no signature changes. See full details below.

Test Plan

  • pytest test_autogalaxy/galaxy/test_galaxy_table.py -- 10 tests covering round-trip with/without redshift, missing redshift column, partial-redshift rejection, extra columns ignored, row order preserved, empty/header-only CSV, mismatched-length writer rejection.
  • import autogalaxy as ag; ag.galaxy_table_from_csv resolves via the namespace export.
Full API Changes (for automation & release notes)

Added

  • autogalaxy.galaxy.galaxy_table.GalaxyTable -- dataclass: centres: Grid2DIrregular, luminosities: List[float], redshifts: Optional[List[float]] = None
  • autogalaxy.galaxy.galaxy_table.galaxy_table_from_csv(file_path: Union[str, Path]) -> GalaxyTable
  • autogalaxy.galaxy.galaxy_table.galaxy_table_to_csv(centres: Sequence[Tuple[float, float]], luminosities: Sequence[float], file_path: Union[str, Path], redshifts: Optional[Sequence[float]] = None) -> None

All three are re-exported at the autogalaxy namespace top-level: ag.GalaxyTable, ag.galaxy_table_from_csv, ag.galaxy_table_to_csv.

Removed

None.

Renamed

None.

Changed Signature

None.

Changed Behaviour

None.

Migration

No migration needed -- purely additive.

🤖 Generated with Claude Code

Closes #392.

Adds autogalaxy/galaxy/galaxy_table.py providing a typed schema layer over
autoconf.csvable for CSV files describing galaxy populations (centres +
luminosities + optional redshifts). Wraps the generic CSV I/O in autoconf and
returns a GalaxyTable dataclass with centres: Grid2DIrregular,
luminosities: list[float], redshifts: list[float] | None.

Mirrors the typed-CSV-helper precedent in autolens.point.dataset (which owns
the equivalent layer for point-source datasets) -- schema lives next to the
typed object it describes.

Consumers are the autolens_workspace scaling_relation examples (issue #141);
the queued autogalaxy_extra_galaxies_audit follow-up will use it from
autogalaxy_workspace too.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Jammy2211

Copy link
Copy Markdown
Collaborator Author

Workspace PR: PyAutoLabs/autolens_workspace#143

@Jammy2211
Jammy2211 merged commit 2ce7eb7 into main May 10, 2026
5 checks passed
@Jammy2211
Jammy2211 deleted the feature/scaling-relation-csv-loader branch May 10, 2026 18:10
@Jammy2211 Jammy2211 removed the pending-release PR queued for the next release build label Sep 4, 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: add galaxy_table CSV helper for scaling_relation examples

1 participant