Skip to content

fix: persist SparseTerms phase_centre through the dataset.fits round trip (streaming P5) - #643

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/streaming-p5-cubes-phase-centre
Oct 1, 2026
Merged

Jammy2211 merged 1 commit into
mainfrom
feature/streaming-p5-cubes-phase-centre

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Summary

Streaming visibilities phase 5 companion (epic streaming-visibilities, Discussion https://github.com/orgs/PyAutoLabs/discussions/13; issue PyAutoLabs/PyAutoArray#600). The PyAutoArray PR adds SparseTerms.phase_centre provenance (chunk-by-chunk phase-centre shifts in sparse_terms_from_chunks / Interferometer.from_stream) and refuses to sum terms with different recorded phase centres. This PR makes that provenance survive the dataset.fits round trip: without it, terms accumulated with a shift reloaded with phase_centre=None and could be summed with unshifted terms silently (Codex review finding F1, reproduced: (0.7, -1.3) → None, sum succeeded; after the fix the sum raises).

PyAutoLens imports this writer and loader from autogalaxy, so it needs no change. Requires the PyAutoArray companion PR (same branch name).

API Changes

Persistence only. The SPARSE_TERMS_SCALARS HDU written by interferometer_hdu_list_from gains two trailing float64 entries, phase_centre_y / phase_centre_x (NaN when not recorded), with PHCENTY / PHCENTX header cards when recorded; the aggregator loader rebuilds SparseTerms.phase_centre from them. Files written before this change load unchanged with phase_centre=None.
See full details below.

Test Plan

  • P2 round-trip tests extended to the phase centre (scalars array, header cards, field loops); new: disk round trip after which summing with unshifted terms raises; unrecorded and pre-change 5-entry files reload as None with the other scalars intact.
  • test_autogalaxy: 1307 passed (main: 1305).
  • CI green on all legs; merge after PyAutoArray.
Full API Changes (for automation & release notes)

Changed Behaviour

  • autogalaxy.interferometer.model.analysis.interferometer_hdu_list_from — SPARSE_TERMS_SCALARS HDU has 7 entries (was 5): ..., phase_centre_y, phase_centre_x (NaN = not recorded); header cards PHCENTY / PHCENTX written when recorded. SPARSE_TERMS_SCALARS_ORDER and SPARSE_TERMS_HEADER_KEYS gain the two keys.
  • autogalaxy.aggregator.interferometer._interferometer_from — rebuilds aa.SparseTerms(phase_centre=…); older files → None.

Heart RED development override (human-authorized, 2026-10-01)

Shipped under the AUTONOMY.md "Human override for Heart RED (development only)". Live human authorization in the CLI session (Fable 5.1), quoted: "Yes: library now, workspace when its run passes" for task streaming-p5-cubes-phase-centre (PyAutoLabs/PyAutoArray#600). Exact RED reasons at ship time (pyauto-heart readiness):

  • release validation FAILED (stage integrate)
  • workspace validation not passing (0 failed, 1 timeout, cloud#36404726969: autolens_test scripts/multi_dataset/rectangular.py)
  • manifest drift: public front-door organ tables (generated) — 1 mismatch(es) vs PyAutoMind/repos.yaml

None relate to this branch. Branch gates passed: test_autoarray 1917, test_autogalaxy 1307; Codex review 5 findings (3 introduced → fixed + red-checked, 2 pre-existing → filed). Scope: push + PR-open only. Merge requires a separate human /prm with every required check green; not a release; no claim that Heart is healthy.

Generated by the PyAutoLabs agent workflow.

🤖 Generated with Claude Code

…trip (streaming P5 review)

- interferometer_hdu_list_from appends the (y, x) phase centre (arcsec) to
  the lossless SPARSE_TERMS_SCALARS HDU (NaN when not recorded) and writes
  PHCENTY / PHCENTX header cards when recorded.
- _sparse_terms_from reloads it; files written before this change (5-entry
  scalars, no cards) reload it as None. Previously reloaded shifted terms
  carried phase_centre=None and summed silently with unshifted ones.
- Tests: on-disk round trip of (0.7, -1.3) with the sum against unshifted
  terms raising; unrecorded and pre-existing-file cases reload None.

Refs PyAutoLabs/PyAutoArray#600

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@Jammy2211

Copy link
Copy Markdown
Collaborator Author

Workspace PR: PyAutoLabs/autolens_workspace#582 (array-free datacube example; merges after this PR under the library-first gate).

@Jammy2211
Jammy2211 merged commit f15570b into main Oct 1, 2026
4 checks passed
@Jammy2211
Jammy2211 deleted the feature/streaming-p5-cubes-phase-centre branch October 1, 2026 10:26
@Jammy2211 Jammy2211 removed the pending-release PR queued for the next release build label Oct 7, 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.

1 participant