Skip to content

feat: add optional redshift to PointDataset#465

Merged
Jammy2211 merged 1 commit intomainfrom
feature/cluster-simulator
Apr 20, 2026
Merged

feat: add optional redshift to PointDataset#465
Jammy2211 merged 1 commit intomainfrom
feature/cluster-simulator

Conversation

@Jammy2211
Copy link
Copy Markdown
Collaborator

Summary

Add optional redshift to PointDataset with CSV round-trip support so cluster-scale strong-lens workflows can encode per-source redshifts in a single hand-editable CSV alongside positions, fluxes, and time delays. Existing point-source use cases are unaffected — the parameter defaults to None and the CSV column is only emitted when at least one dataset sets it.

This is a library prerequisite for the cluster-scale simulator being added in autolens_workspace/scripts/cluster/simulator.py (follow-up PR on autolens_workspace).

Closes #464 (partial — workspace PR follows).

API Changes

  • PointDataset.__init__ gains optional redshift: Optional[float] = None kwarg; new redshift attribute on the instance (float or None).
  • CSV I/O (output_to_csv, list_from_csv, to_csv, from_csv) now round-trips a redshift column, emitted when any dataset supplies one.
  • Validation: a name group in a loaded CSV must share a single redshift across all rows — mixed or partially populated values raise ValueError.

See full details below.

Test Plan

  • python -m pytest test_autolens/point/test_dataset.py — 10 passed (6 pre-existing + 4 new)
  • python -m pytest test_autolens/point/ — 48 passed (full point-source suite)
Full API Changes (for automation & release notes)

Added

  • PointDataset.__init__(..., redshift: Optional[float] = None) — new optional keyword argument; stored on the instance as self.redshift.
  • PointDataset.redshift: Optional[float] — new instance attribute.
  • CSV column redshift — emitted by output_to_csv/PointDataset.to_csv when any dataset in the input has a non-None redshift; consumed by list_from_csv/PointDataset.from_csv.
  • Module-level _REDSHIFT_HEADERS = ["redshift"] constant.
  • Module-level _group_redshift(group_rows, group_name) helper.

Changed Behaviour

  • list_from_csv: when the CSV contains a redshift column, every row in a given name group must share the same redshift value; partial population or mixed values raise ValueError.
  • PointDataset.info: output now includes a redshift : line.

Migration

  • No migration required. Existing callers and CSV files continue to work unchanged; the redshift column is only added when a caller opts in.

🤖 Generated with Claude Code

Carry source redshift through the PointDataset API and CSV I/O so cluster-scale workflows can encode per-source redshifts in a single hand-editable spreadsheet. The redshift is validated to be consistent across all rows of a given name group.
@Jammy2211
Copy link
Copy Markdown
Collaborator Author

Workspace PR: PyAutoLabs/autolens_workspace#77

@Jammy2211 Jammy2211 merged commit 0ea8d6d into main Apr 20, 2026
5 checks passed
@Jammy2211 Jammy2211 deleted the feature/cluster-simulator branch April 20, 2026 15:50
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.

feat: PointDataset.redshift + cluster-scale simulator

1 participant