Skip to content

refactor: migrate live developer scripts to flat fields #142

Closed

Description

@Jammy2211

Overview

Migrate the live autolens developer workspace scripts to the released flat fields= API. The user approved the live-code scope on 2026-09-19. Preserve committed science snapshots and frozen or separately owned debug scripts.

Plan

  • Inventory live galaxy-attached shear AST sites and their model/tracer/result consumers.
  • Migrate direct model builders and simulators to top-level MassField.
  • Migrate the three staged SLaM pipelines with an explicit fields route through every stage, using the new chaining helper where mass priors are carried.
  • Re-measure both pinned likelihoods; record before and after and update pins only from measured values.
  • Verify zero legacy AST sites in the live scope and run representative scripts in each tree.
Detailed implementation plan

Affected Repositories

  • autolens_workspace_developer

Branch Survey

Repository Current branch Dirty? Claims
autolens_workspace_developer main clean none

Suggested branch: feature/mass-field-developer

Implementation Steps

  1. Enumerate AST Galaxy(..., shear=...) and af.Model(Galaxy, shear=...) sites outside source_science/results/**, legacy/quantity/**, and euclid_bug/{likelihood_comparison,run_initial_lens_model_pix_cpu}.py.
  2. Move shear to al.MassField at the lens redshift in live jax_profiling/**, searches_minimal/**, plotting_alignment/**, los/**, and source-science helpers; update tracer/model containers and posterior references.
  3. Update slam_pipeline/{dspl,light_dark_mge,mgl_slam_batch}.py stage-by-stage, preserving fields at each stage through explicit prior/fixed field choices. Use al.util.chaining.mass_and_fields_from for mass chaining. This part is release-gated by PyAutoGalaxy#625 / PyAutoLens#745.
  4. Run the two pinned likelihood scripts after migration; record measured values and any pin changes. Preserve source_science/results/{1..4}_*/ byte-for-byte.
  5. Compile all changed files; run AST audit, representative end-to-end scripts per live tree, and available tests. Document unavailable dataset or hardware gates.

Key Files

  • jax_profiling/jit/imaging/mge.py, jax_profiling/jit/point_source/source_plane.py — pinned likelihoods
  • slam_pipeline/{dspl,light_dark_mge,mgl_slam_batch}.py — staged chains
  • searches_minimal/_setup.py, source_science/{fit_helpers,sim_helpers}.py — shared builders
  • live scripts under jax_profiling/, plotting_alignment/, los/

Original Prompt

Click to expand starting prompt

We have been doing work which updates workspaces and lots more to a fields API, can we review where the updating te API for everything got too (E.g. I dont think we have done HowToLens) and continue all of that until its done?

yes do all that, note that autolens_jax_joss is deleted more recently. But lets go

Activity

  1. Jammy2211 commented on Sep 19, 2026

    @Jammy2211
    ContributorAuthor

    Scope finding: source_science/run_all_tests.py imports the shared fit_helpers.py and sim_helpers.py and reuses cached fit identifiers for committed measurement rows. This migration will preserve source_science/** as one measurement tree, including those helpers, to keep archived results reproducible. The live AST witness will exclude that tree alongside legacy/quantity/** and the two Euclid-owned debug scripts.

  2. Jammy2211 commented on Sep 19, 2026

    @Jammy2211
    ContributorAuthor

    Pin remeasurement: migrated jax_profiling/jit/imaging/mge.py (HST) produced 27373.152646517723, which passes its existing 27373.152646517716 pin. The second named pin, jax_profiling/jit/point_source/source_plane.py, has no galaxy-attached shear and is untouched by this migration. Running it as requested produced -3598.9674932334997 versus the existing -294.1401881258811 pin, so it failed before any source edit to that file. I am preserving the pin and treating that drift as a separate profiling issue rather than re-pinning it from an unrelated run.

  3. Jammy2211 commented on Sep 19, 2026

    @Jammy2211
    ContributorAuthor

    Compatibility finding: slam_pipeline/dspl.py and light_dark_mge.py import the local slam_pipeline namespace, which contains only these scripts and no source_lp/source_pix modules. Their shear= calls target that absent legacy pipeline API. I am preserving those two non-runnable examples and migrating the standalone mgl_slam_batch.py stage builder; converting the absent pipeline call signature would be speculative and untestable.

  4. Jammy2211 commented on Sep 19, 2026

    @Jammy2211
    ContributorAuthor

    Source gate cleared

    PyAutoGalaxy#625 and PyAutoLens#745 are merged on current source main; this developer workspace does not require a packaged release. PR #143 is ready for review. Current-source validation confirmed the helper and all five MGL field handoffs, and pytest los/test_los.py -q passed all 32 tests.

  5. Jammy2211 commented on Sep 19, 2026

    @Jammy2211
    ContributorAuthor

    Shipped — 2026-09-19

    PRs

    Upstream PRs

    Summary

    Migrated the live developer JAX, search, plotting, LOS, and standalone MGL builders to top-level MassField values through fields=. Historical measurement archives, frozen legacy examples, Euclid-owned debug scripts, and two scripts tied to an unavailable legacy SLaM namespace remain intentionally unchanged. The migrated code was validated against current PyAutoGalaxy/PyAutoLens source with the AST contract, 32 LOS tests, re-measured likelihood witnesses, and representative end-to-end scripts.

    Session Notes

    The repository has no configured GitHub checks, so PR #143 was merged through the human-invoked /prm after local validation. The current-source helper API was sufficient; no packaged release was required.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions