Skip to content

feat: finish #1709 corner-plot labels, component & latent plots #1710

Closed

Description

@Jammy2211

Overview

Finish community PR #1709 by @samlange04 (proposal PyAutoLabs/.github#38): per-component corner-plot labels, per-component corner plots, and a latent-parameter corner plot. Instead of another review round, the maintainer pushes the review fixes onto the contributor's branch (as done for PyAutoGalaxy#635) and merges. The work then continues to PyAutoGalaxy's latent declarations and, after release, the workspace config/docs PRs.

Plan

Maintainer decisions (2026-10-21):

  • (a) Superscripts are the component's dot-joined path everywhere, including the model.results text.
  • (b) The latent corner plot stays a separate plot, behind plots_search.yaml nest.corner_anesthetic_latent (default off), written next to corner_anesthetic.png.

Tier: glance — merge mode: human /prm (Heart RED override in force: merge needs an explicit /prm with every check green)

Detailed implementation plan

Work Classification

Both. Library first (PyAutoFit, then PyAutoGalaxy); the workspaces follow after release.

Worktree root

~/Code/PyAutoLabs-wt/finish-pr-1709-corner-plots/ (created by /start_library)

Affected Repositories

  • PyAutoFit (primary, phase 1)
  • PyAutoGalaxy (phase 2)
  • autolens_workspace, HowToGalaxy, HowToLens (+ autofit/autogalaxy workspaces) (phase 3)

Branch Survey

Repository Current Branch Dirty?
./PyAutoFit main clean
./PyAutoGalaxy main clean
./autolens_workspace main 1 file
./HowToGalaxy main clean
./HowToLens main clean

Branch: phase 1 tracks the contributor's samlange04:fix/corner-anesthetic-duplicate-labels (maintainer edits are allowed) so the commits land on #1709. Later phases use feature/finish-pr-1709-corner-plots.

Implementation Steps (phase 1, base: PR head bf43aa623)

  1. corner_anesthetic gating (autofit/non_linear/search/posterior_kind.py plot_results): corner_anesthetic_components falls back to the corner_anesthetic value instead of default=True.
  2. Latent plot exception safety (posterior_kind.py plot_latent_results, updater.py): wrap it in @log_plot_exception, as _model_latent_parameters already is, and skip it in test mode. A raising latent conversion is then logged and no longer escapes the final visualize; today the updater only catches FileNotFoundError.
  3. Switch for model latents (autofit/non_linear/analysis/latent.py): a new output.yaml latent-block key, latent_model_parameters: true, gates appending declared latents to samples.csv, latent.results and latent_summary.json. Document that per-component latent plots follow corner_anesthetic_components.
  4. Unique deep-path labels (autofit/mapper/prior_model/abstract.py superscript_from_component_path and its caller): truncate later names to 3 characters only while the labels stay unique, otherwise lengthen the cut. This fixes lens.bulge_inner.shear / lens.bulge_outer.shear both giving lens.bul.she, and lens.bulge vs lens.bul.0. Cache component_paths.
  5. Shared priors (abstract.py _prior_owner_and_leaf_names): collect every holder of a shared prior, not just the last one on the path walk, so a power law's ell_comps linked into a multipole still gives the mass's axis_ratio/angle latents.
  6. Periodic recentring: recentre for plots only and write the raw angle branch to latent.csv, so it doesn't depend on the fit. Documented in the docstrings and output.yaml.
  7. Minor: a component literally named model must not collide with the root group label.
  8. Testing:
    • New tests for Witness items (i)–(iv), in test_nest_plotters.py, test_updater.py, test_latent_parameters.py and test_model_mapper.py.
    • Re-check the test_samples_text.py expectations against decision (a).
    • Full test_autofit run, plus /smoke_test on autofit/autogalaxy workspace_test.

Key Files

  • autofit/non_linear/search/posterior_kind.py — corner / per-component / latent plot gating
  • autofit/non_linear/search/updater.py — visualize exception handling
  • autofit/non_linear/analysis/latent.py — model latent output
  • autofit/mapper/prior_model/abstract.py — superscripts, prior ownership
  • autofit/mapper/prior_model/latent_parameters.py — latent declarations
  • autofit/config/output.yaml, autofit/config/visualize/plots_search.yaml — new keys and docs

Heart RED override (AUTONOMY.md "Human override for Heart RED (development only)")

Authorization from the live maintainer, 2026-10-21, for this task: "do 2, Override and proceed".

The override covers commit, push and PR work only. Merge needs a separate /prm with every required check green. Release is excluded. This branch makes no claim to fix Heart.

Heart RED reasons at start (Heart: RED — Release RED; monitoring RED · 14/100 · 464 unresolved):

  • [red] PyAutoFit: CI failure — https://api.github.com/repos/PyAutoLabs/PyAutoFit/actions/runs/39111874604
  • [red] PyAutoFit: PyAutoFit: CI failure
  • [red] PyAutoFit/Tests: failure
  • [red] PyAutoFit/workflows/Tests: failure
  • [red] PyAutoHands/workflows/Python Version Matrix: failure
  • [red] PyAutoHeart/workflows/Workspace Smoke: failure
  • [red] PyAutoMind/workflows/Spawn Drift: failure
  • [red] PyAutoArray/Tests: red
  • [red] PyAutoArray/Tests: red
  • [red] PyAutoFit/Tests: red
  • [red] PyAutoFit/Tests: red
  • [red] PyAutoFit/Tests: red
  • [red] PyAutoFit/Tests: red
  • [red] autofit_workspace_test/Smoke Tests: red
  • [red] autogalaxy_workspace_test/Smoke Tests: red
  • [red] autolens_workspace_test/Smoke Tests: red
  • [red] CI wall-clock: 27 gates · slowest PyAutoBrain Nightly Release 49m · 9 hang events
  • [red] PyAutoFit: PyAutoFit: CI failure
  • [red] Workspace validation: NOT ready — 1414p / 1f / 133s @ cloud#39224774724
  • [red] euclid: red
  • [red] test_run: red
  • [red] PyAutoArray: red
  • [red] autolens_inference: red
  • [red] autolens_profiling: red
  • [red] Worktree drift: 5 orphan / 0 missing / 4 dirty
  • [red] euclid_strong_lens_modeling_pipeline: red

Passed branch gates: recorded at ship time.

Original Prompt

Click to expand starting prompt

Finish community PR PyAutoFit#1709…

Type: feature
Target: PyAutoFit
Repos:

  • PyAutoFit
  • PyAutoGalaxy
  • autolens_workspace
  • HowToGalaxy
  • HowToLens
    Difficulty: too-large
    Autonomy: supervised
    Priority: high
    Memory: wiki/galaxies/sources/massive-ellipticals.md; reading-queue.md; wiki/lensing/sources/dark-matter-substructure.md
    Status: formalised
    Consequence: glance
    Witness: PyAutoFit PR Corner plots: fix the silent failure on repeated labels; per-component labels and plots; latent parameters #1709 CI green with new tests for (i) corner_anesthetic: false and the components key absent writes no per-component plots, (ii) a raising latent conversion logs instead of propagating from the final visualize, (iii) a power law's ell_comps linked into a multipole still yields the mass's axis_ratio/angle latents, (iv) deep-path labels stay unique
    Review-minutes: 3
    Unattended: needs-slicing

Finish community PR PyAutoFit#1709 (corner plots: per-component labels, per-component plots, latent-parameter corner plot) — maintainer applies the review changes

Community PR #1709 by @samlange04 from proposal PyAutoLabs/.github#38 (Ideas & Proposals). Maintainer decision 2026-10-21: (a) superscripts become the component's dot-joined path everywhere including model.results text; (b) the latent corner plot stays a separate plot, switched from config (visualize/plots_search.yaml nest.corner_anesthetic_latent, default off), written next to corner_anesthetic.png inside PyAutoFit. The maintainer will push the review fixes onto the contributor's branch (as done for PyAutoGalaxy#635) and merge, rather than asking for another round. user-facing: post a progress update on the PR and the discussion, mark the discussion verdict as the answer, and update the contributor on release.

Review findings to resolve (PR head bf43aa6; 91 targeted tests pass, 158 across the touched test files)

  1. Per-component plots ignore corner_anesthetic and default on when corner_anesthetic_components is absent (posterior_kind.py:134-146) → fall back to the corner_anesthetic value.
  2. latent_parameters_from in plot_latent_results (posterior_kind.py:173) runs outside @log_plot_exception; updater catches only FileNotFoundError (updater.py:239) → guard like _model_latent_parameters; also respect test mode.
  3. Model latents appended to latent/samples.csv, latent.results, latent_summary.json with no switch (analysis/latent.py:165,277,380) → add a key in output.yaml's latent block (default on); give per-component latent plots their own control or document the coupling to corner_anesthetic_components.
  4. Deep-path 3-char truncation collides (lens.bulge_inner.shear / lens.bulge_outer.shear → lens.bul.she; shared-centre basis reads lens.bulge and lens.bul.0) (abstract.py:181) → truncate only while unique.
  5. Shared prior between differently named components follows the last holder (_prior_owner_and_leaf_names, abstract.py:2557): power-law ell_comps linked into a multipole can drop the mass's latents → declarations must see shared priors from every holder; add the test.
  6. Periodic recentring writes a fit-dependent angle branch into latent.csv → decide (recommend: recentre for plots only) and document.
  7. Docs: notation.yaml superscript: block now applies only to a bare unnamed Model → update comments in PyAutoGalaxy and the three workspace notation.yaml, release note; land workspace plots_search.yaml key PRs (contributor has branches feature/corner-plot-labels on autofit/autogalaxy/autolens_workspace, HowToLens, HowToGalaxy) and PyAutoGalaxy feature/latent-parameters.
  8. Minor: component literally named model collides with root group; cache component_paths.

Delivery

PyAutoFit first (push onto contributor's branch samlange04:fix/corner-anesthetic-duplicate-labels, merge #1709), then PyAutoGalaxy latent declarations PR, then workspace config/docs PRs after release (workspace smoke CI installs the released library).

Activity

  1. added a commit that references this issue on Oct 21, 2026
  2. Jammy2211 commented on Oct 21, 2026

    @Jammy2211
    CollaboratorAuthor

    Library PR updated (phase 1)

    Maintainer changes pushed onto the contributor's branch, now #1709 at f9377f3f6, labelled pending-release.

    Gate Result
    pytest test_autofit 3881 passed, 1 skipped, 1 xfailed
    Witness tests (i)–(iv) added; all 13 new or changed tests fail on bf43aa623
    Smoke (pyauto-heart smoke) 165/165 passed: autofit 10, autogalaxy 16, autolens 43, autolens_workspace_test 37, euclid 9, HowToLens 50 (autocti environments did not build locally: missing GSL headers)
    Independent review no code defects; docstring finding fixed; workspace config keys → phase 3
    Heart readiness STALE; monitoring feed RED. Development-only override per this issue; exact reasons in the #1709 body
    CI on f9377f3f6 pending

    Next: /prm once CI is green (glance tier, but the RED override means merging needs a human /prm). Then phase 2, the PyAutoGalaxy declarations, which the contributor will open as their own PR after release, and phase 3, the workspace keys and notation.yaml docs.

  3. Jammy2211 commented on Oct 21, 2026

    @Jammy2211
    CollaboratorAuthor

    Shipped (phase 1)

    #1709 merged (d3a772129, 2026-10-21) with the contributor's work plus the maintainer changes f9377f3f6. Labelled pending-release: it reaches users in the next PyAutoFit release.

    • Per-component corner plots, path superscripts and the latent-parameter corner plot (corner_anesthetic_latent, default off).
    • Review findings 1–8 resolved; Witness tests (i)–(iv) are in and green in CI (3.12, 3.13, no-JAX, docs).
    • Merged under the development-only Heart RED override, after your separate /prm and with every required check green.

    Remaining scope, re-filed as Mind prompts:

    • Phase 2: PyAutoGalaxy latent declarations (af.Periodic for shear, ellipticity and multipoles). The contributor will open the PR after the release.
    • Phase 3: add the workspace plots_search.yaml / output.yaml keys (corner_anesthetic_latent_components, latent_model_parameters), update the notation.yaml superscript comments, and write the release note. This needs the released library.

    Closing this issue for phase 1.

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