PyAutoLens is a Python library for strong gravitational lens modeling, built on PyAutoGalaxy. It adds multi-plane ray-tracing via the Tracer object and lensing-specific fit/analysis classes.
pip install -e ".[dev]"python -m pytest test_autolens/
python -m pytest test_autolens/lens/test_tracer.py
python -m pytest test_autolens/imaging/test_fit_imaging.py -sNUMBA_CACHE_DIR=/tmp/numba_cache MPLCONFIGDIR=/tmp/matplotlib python -m pytest test_autolens/- Tracer (
lens/tracer.py): groups galaxies by redshift plane, performs multi-plane ray-tracing - Fit classes:
FitImaging,FitInterferometer,FitPointDataset— extend autogalaxy equivalents with lensing - Analysis classes:
AnalysisImaging,AnalysisInterferometer,AnalysisPoint - Namespace:
al.mp.*(mass),al.lp.*(light),al.Galaxy,al.Tracer
autogalaxy— galaxy morphology, profiles, single-plane fittingautoarray— data structures, grids, masks, inversionsautofit— non-linear search and model-fitting framework
- The
xpparameter controls NumPy vs JAX:xp=np(default) orxp=jnp - Functions inside
jax.jitmust guard autoarray wrapping withif xp is np: - Decorated functions return raw arrays — the decorator wraps them
- All files must use Unix line endings (LF)
- Format with
black autolens/
- Read the issue description and any linked plan.
- Identify affected files and write your changes.
- Run the full test suite:
python -m pytest test_autolens/ - Ensure all tests pass before opening a PR.
- If changing public API, note the change in your PR description — downstream workspaces may need updates.