Skip to content

fix: SLaM advanced-pipeline inversion + adapt-image cascade #300

Description

@Jammy2211

Overview

A parked cluster of advanced-pipeline SLaM fit failures (2026-07-20 sweep), reproduced and scoped on clean main 2026-07-21 under PYAUTO_TEST_MODE=2 PYAUTO_SMALL_DATASETS=1. This task covers the pixelized-SLaM inversion / adapt-image cascade only. The multi-wavelength SersicCore alpha=0 failure proved unrelated and was split into a separate issue/prompt (bug/autogalaxy/sersic_core_alpha_zero_division.md).

Diagnosis

Two distinct signatures within the pixelized-SLaM cluster:

  1. double-Einstein-ring (imaging + group)AttributeError: 'NoneType' object has no attribute 'array' at PyAutoArray/.../inversion/mappers/abstract.py:476 (self.adapt_data.array), inside pixel_signals_from → adaptive-regularization weights. Occurs in phase source_pix[1]_source_1 (imaging slam.py:367, group slam.py:476). Confirmed same root cause in both scripts.
  2. imaging/features/pixelization/slamTypeError: add got incompatible shapes for broadcasting: (786, 786), (210, 210) at PyAutoArray/.../inversion/inversion/abstract.py:366 (curvature_matrix + regularization_matrix). A curvature/regularization size mismatch — needs phase-1 diagnosis (real pipeline bug vs synthetic-samples/test-mode artifact).

Root cause (double-ring — confirmed real, not a test-mode artifact)

The SLaM setup uses regularization_init = al.reg.Adapt (adaptive regularization → needs a per-galaxy adapt image). source_pix_1_source_1 pixelizes source_1, but its stitched galaxy_name_image_dict carries only lens + source_0. source_0 obtained its adapt image from an earlier light-profile phase; source_1 was only ever a bare redshift galaxy, so no adapt image can exist for it yetAdaptImages yields no entry for source_1 → the source_1 mapper's adapt_data is None → crash.

Plan

  • Phase 1 — diagnose: confirm the double-ring root cause end-to-end; diagnose the pixelization/slam (786 vs 210) mismatch (same adapt/synthetic-samples gap, a real mesh-size mismatch, or test-mode-only?); determine whether any fix is library (PyAutoArray/PyAutoGalaxy) or workspace-only; reconcile the HowToLens target (the parent note's HowToLens features/ paths do not exist — HowToLens uses a chapter_N_* layout).
  • Phase 2 — fix double-ring: seed source_1 an adapt image (from the current tracer's lensed source-plane model image) for its first pixelized fit, so adaptive regularization has data to weight on. Re-run both double-ring scripts green in test mode.
  • Phase 3 — fix pixelization/slam per the phase-1 verdict; update the HowToLens equivalent.
Detailed implementation plan

Affected Repositories

  • autolens_workspace (primary)
  • HowToLens (pixelization tutorial equivalent — real path TBD in phase 1)
  • PyAutoLens / PyAutoArray / PyAutoGalaxy (only if phase-1 finds a library cause)

Work Classification

Workspace (primary) — with a possible library follow-up gated on phase-1 diagnosis of the pixelization/slam shape mismatch.

Branch Survey

Repository Current Branch Dirty?
./autolens_workspace main clean
./HowToLens main clean
./PyAutoLens main 1 (unrelated: paper_jax/paper.md)
./PyAutoGalaxy main clean
./PyAutoArray main clean

Suggested branch: feature/slam-adapt-inversion-cascade
Worktree root: ~/Code/PyAutoLabs-wt/slam-adapt-inversion-cascade/ (created later by /start_workspace)

Chosen fix direction (approved at scoping)

Seed source_1 an adapt image from the current tracer's lensed source model before its first pixelized fit. (Alternative rejected: bootstrap with Constant regularization then switch to Adapt.)

Reproduction

cd autolens_workspace
NUMBA_CACHE_DIR=/tmp/numba_cache MPLCONFIGDIR=/tmp/matplotlib \
PYAUTO_TEST_MODE=2 PYAUTO_SMALL_DATASETS=1 PYAUTO_SKIP_FIT_OUTPUT=1 PYAUTO_SKIP_VISUALIZATION=1 PYAUTO_SKIP_CHECKS=1 PYAUTO_FAST_PLOTS=1 \
python scripts/imaging/features/advanced/double_einstein_ring/slam.py

Key Files

  • scripts/imaging/features/advanced/double_einstein_ring/slam.pysource_pix_1_source_1 (~line 286-367); stitched galaxy_name_image_dict lacks source_1.
  • scripts/group/features/advanced/double_einstein_ring/slam.py — same phase (~line 476).
  • scripts/imaging/features/pixelization/slam.py — curvature/regularization shape mismatch.
  • PyAutoGalaxy/autogalaxy/analysis/adapt_images/adapt_images.pyAdaptImages galaxy→image mapping (line ~327-335), galaxy_name_image_dict_via_result_from.
  • PyAutoArray/autoarray/inversion/mappers/abstract.py:476pixel_signals_from (adapt_data.array crash site).

Testing

Both double-ring scripts + pixelization/slam (+ HowToLens equivalent) must run green under the smoke env vars above. Regenerate notebooks after the workspace scripts pass.

Original Prompt

Click to expand starting prompt

Parked cluster of advanced-pipeline SLaM fit failures (2026-07-20 sweep). First step: reproduce imaging/features/advanced/double_einstein_ring/slam on clean main; confirm whether the failure is the synthetic-samples adapt_images gap (fixable in the SLaM pipeline / samples_summary construction) or downstream of the pixelization-inversion-not-PD cluster. Split multi-wavelength into a separate prompt if it proves unrelated (it did — SersicCore alpha=0 ZeroDivisionError, now bug/autogalaxy/sersic_core_alpha_zero_division.md).

Affected: autolens_workspace imaging/features/pixelization/slam, imaging/features/advanced/double_einstein_ring/slam, group/features/advanced/double_einstein_ring/slam; HowToLens pixelization tutorial equivalent.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions