Skip to content

Weak-lensing visualization crashes on JAX path: fit.shear_yx lacks .grid #614

Done

Description

@Jammy2211

Bug

Running AnalysisWeak(dataset, use_jax=True) with a gradient search (e.g. af.MultiStartAdam) crashes during the search's visualization update:

File "autolens/weak/plot/weak_dataset_plots.py", line 34, in _positions_yx
    grid = shear_yx.grid
AttributeError: 'jaxlib._jax.ArrayImpl' object has no attribute 'grid'

On the JAX path the max-likelihood FitWeak's shear_yx reaching the plotter is a raw JAX array rather than the structured object carrying .grid, so subplot_fit_weak → plot_shear_yx_2d → _positions_yx fails.

Reproduced on the RAL A100 (jax 0.10.2, current mains) via autolens_jax_joss/benchmarks/weak.py (A2744 pyRRG catalogue, NFWSph model) — full traceback in the job log referenced from PyAutoLabs/autolens_workspace#281. The NumPy path (use_jax=False, as scripts/weak/real_data/a2744.py uses with Nautilus) is unaffected.

Workaround: PYAUTO_SKIP_VISUALIZATION=1 (the benchmark harness now sets this for timing purity regardless).

Likely fix: the weak visualizer should rebuild/attach the positions grid when the fit comes off the JAX path (or _positions_yx should fall back to the dataset's grid) before plotting.

Activity

  1. added a commit that references this issue on Nov 26, 2026
  2. Jammy2211 commented on Nov 26, 2026

    @Jammy2211
    CollaboratorAuthor

    Fixed by #896 (e318465): AnalysisWeak.fit_for_visualization and ResultWeak.max_log_likelihood_fit build a NumPy FitWeak, so JAX weak fits visualize and plot (control test reproduced the 'ArrayImpl' object has no attribute 'grid' crash). Part of #895; ships in the next release.

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