Skip to content

feat: AnalysisWeak — weak lensing modeling (weak series step 4) - #580

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/weak-modeling
Jul 9, 2026
Merged

Jammy2211 merged 1 commit into
mainfrom
feature/weak-modeling

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Summary

Adds al.AnalysisWeak so a non-linear search can fit lens mass models to a WeakDataset shear catalogue — step 4 (the keystone) of the weak-lensing series (#579). autolens/weak/model/ mirrors autolens/point/model/: FitWeak already follows FitPoint's standalone pattern, and AnalysisWeak.log_likelihood_function builds a Tracer from the instance and returns FitWeak(dataset, tracer).log_likelihood. VisualizerWeak/PlotterWeak wire the nine existing weak quiver plotters into on-the-fly search visualization.

API Changes

Added only — no existing symbol removed, renamed or changed.

  • al.AnalysisWeak(dataset, cosmology=, title_prefix=, use_jax=False) — new Analysis class for WeakDataset fits. use_jax defaults to False (FitWeak is NumPy-only; JAX needs pytree registration — deliberate future work).
  • New packaged config sections weak_dataset / fit_weak in config/visualize/plots.yaml (workspaces should mirror — done in the companion workspace PR).
    See full details below.

Test Plan

  • Full test_autolens/ suite in the task worktree: 347 passed.
  • New test_autolens/weak/test_analysis.py: analysis-vs-FitWeak likelihood equality, noise-free zero-chi-squared round trip, wrong-model likelihood ordering, save_attributes dataset.json round trip.
  • End-to-end Nautilus fit via autolens_workspace/scripts/weak/modeling.py recovers simulator truth within 1σ.

Validation checklist (--auto run — plan was not pre-approved)

Full API Changes (for automation & release notes)

Added

  • autolens.weak.model.analysis.AnalysisWeak (exported as al.AnalysisWeak) — fits lens mass models to WeakDataset shear catalogues; Result = ResultWeak, Visualizer = VisualizerWeak.
  • autolens.weak.model.result.ResultWeak — Result subclass with fallback uniform grid and max_log_likelihood_fit (a FitWeak).
  • autolens.weak.model.plotter.PlotterWeak — dataset_weak() / fit_weak(quick_update=) behind plot_setting sections weak_dataset / ["fit", "fit_weak"].
  • autolens.weak.model.visualizer.VisualizerWeak — af.Visualizer for search-time output (dataset subplot before fit; fit subplot + tracer/galaxies during).
  • Config: weak_dataset.subplot_dataset: true and fit_weak: {} in packaged config/visualize/plots.yaml.

Migration

  • None required — purely additive.

Closes #579 only after the companion workspace PR merges (library-first gate).

🤖 Generated with Claude Code

- autolens/weak/model/{analysis,result,plotter,visualizer}.py, mirroring
  autolens/point/model (FitWeak already follows FitPoint's standalone pattern)
- AnalysisWeak.log_likelihood_function builds a Tracer from the instance and
  returns FitWeak(dataset, tracer).log_likelihood; use_jax defaults to False
  (FitWeak is NumPy-only; JAX needs pytree registration, deliberate future work)
- VisualizerWeak/PlotterWeak wire the existing weak quiver plotters
  (subplot_weak_dataset, subplot_fit_weak, subplot_fit_quick) into on-the-fly
  search visualization via new weak_dataset / fit_weak plots.yaml sections
- al.AnalysisWeak exported; NumPy-only unit tests in test_autolens/weak/

Step 4 of the weak-lensing series (#579).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Jammy2211 Jammy2211 added the pending-release PR queued for the next release build label Jul 9, 2026
@Jammy2211
Jammy2211 merged commit 82f48a6 into main Jul 9, 2026
4 checks passed
@Jammy2211
Jammy2211 deleted the feature/weak-modeling branch July 9, 2026 10:08
@Jammy2211 Jammy2211 removed the pending-release PR queued for the next release build label Sep 4, 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.

feat: AnalysisWeak — weak lensing modeling (weak series step 4)

1 participant