feat: AnalysisWeak — weak lensing modeling (weak series step 4)#580
Merged
Conversation
- 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>
This was referenced Jul 9, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
al.AnalysisWeakso a non-linear search can fit lens mass models to aWeakDatasetshear catalogue — step 4 (the keystone) of the weak-lensing series (#579).autolens/weak/model/mirrorsautolens/point/model/:FitWeakalready followsFitPoint's standalone pattern, andAnalysisWeak.log_likelihood_functionbuilds aTracerfrom the instance and returnsFitWeak(dataset, tracer).log_likelihood.VisualizerWeak/PlotterWeakwire 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 forWeakDatasetfits.use_jaxdefaults toFalse(FitWeakis NumPy-only; JAX needs pytree registration — deliberate future work).weak_dataset/fit_weakinconfig/visualize/plots.yaml(workspaces should mirror — done in the companion workspace PR).See full details below.
Test Plan
test_autolens/suite in the task worktree: 347 passed.test_autolens/weak/test_analysis.py: analysis-vs-FitWeak likelihood equality, noise-free zero-chi-squared round trip, wrong-model likelihood ordering,save_attributesdataset.jsonround trip.autolens_workspace/scripts/weak/modeling.pyrecovers 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 asal.AnalysisWeak) — fits lens mass models toWeakDatasetshear catalogues;Result = ResultWeak,Visualizer = VisualizerWeak.autolens.weak.model.result.ResultWeak—Resultsubclass with fallback uniformgridandmax_log_likelihood_fit(aFitWeak).autolens.weak.model.plotter.PlotterWeak—dataset_weak()/fit_weak(quick_update=)behindplot_settingsectionsweak_dataset/["fit", "fit_weak"].autolens.weak.model.visualizer.VisualizerWeak—af.Visualizerfor search-time output (dataset subplot before fit; fit subplot + tracer/galaxies during).weak_dataset.subplot_dataset: trueandfit_weak: {}in packagedconfig/visualize/plots.yaml.Migration
Closes #579 only after the companion workspace PR merges (library-first gate).
🤖 Generated with Claude Code