feat: add optional redshift to PointDataset#465
Merged
Conversation
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.
This was referenced Apr 20, 2026
Collaborator
Author
|
Workspace PR: PyAutoLabs/autolens_workspace#77 |
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
Add optional
redshifttoPointDatasetwith 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 toNoneand 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 onautolens_workspace).Closes #464 (partial — workspace PR follows).
API Changes
PointDataset.__init__gains optionalredshift: Optional[float] = Nonekwarg; newredshiftattribute on the instance (float orNone).output_to_csv,list_from_csv,to_csv,from_csv) now round-trips aredshiftcolumn, emitted when any dataset supplies one.namegroup in a loaded CSV must share a single redshift across all rows — mixed or partially populated values raiseValueError.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 asself.redshift.PointDataset.redshift: Optional[float]— new instance attribute.redshift— emitted byoutput_to_csv/PointDataset.to_csvwhen any dataset in the input has a non-None redshift; consumed bylist_from_csv/PointDataset.from_csv._REDSHIFT_HEADERS = ["redshift"]constant._group_redshift(group_rows, group_name)helper.Changed Behaviour
list_from_csv: when the CSV contains aredshiftcolumn, every row in a givennamegroup must share the same redshift value; partial population or mixed values raiseValueError.PointDataset.info: output now includes aredshift :line.Migration
redshiftcolumn is only added when a caller opts in.🤖 Generated with Claude Code