diff --git a/docs/general/citations.md b/docs/general/citations.md index 43fe22ebc..2a9b94676 100644 --- a/docs/general/citations.md +++ b/docs/general/citations.md @@ -1,150 +1,78 @@ (references)= + + -# Citations & References - -The bibtex entries for **PyAutoLens** and its affiliated software packages can be found -[here](https://github.com/PyAutoLabs/PyAutoLens/blob/main/files/citations.bib), with example text for citing **PyAutoLens** -in [.tex format here](https://github.com/PyAutoLabs/PyAutoLens/blob/main/files/citations.tex) format here and -[.md format here](https://github.com/PyAutoLabs/PyAutoLens/blob/main/files/citations.md). As shown in the examples, we -would greatly appreciate it if you mention **PyAutoLens** by name and include a link to our GitHub page! - -**PyAutoLens** is published in the [Journal of Open Source Software](https://joss.theoj.org/papers/10.21105/joss.02825#) and its -entry in the above .bib file is under the citation key `pyautolens`. Please also cite the MNRAS AutoLens -papers ( and ) which are included -under the citation keys `Nightingale2015` and `Nightingale2018`. - -You should also specify the non-linear search(es) you use in your analysis (e.g. Nautilus, Dynesty, Emcee, Zeus, etc) in -the main body of text, and delete as appropriate any packages your analysis did not use. The citations.bib file includes -the citation key for all of these projects. - -## JAX - -**PyAutoLens** runs on a NumPy backend by default and an optional -[JAX](https://github.com/jax-ml/jax) backend for just-in-time compilation, automatic -differentiation, and GPU/TPU execution. If you run any analysis on the JAX path, please -cite JAX under the citation key `jax`. JAX-specific components that are also cited under -their own keys when used are `optax` (gradient-based optimizers, key `optax`), the -interferometer non-uniform FFT (`nufftax` and its FINUFFT algorithm, keys `nufftax` and -`finufft`, see below), and the critical-curve/caustic solver (`Jax-Zero-Contour`, key -`jax_zero_contour`, see below). - -If you use the learning-rate-free `af.MultiStartProdigy` search, also cite the Prodigy -method under the key `prodigy`. It is a published algorithm in its own right, run through -Optax's implementation (`optax.contrib.prodigy`), so cite it alongside `optax` rather than -in place of it: - -```bibtex -@inproceedings{prodigy, -author = {Mishchenko, Konstantin and Defazio, Aaron}, -title = {{Prodigy: An Expeditiously Adaptive Parameter-Free Learner}}, -booktitle = {Proceedings of the 41st International Conference on Machine Learning}, -series = {Proceedings of Machine Learning Research}, -volume = {235}, -pages = {35779--35804}, -publisher = {PMLR}, -url = {https://proceedings.mlr.press/v235/mishchenko24a.html}, -year = {2024} -} -``` - -The reference implementation is at and the preprint -at . - -## Jax-Zero-Contour - -If you use the zero-contour method for critical curve and caustic computation (the default in -`visualize/general.yaml` via `critical_curves_method: zero_contour`), please cite the -`Jax-Zero-Contour` package by Coleman Krawczyk: - -```bibtex -@software{coleman_krawczyk_2025_15730415, - author = {Coleman Krawczyk}, - title = {CKrawczyk/Jax-Zero-Contour: Version 2.0.0}, - month = jun, - year = 2025, - publisher = {Zenodo}, - version = {v2.0.0}, - doi = {10.5281/zenodo.15730415}, - url = {https://doi.org/10.5281/zenodo.15730415}, -} -``` - -The package is available at and archived at -. - -## NUFFTax - -If you fit interferometer datasets on the JAX path, the non-uniform FFT is performed by -`nufftax`, a pure-JAX NUFFT implementation by the GragasLab team. Please cite the -package: - -```bibtex -@software{nufftax, - author = {Gragas and Oudoumanessah, Geoffroy and Iollo, Jacopo}, - title = {nufftax: Pure JAX implementation of the Non-Uniform Fast Fourier Transform}, - url = {https://github.com/GragasLab/nufftax}, - year = {2026}, -} -``` - -`nufftax`'s algorithm is based on FINUFFT (Flatiron Institute); the upstream paper should -also be cited: - -```bibtex -@article{finufft, - author = {Barnett, Alexander H. and Magland, Jeremy F. and af Klinteberg, Ludvig}, - title = {A parallel non-uniform fast Fourier transform library based on an - 'exponential of semicircle' kernel}, - journal = {SIAM J. Sci. Comput.}, - volume = {41}, - number = {5}, - pages = {C479--C504}, - year = {2019}, -} -``` - -The package is available at . - -## Rectangular Mesh (Pixelized Source Reconstructions) - -If you reconstruct a source using the adaptive rectangular meshes (`RectangularAdaptDensity` or -`RectangularAdaptImage`), you **must cite** the following paper under citation -key `Enzi2026`. The mesh's adaptive coordinate transform implements the ray-guided transformed uniform (RTU) -grid formulation this paper introduces, which is what makes the pixelization adaptive and fully -auto-differentiable: - -```bibtex -@article{Enzi2026, - author = {Enzi, Wolfgang J. R. and Krawczyk, Coleman M. and Li, Tian and Collett, Thomas E.}, - title = {Gaussian processes on ray-guided transformed uniform grids for fast, flexible, and auto-differentiable adaptive source reconstruction in lens modelling}, - journal = {MNRAS, submitted}, - eprint = {2606.30620}, - archivePrefix = {arXiv}, - primaryClass = {astro-ph.GA}, - year = {2026}, - url = {https://arxiv.org/abs/2606.30620}, -} -``` - -Note that **PyAutoLens** pairs the RTU grid with its own regularization schemes (e.g. `reg.Constant`, -`reg.Adapt`) rather than the Gaussian-process source prior used in the paper, so quantitative results are not -directly comparable between the two implementations. The `RectangularUniform` mesh performs no RTU transform, -so this citation is not required when only the uniform mesh is used. - -## Dynesty - -If you used the nested sampling algorithm Dynesty, please follow the citation instructions [on the dynesty readthedocs](https://dynesty.readthedocs.io/en/latest/references.html). - -## Mass Models - -If you use decomposed mass models (e.g. stellar mass models like an `Sersic` or dark matter models like -an `NFW`) please cite the following paper under -citation key `Oguri2021`. Our deflection angle calculations are based on this method. - -If you specifically use a decomposed mass model with the `gNFW` please cite the following paper under -citation key `Anowar2019`. - -## Science Papers - -The citations.bib file above also includes my work on [using strong lensing to study galaxy structure](https://ui.adsabs.harvard.edu/abs/2019MNRAS.489.2049N/abstract). If you're feeling kind, please go ahead and stick -a citation in your introduction using citep\{Nightingale2019} or [@Nightingale2019] ;). + +# Citations and references + +Cite PyAutoLens and the methods used in your analysis. State the software version, name the sampler, and include only the dependencies and methods relevant to the calculation you performed. + +## Cite the software + +Use the [PyAutoLens software paper](https://doi.org/10.21105/joss.02825) with bibliography key `pyautolens`. Model composition and fitting use [PyAutoFit](https://doi.org/10.21105/joss.02550), key `pyautofit`. + +For the AutoLens modelling and source-reconstruction methods, also cite [Nightingale & Dye (2015)](https://doi.org/10.1093/mnras/stv1455), key `Nightingale2015`, and [Nightingale, Dye & Massey (2018)](https://doi.org/10.1093/mnras/sty1264), key `Nightingale2018`. + +Download the [BibTeX bibliography](https://github.com/PyAutoLabs/PyAutoLens/blob/main/files/citations.bib), or adapt the example citation text in [LaTeX](https://github.com/PyAutoLabs/PyAutoLens/blob/main/files/citations.tex) or [Markdown](https://github.com/PyAutoLabs/PyAutoLens/blob/main/files/citations.md). Check the example against the packages and versions you actually used. + + + +## Cite your sampler or optimizer + +| Used in your analysis | Reference / bibliography key | +|---|---| +| **Nautilus** | [Lange (2023)](https://doi.org/10.1093/mnras/stad2441), `nautilus` | +| Dynesty | `dynesty`; follow the [version-specific citation guidance](https://dynesty.readthedocs.io/en/latest/references.html) for additional references. | +| Emcee | `emcee` | +| Zeus | `zeus1`, `zeus2` | +| BlackJAX-based searches | [BlackJAX](https://arxiv.org/abs/2402.10797), `blackjax` | +| SciPy optimizers | `scipy` | +| Optax optimizers | `optax` | +| MultiStartProdigy | [Prodigy](https://proceedings.mlr.press/v235/mishchenko24a.html), `prodigy`, alongside `optax` | + +For other search packages or older analyses, use the package's own citation instructions. The bibliography also retains references for previously supported searches so older work remains citable. + + + + + + + +## Cite the numerical methods you used + +| Feature | Citation | +|---|---| +| JAX compilation, differentiation or execution | `jax` | +| Non-uniform FFT with FINUFFT | `finufft` | +| Non-uniform FFT with NUFFTax | `nufftax` and `finufft` | +| Jax-Zero-Contour critical-curve calculation | `jax_zero_contour`, when this method is selected | +| Smooth RTU adaptive rectangular mesh | [Enzi et al.](https://arxiv.org/abs/2606.30620), `Enzi2026` | +| Multi-Gaussian light modelling and joint linear inversion | [He et al. (2024)](https://arxiv.org/abs/2403.16253), key `He2024`, alongside the underlying MGE method used | + +The NumPy `TransformerNUFFT` path uses FINUFFT where supported; the JAX path uses NUFFTax. Cite the backend that performed your calculation. A direct Fourier transform does not use either NUFFT implementation. + +Jax-Zero-Contour is optional. Select it through `critical_curves_method: zero_contour`; do not infer its use simply because a figure contains critical curves. The shared packaged plotting configuration currently selects `marching_squares`. + + + + + +## Adaptive rectangular reconstructions + +`RectangularRTUAdaptDensity` and `RectangularRTUAdaptImage` use a smooth adaptive coordinate transform based on the ray-guided transformed uniform grid method of [Enzi et al.](https://arxiv.org/abs/2606.30620). Cite that method when using these meshes. + +The `RectangularBilinearAdaptDensity` and `RectangularBilinearAdaptImage` variants use an empirical rank-CDF transform. They are not interchangeable with the smooth RTU transform when describing differentiability or numerical implementation. State the mesh class used in your analysis. `RectangularUniform` has no adaptive RTU transform. + +PyAutoLens combines its meshes with its own regularization schemes, such as `reg.Constant` and `reg.Adapt`, rather than automatically adopting the Gaussian-process source prior in the RTU paper. Preserve that distinction when describing the likelihood or comparing results. + + + +## Mass-profile calculations + +For the CSE-based decomposed stellar/dark-matter profile calculations, cite [Oguri (2021)](https://arxiv.org/abs/2106.11464), key `Oguri2021`. For the generalized NFW calculation described by [Shajib (2019)](https://academic.oup.com/mnras/article/488/1/1387/5526256), use `Anowar2019` when that implementation is used. Not every mass profile or numerical route uses the same method. + + + +## Next steps + +Use the [likelihood guide](likelihood_function.md) to identify the calculation behind your fit, and [Papers](papers.md) for applications of the software. diff --git a/docs/general/configs.md b/docs/general/configs.md index c42f99323..9635779fc 100644 --- a/docs/general/configs.md +++ b/docs/general/configs.md @@ -1,24 +1,115 @@ -# Configs + -**PyAutoLens** uses a number of configuration files that customize the default behaviour of the non-linear searches, -visualization and other aspects of **PyAutoLens**. +# Configuration -Descriptions of every configuration file and their input parameters are provided in the `README.md` in -the [config directory of the workspace](https://github.com/PyAutoLabs/autolens_workspace/tree/main/config) +PyAutoLens uses configuration files for plotting, default profile priors and saved output. You can keep the supplied settings for a first fit, then change the ones your analysis needs. -## Setup +## Defaults and overrides -By default, **PyAutoLens** looks for the config files in a `config` folder in the current working directory, which is -why we run autolens scripts from the `autolens_workspace` directory. +The libraries supply packaged defaults. A `config/` folder in your working directory overrides them; settings you do not override fall back to the packaged values. This is why workspace examples are normally run from the workspace root. -The configuration path can also be set manually in a script using the project **PyAutoNerves** and the following -command (the path to the `output` folder where the results of a non-linear search are stored is also set below): +| Configuration | Controls | +|---|---| +| [`visualize/general.yaml`](https://github.com/PyAutoLabs/autolens_workspace/tree/main/config/visualize/general.yaml) | Plot backend, colours, units and display settings. | +| [`visualize/plots.yaml`](https://github.com/PyAutoLabs/autolens_workspace/tree/main/config/visualize/plots.yaml) | Which dataset, fit and reconstruction figures are saved. | +| [`priors/`](https://github.com/PyAutoLabs/autolens_workspace/tree/main/config/priors) | Default priors for profile parameters. | +| [`output.yaml`](https://github.com/PyAutoLabs/autolens_workspace/tree/main/config/output.yaml) | Saved samples, search internals and derived quantities. | +| [`notation.yaml`](https://github.com/PyAutoLabs/autolens_workspace/tree/main/config/notation.yaml) | Parameter labels and formatting. | +| [`general.yaml`](https://github.com/PyAutoLabs/autolens_workspace/tree/main/config/general.yaml) | Other analysis-wide settings. | -```bash +The [configuration README](https://github.com/PyAutoLabs/autolens_workspace/tree/main/config) describes the remaining files. Settings under `build/` are for maintaining the workspace rather than running a science analysis. + +## Save fit figures in two formats + +In `config/visualize/plots.yaml`, set: + +```yaml +subplot_format: [png, pdf] +``` + +This changes the saved subplot formats. Keep the figures that help you assess the fit; for example: + +```yaml +fit: + subplot_fit: true + subplot_fit_log10: true +``` + +The logarithmic view can make faint structure easier to inspect alongside the ordinary fit plot. + +## Change the plotting defaults + +In `config/visualize/general.yaml`, change the colour map: + +```yaml +colormap: viridis +``` + +For a non-interactive machine, set the backend before importing the plotting module: + +```yaml +general: + backend: Agg +``` + +These are excerpts: edit the named keys in the existing file, keeping its other settings. Restart your Python session after editing configuration, especially after changing the plotting backend. + +## Set a default prior + +For linear Sérsic light profiles, `config/priors/light/linear/sersic.yaml` includes the default prior on the Sérsic index. For example: + +```yaml +Sersic: + sersic_index: + type: Uniform + lower_limit: 1.0 + upper_limit: 6.0 +``` + +This changes the default for newly composed `lp_linear.Sersic` models using that configuration. Choose limits for your scientific model; the numbers here are an example, not a recommendation for every galaxy. Preserve the other entries in the file. + +For one component in one analysis, setting its prior in Python is clearer than changing a shared default. The [Model cookbook](model_cookbook.md#prior-customization) shows how. A linear light profile's intensity is solved during the fit and does not have a sampled intensity prior. + +## Keep samples for later analysis + +In `config/output.yaml`: + +```yaml +samples: true +samples_weight_threshold: null +``` + +This retains sampled parameter values, likelihoods and weights, without filtering low-weight samples from the saved file. It can produce larger files, but keeps the samples available for later posterior analysis. Changing this setting does not change the sampler's inference. + + + +## Set configuration and output paths + +To use a project-specific configuration directory: + +```python from autonerves import conf conf.instance.push( - config_path="path/to/config", - output_path=f"path/to/output" + new_path="path/to/config", + output_path="path/to/output", ) ``` + +Replace these paths with your directories. The configuration directory must exist and contain configuration files. Relative paths are resolved from your working directory. Push the path before creating models or searches that read those settings. + +## Set search options in Python + +Individual search defaults are defined by PyAutoFit. Pass options explicitly when creating a search: + +```python +import autofit as af + +search = af.Nautilus(name="example", n_live=3000) +``` + +`n_live` controls the number of live points. Its appropriate value depends on the model and the convergence checks for your analysis. The workspace's `non_linear/` folder contains overrides such as grid-search settings; it is not a complete list of sampler options. + +## Next steps + +Use the [Model cookbook](model_cookbook.md) to customize an individual model, or return to your workspace example and check the figures and files produced by a short run. diff --git a/docs/general/credits.md b/docs/general/credits.md index b86664ad0..30d4a735e 100644 --- a/docs/general/credits.md +++ b/docs/general/credits.md @@ -2,11 +2,13 @@ # Credits -**Developers**: +The software combines contributions to PyAutoLens and its shared libraries. The list below recognizes development and contributed algorithms; historical contributions remain credited even where implementations have since changed. -[James Nightingale](https://github.com/Jammy2211): Lead developer & PyAutoLens guru. +## Developers -[Richard Hayes](https://github.com/rhayes777): Lead developer & [PyAutoFit](https://github.com/PyAutoLabs/PyAutoFit) guru. +[James Nightingale](https://github.com/Jammy2211): PyAutoLens lead developer. + +[Richard Hayes](https://github.com/rhayes777): PyAutoFit lead developer and model-fitting infrastructure. [Aristeidis Amvrosiadis](https://github.com/Sketos): Interferometer Analysis. @@ -14,15 +16,15 @@ Qiuhan He: NFW Profile Lensing Calculations. -[Johnathan Frawley](https://github.com/jonathanfrawley): Profiling, optimization and build server tools. +[Jonathan Frawley](https://github.com/jonathanfrawley): Profiling, optimization and build server tools. [Ashley Kelly](https://github.com/AshKelly): Developer of [pyquad](https://github.com/AshKelly/pyquad) for fast deflections computations. -[Xiaoyue Cao](https://github.com/caoxiaoyue): Analytic Ellipitcal Power-Law Deflection Angle Calculations. +[Xiaoyue Cao](https://github.com/caoxiaoyue): Analytic elliptical Power-Law Deflection Angle Calculations. [Nan Li](https://github.com/linan7788626): Docker integration & support. -**Code Donors**: +## Contributed code [Andrew Robertson](https://github.com/Andrew-Robertson): Critical curve & caustic calculations. @@ -31,3 +33,16 @@ Mattia Negrello: Visibility models in the uv-plane via direct Fourier transforms [Andrea Enia](https://github.com/AndreaEnia): Voronoi source-plane plotting tools. Conor O'Riordan : Broken Power-Law mass profile. + +## Further contributions + +- [Coleman Krawczyk](https://github.com/CKrawczyk): JAX differentiation and critical-curve calculations in the shared galaxy library. +- [Samuel Lange](https://github.com/samlange04): ellipse and multipole tools, derived-parameter output and image-preparation interfaces. +- [Niek Wielders](https://github.com/NiekWielders): mass-profile implementations and configurable MGE settings. +- Hengkai Ding: shapelet and dPIE profile calculations. + +See the [PyAutoLens contributor history](https://github.com/PyAutoLabs/PyAutoLens/graphs/contributors) and the [PyAutoGalaxy contributor history](https://github.com/PyAutoLabs/PyAutoGalaxy/graphs/contributors) for further code, documentation, testing and maintenance contributions. Names in commit history are not used to infer current roles or affiliations. + +## Contribute + +See [Community](community.md) to report an omission, ask a question or contribute. diff --git a/docs/general/demagnified_solutions.md b/docs/general/demagnified_solutions.md index 7dae1802a..eada25c62 100644 --- a/docs/general/demagnified_solutions.md +++ b/docs/general/demagnified_solutions.md @@ -1,200 +1,143 @@ (demagnified-solutions)= +# Demagnified solutions -# Demagnified Solutions +A flexible pixelized source can fit an image well even when the lens mass model is wrong. A positions penalty helps reject models in which identified multiple images fail to trace back to the same source region. -## Overview + -When fitting a lens model using a pixelized source reconstruction, it is common for unphysical and inaccurate lens -models to be estimated. +## Recognize the failure -This is due to demagnified source reconstructions, where the source is reconstructed as the lensed source galaxy -(without any lensing): +With too little lens mass, little deflection occurs and the reconstructed source can resemble the observed arcs or ring rather than a compact unlensed galaxy. A second pathological branch can occur with too much mass, producing an inverted reconstruction. Inspect the reconstructed source as well as the image-plane residuals. -```{image} https://raw.githubusercontent.com/PyAutoLabs/PyAutoLens/main/docs/general/images/data.png -:alt: Alternative text -:width: 400 -``` - -```{image} https://raw.githubusercontent.com/PyAutoLabs/PyAutoLens/main/docs/general/images/model_image.png -:alt: Alternative text -:width: 400 -``` - -What has happened above is that the mass model has gone to an extremely low mass solution, such that essentially no -ray-tracing occurs. The best source reconstruction to fit the data is therefore one where the source is reconstructed -to look exactly like the observed lensed source. - -In fact, there are two variants of these unwanted systematic solutions, with the second variant corresponding to mass -models with **too much mass**, such that the ray-tracing inverts in on itself. +The diagrams and reconstructions in [Maresca et al.](https://arxiv.org/abs/2012.04665) illustrate these branches: -The following schematic is from the paper Maresca et al 2021 () and illustrates -this beautifully: - -```{image} https://raw.githubusercontent.com/PyAutoLabs/PyAutoLens/main/docs/general/images/maresca_fig1.png -:alt: Alternative text -:width: 400 +```{image} images/maresca_fig1.png +:alt: Schematic comparison of physically plausible and pathological source reconstructions from different lens mass models. +:width: 650 ``` -The source reconstructions and model-fits of these solutions are also illustrated by Maresca et al 2021: - -```{image} https://raw.githubusercontent.com/PyAutoLabs/PyAutoLens/main/docs/general/images/maresca_fig2.png -:alt: Alternative text -:width: 400 +```{image} images/maresca_fig2.png +:alt: Image fits and source reconstructions showing how pathological lens models can reproduce the observed image. +:width: 650 ``` -The demagnified solutions are not as high likelihood as the physical and accurate mass model shown in the central -row of the figure above. However, the demagnified solutions **occupy a much greater volume of non-linear parameter space**. +*Figures from Maresca et al.; see the paper for the model definitions and interpretation.* -This means that when we fit a lens model, it is highly probable that all solutions correspond to demagnified solutions, -such that the non-linear search converges on these solutions and never samples the accurate physical mass model. +A pathological solution need not have the highest likelihood to trap a search: it can occupy a large region of parameter space that is easier to find than the physical solution. The positions penalty supplies additional information about which image features correspond to the same source emission. -## Solution + -To prevent a non-linear search from inferring these unwanted solutions **PyAutoLens** penalizes the likelihood -via a position thresholding term. +## Add a positions penalty -First, we specify the locations of the lensed source's multiple images, which the example code below does: +Identify two or more image-plane positions belonging to the same source feature. The coordinates are `(y, x)` in arcseconds. These illustrative positions must be replaced with measurements from your own image: ```python +import autolens as al + positions = al.Grid2DIrregular( - grid=[(0.4, 1.6), (1.58, -0.35), (-0.43, -1.59), (-1.45, 0.2)] + values=[(0.4, 1.6), (1.58, -0.35), (-0.43, -1.59), (-1.45, 0.2)] ) -``` - -Here is where the multiple images appear for an example strong lens, where multiple images are drawn on with black -stars: -```{image} https://raw.githubusercontent.com/PyAutoLabs/PyAutoLens/main/docs/general/images/lensed_source.png -:alt: Alternative text -:width: 400 -``` - -The `autolens_workspace` also includes a Graphical User Interface for drawing lensed source positions via -mouse click (). - -Next, we create `PositionsLH` object, which has an input `threshold`. - -This requires that a mass model traces the multiple image `positions` specified above within the `threshold` -value (e.g. 0.5") of one another in the source-plane. If this criteria is not met, a large penalty term is -applied to likelihood that massively reduces the overall likelihood. This penalty is larger if the `positions` -trace further from one another. - -This ensures the unphysical solutions that produce demagnified solutions have a much lower likelihood that the -physical solutions we desire. Furthermore, the penalty term reduces as the image-plane multiple image `positions` -trace closer in the source-plane, ensuring the non-linear search (e.g. Dynesty) converges towards an accurate mass -model. It does this very fast, as ray-tracing just a few multiple image positions is computationally cheap. - -If the `positions` do trace within the `threshold` no penalty is applied. - -The penalty term is created and passed to an `Analysis` object as follows: - -```python positions_likelihood = al.PositionsLH(positions=positions, threshold=0.3) +# dataset is the imaging dataset prepared for your fit. analysis = al.AnalysisImaging( - dataset=dataset, positions_likelihood_list=[positions_likelihood] + dataset=dataset, + positions_likelihood_list=[positions_likelihood], ) ``` -The threshold of 0.5" is large. For an accurate lens model we would anticipate the positions trace within < 0.01" of -one another. However, we only want the threshold to aid the non-linear with the choice of mass model in the initial fit -and remove demagnified solutions. +The [positions GUI](https://github.com/PyAutoLabs/autolens_workspace/blob/main/scripts/imaging/data_preparation/gui/positions.py) lets you mark positions on an image. Choose corresponding features, not arbitrary bright peaks that may come from different source regions. -## Auto Position Updates +For each candidate mass model, `PositionsLH` ray-traces these coordinates to the source plane and measures their maximum separation. Above the threshold, the model receives a penalty that becomes more severe as the separation increases. At or below the threshold, no positions penalty is applied. Ray-tracing a few coordinates is inexpensive compared with reconstructing a pixelized source. -There are a number of downsides to having to input the multiple images positions manually: +## Choose a threshold -> - For large lens samples this could take a lot of time. -> - For complex sources, it can be unclear which brightness peaks in the image-plane lensed source correspond to the same emission in the source-plane. +The example uses **0.3 arcseconds in the source plane**. This is a tolerance for rejecting inconsistent lens models, not a measurement error or a universal setting. A threshold that is too small can exclude plausible models when the selected image features do not correspond exactly; one that is too large may fail to reject unwanted solutions. -**PyAutoLens** allows the `positions` and `threshold` to be computed if a model for the lens mass is available. +An accurate model may trace the positions much closer together, sometimes below 0.01 arcseconds. The initial threshold does not need to demand that precision. Check the inferred source, the traced positions and the fit residuals; a penalty alone does not establish that the mass model is correct. -This is the case for lens modeling pipelines which use **PyAutoLens**'s search chaining functionality, because the -early fits in these pipelines fit a parametric source model which does not suffer these demagnified solutions. + -If we have a `result` from a previous search, which contains a mass model for the lens galaxy and a light model -for the source (the centre of which is used to compute the multiple image `positions`) we can compute a new -set of multiple image positions from this result: +## Update positions from an earlier fit -```python -result.image_plane_multiple_image_positions -``` - -We can also compute a `threshold` from the result, where this threshold value corresponds to the maximum separation -of the `result.image_plane_multiple_image_positions` computed above but ray traced to the source-plane using -the `result`'s maximum likelihood mass model. +Manual selection is time-consuming for large samples, and corresponding features can be ambiguous for complex sources. After obtaining a useful mass and parametric source model, use it to predict multiple images of the source centre: ```python -result.positions_threshold_from(factor=2.0, minimum_threshold=0.3) +positions = result.image_plane_multiple_image_positions() ``` -The `factor` input is a value that the computed `threshold` is multiplied by. For example, if a `threshold` of -0.1" is computed, the returned value above for `factor=2.0` will be 0.2". - -The `minimum_threshold` is the lowest number the function return will reutnr. Above, if a `threshold` of 0.1" -is computed, the function will return 0.3" because `minimum_threshold==0.3`. +The simpler source model used in an initial search is less able to imitate the observed arcs than a flexible pixelized reconstruction. Inspect that initial fit before using it to initialize later stages. -These inputs are useful when using function to set the `threshold` in a new fit of a search chaining pipeline, as -it allows us to make sure we do set too small a threshold that we remove genuinely physically mass models. - -For writing search chaining pipelines, a convenience method is available in the `result` which returns directly a -`PositionsLH` object: +You can set a threshold from the source-plane separation of the predicted images: ```python -result_1.positions_likelihood_from( - factor=3.0, minimum_threshold=0.2 +threshold = result.positions_threshold_from( + factor=2.0, + minimum_threshold=0.3, ) ``` -This is often used to set up new `Analysis` objects with a positions penalty concisely: +`factor` multiplies the inferred separation, and `minimum_threshold` sets a floor. For example, a separation of 0.1 arcseconds multiplied by 2 gives 0.2 arcseconds, so the floor makes the returned threshold 0.3 arcseconds. These controls stop later stages from inheriting an unnecessarily restrictive threshold. + +The convenience method creates the positions penalty directly: ```python +positions_likelihood = result.positions_likelihood_from( + factor=3.0, + minimum_threshold=0.2, +) + analysis = al.AnalysisImaging( dataset=dataset, - positions_likelihood_list=[result_1.positions_likelihood_from( - factor=3.0, minimum_threshold=0.2 - )], + positions_likelihood_list=[positions_likelihood], ) ``` -## Multiple Source Plane Systems - -A double source plane system is a lens system where there are multiple source-planes at different redshifts, meaning that -incuding the image-plane there are at least 3 planes. + -The `PositionsLH` class can have a `plane_redshift` input, which specifies the redshift of the source-plane -the positions are ray-traced to. +## Multiple source planes -Multiple `PositionsLH` objects can be passed to the `Analysis` object, which then applies the penalty term to -both source-planes independently such that a double source-plane system can be fitted with the penalty based likelihood -functionality. +Use a separate position set for each source. `plane_redshift` specifies the source plane to which that set is traced. A system with two distinct source planes behind a foreground lens has at least three galaxy planes. ```python -positions_likelihood_source_plane_0 = al.PositionsLH(positions=positions, threshold=0.3, plane_redshift=1.0) -positions_likelihood_source_plane_1 = al.PositionsLH(positions=positions, threshold=0.3, plane_redshift=2.0) +# positions_source_1 and positions_source_2 contain measured coordinates +# for corresponding images of each separate source. +positions_likelihood_1 = al.PositionsLH( + positions=positions_source_1, threshold=0.3, plane_redshift=1.0 +) +positions_likelihood_2 = al.PositionsLH( + positions=positions_source_2, threshold=0.3, plane_redshift=2.0 +) analysis = al.AnalysisImaging( - dataset=dataset, positions_likelihood_list= - [ - positions_likelihood_source_plane_0, - positions_likelihood_source_plane_1 - ] + dataset=dataset, + positions_likelihood_list=[positions_likelihood_1, positions_likelihood_2], ) ``` -To set up an `Analysis` object with multiple `PositionsLH` objects from a result, each positions likelihood is -computed from the result for each `plane_redshift`: +The example redshifts and thresholds must match your source models. Each position set is tested independently at its own source redshift. -``` +From a previous fit containing both sources: + +```python analysis = al.AnalysisImaging( dataset=dataset, positions_likelihood_list=[ - source_lp_result.positions_likelihood_from( - factor=3.0, minimum_threshold=0.2, plane_redshift=source_lp_result.instance.galaxies.source_1.redshift, + result.positions_likelihood_from( + factor=3.0, + minimum_threshold=0.2, + plane_redshift=result.instance.galaxies.source_1.redshift, + ), + result.positions_likelihood_from( + factor=3.0, + minimum_threshold=0.2, + plane_redshift=result.instance.galaxies.source_2.redshift, ), - source_lp_result.positions_likelihood_from( - factor=3.0, minimum_threshold=0.2, plane_redshift=source_lp_result.instance.galaxies.source_2.redshift, - ) ], ) ``` + +## Next steps + +Follow the [search-chaining guide](https://github.com/PyAutoLabs/autolens_workspace/blob/main/notebooks/guides/modeling/chaining.ipynb) to carry information between fits, or the [double-source-plane example](https://github.com/PyAutoLabs/autolens_workspace/blob/main/notebooks/imaging/features/advanced/double_source_plane_lens/start_here.ipynb) for multiple sources. diff --git a/docs/general/images/model_cookbook/prior_custom.png b/docs/general/images/model_cookbook/prior_custom.png index 51e1c7e14..59a8c8217 100644 Binary files a/docs/general/images/model_cookbook/prior_custom.png and b/docs/general/images/model_cookbook/prior_custom.png differ diff --git a/docs/general/likelihood_function.md b/docs/general/likelihood_function.md index 847c8802d..99b2ad500 100644 --- a/docs/general/likelihood_function.md +++ b/docs/general/likelihood_function.md @@ -1,20 +1,82 @@ (likelihood-function)= +# Likelihood functions -# Likelihood Function +The workspace notebooks show how a model is compared with your observations, step by step. Start with the base likelihood for your dataset, then read the guide for any additional model components. -The `autolens_workspace` contains Jupyter notebooks describing the (log) likelihood functions used by **PyAutoLens**. +## Cluster -The notebooks provide a step-by-step guide of how **PyAutoLens** fits strong lens data, with the aim to make -the analysis clear to readers without background experience in strong lens modeling and make the modeling less -of a "black box". +| Example | Guide | +|---|---| +| Base likelihood | [Likelihood walkthrough](https://github.com/PyAutoLabs/autolens_workspace/blob/main/notebooks/cluster/likelihood_function.ipynb) | -We recommend that when writing a paper using **PyAutoLens** the author links to this GitHub repository when describing -their likelihood function. +## Group -Links to every notebook are provided at the GitHub repository linked to below. We recommend authors link to this -GitHub repository (as opposed to direct links to each) because the URLs to notebooks on the `autolens_workspace` -may change after papers are published. +| Example | Guide | +|---|---| +| double source plane lens | [Likelihood walkthrough](https://github.com/PyAutoLabs/autolens_workspace/blob/main/notebooks/group/features/advanced/double_source_plane_lens/likelihood_function.ipynb) | +| mass stellar dark | [Likelihood walkthrough](https://github.com/PyAutoLabs/autolens_workspace/blob/main/notebooks/group/features/advanced/mass_stellar_dark/likelihood_function.ipynb) | +| linear light profiles | [Likelihood walkthrough](https://github.com/PyAutoLabs/autolens_workspace/blob/main/notebooks/group/features/linear_light_profiles/likelihood_function.ipynb) | +| multi gaussian expansion | [Likelihood walkthrough](https://github.com/PyAutoLabs/autolens_workspace/blob/main/notebooks/group/features/multi_gaussian_expansion/likelihood_function.ipynb) | +| pixelization/delaunay | [Related worked example](https://github.com/PyAutoLabs/autolens_workspace/blob/main/notebooks/group/features/pixelization/delaunay.ipynb) | +| pixelization | [Likelihood walkthrough](https://github.com/PyAutoLabs/autolens_workspace/blob/main/notebooks/group/features/pixelization/likelihood_function.ipynb) | +| scaling relation | [Likelihood walkthrough](https://github.com/PyAutoLabs/autolens_workspace/blob/main/notebooks/group/features/scaling_relation/likelihood_function.ipynb) | +| Base likelihood | [Likelihood walkthrough](https://github.com/PyAutoLabs/autolens_workspace/blob/main/notebooks/group/likelihood_function.ipynb) | -By linking to this repository a permanent URL is provided. +## Imaging - +| Example | Guide | +|---|---| +| double source plane lens | [Likelihood walkthrough](https://github.com/PyAutoLabs/autolens_workspace/blob/main/notebooks/imaging/features/advanced/double_source_plane_lens/likelihood_function.ipynb) | +| mass stellar dark | [Likelihood walkthrough](https://github.com/PyAutoLabs/autolens_workspace/blob/main/notebooks/imaging/features/advanced/mass_stellar_dark/likelihood_function.ipynb) | +| potential correction | [Likelihood walkthrough](https://github.com/PyAutoLabs/autolens_workspace/blob/main/notebooks/imaging/features/advanced/potential_correction/likelihood_function.ipynb) | +| linear light profiles | [Likelihood walkthrough](https://github.com/PyAutoLabs/autolens_workspace/blob/main/notebooks/imaging/features/linear_light_profiles/likelihood_function.ipynb) | +| multi gaussian expansion | [Likelihood walkthrough](https://github.com/PyAutoLabs/autolens_workspace/blob/main/notebooks/imaging/features/multi_gaussian_expansion/likelihood_function.ipynb) | +| pixelization/delaunay | [Related worked example](https://github.com/PyAutoLabs/autolens_workspace/blob/main/notebooks/imaging/features/pixelization/delaunay.ipynb) | +| pixelization | [Likelihood walkthrough](https://github.com/PyAutoLabs/autolens_workspace/blob/main/notebooks/imaging/features/pixelization/likelihood_function.ipynb) | +| scaling relation | [Likelihood walkthrough](https://github.com/PyAutoLabs/autolens_workspace/blob/main/notebooks/imaging/features/scaling_relation/likelihood_function.ipynb) | +| Base likelihood | [Likelihood walkthrough](https://github.com/PyAutoLabs/autolens_workspace/blob/main/notebooks/imaging/likelihood_function.ipynb) | + +## Interferometer + +| Example | Guide | +|---|---| +| potential correction | [Likelihood walkthrough](https://github.com/PyAutoLabs/autolens_workspace/blob/main/notebooks/interferometer/features/advanced/potential_correction/likelihood_function.ipynb) | +| datacube/delaunay | [Related worked example](https://github.com/PyAutoLabs/autolens_workspace/blob/main/notebooks/interferometer/features/datacube/delaunay.ipynb) | +| datacube | [Likelihood walkthrough](https://github.com/PyAutoLabs/autolens_workspace/blob/main/notebooks/interferometer/features/datacube/likelihood_function.ipynb) | +| linear light profiles | [Likelihood walkthrough](https://github.com/PyAutoLabs/autolens_workspace/blob/main/notebooks/interferometer/features/linear_light_profiles/likelihood_function.ipynb) | +| multi gaussian expansion | [Likelihood walkthrough](https://github.com/PyAutoLabs/autolens_workspace/blob/main/notebooks/interferometer/features/multi_gaussian_expansion/likelihood_function.ipynb) | +| pixelization/delaunay | [Related worked example](https://github.com/PyAutoLabs/autolens_workspace/blob/main/notebooks/interferometer/features/pixelization/delaunay.ipynb) | +| pixelization | [Likelihood walkthrough](https://github.com/PyAutoLabs/autolens_workspace/blob/main/notebooks/interferometer/features/pixelization/likelihood_function.ipynb) | +| scaling relation | [Likelihood walkthrough](https://github.com/PyAutoLabs/autolens_workspace/blob/main/notebooks/interferometer/features/scaling_relation/likelihood_function.ipynb) | +| Base likelihood | [Likelihood walkthrough](https://github.com/PyAutoLabs/autolens_workspace/blob/main/notebooks/interferometer/likelihood_function.ipynb) | + +## Multi galaxy + +| Example | Guide | +|---|---| +| double source plane lens | [Likelihood walkthrough](https://github.com/PyAutoLabs/autolens_workspace/blob/main/notebooks/multi_galaxy/features/advanced/double_source_plane_lens/likelihood_function.ipynb) | +| mass stellar dark | [Likelihood walkthrough](https://github.com/PyAutoLabs/autolens_workspace/blob/main/notebooks/multi_galaxy/features/advanced/mass_stellar_dark/likelihood_function.ipynb) | +| linear light profiles | [Likelihood walkthrough](https://github.com/PyAutoLabs/autolens_workspace/blob/main/notebooks/multi_galaxy/features/linear_light_profiles/likelihood_function.ipynb) | +| multi gaussian expansion | [Likelihood walkthrough](https://github.com/PyAutoLabs/autolens_workspace/blob/main/notebooks/multi_galaxy/features/multi_gaussian_expansion/likelihood_function.ipynb) | +| pixelization | [Likelihood walkthrough](https://github.com/PyAutoLabs/autolens_workspace/blob/main/notebooks/multi_galaxy/features/pixelization/likelihood_function.ipynb) | +| scaling relation | [Likelihood walkthrough](https://github.com/PyAutoLabs/autolens_workspace/blob/main/notebooks/multi_galaxy/features/scaling_relation/likelihood_function.ipynb) | +| Base likelihood | [Likelihood walkthrough](https://github.com/PyAutoLabs/autolens_workspace/blob/main/notebooks/multi_galaxy/likelihood_function.ipynb) | + +## Point source + +| Example | Guide | +|---|---| +| scaling relation | [Likelihood walkthrough](https://github.com/PyAutoLabs/autolens_workspace/blob/main/notebooks/point_source/features/scaling_relation/likelihood_function.ipynb) | +| fit | [Related worked example](https://github.com/PyAutoLabs/autolens_workspace/blob/main/notebooks/point_source/fit.ipynb) | + +## Weak + +| Example | Guide | +|---|---| +| Base likelihood | [Likelihood walkthrough](https://github.com/PyAutoLabs/autolens_workspace/blob/main/notebooks/weak/likelihood_function.ipynb) | + +## Citing your analysis + +Give the software version, model, data and noise assumptions used in your fit. Link to the relevant explanation and cite the methods you used. For a reproducible code reference, link to the notebook at the release tag or commit used for your analysis; the `main` links above follow the current examples. + +See [Citations and references](citations.md) for software and method references. diff --git a/docs/general/model_cookbook.md b/docs/general/model_cookbook.md index 09b155187..3ef907e52 100644 --- a/docs/general/model_cookbook.md +++ b/docs/general/model_cookbook.md @@ -1,12 +1,13 @@ (model-cookbook)= -# Model Cookbook +# Model cookbook -The model cookbook provides a concise reference to lens model composition tools, specifically the `Model` -and `Collection` objects. +Build a model with `af.Model` and `af.Collection`, inspect its parameters, and adapt it to your observations. The examples below show which parameters are sampled, fixed, shared or solved during a fit. -Examples using different **PyAutoLens** API’s for model composition are provided, which produce more concise and -readable code for different use-cases. +```python +import autofit as af +import autolens as al +``` ## Simple Lens Model @@ -112,7 +113,7 @@ parameter. af.ModelPlotter(model).figure() ``` -```{image} https://raw.githubusercontent.com/PyAutoLabs/PyAutoLens/main/docs/general/images/model_cookbook/simple_lens.png +```{image} images/model_cookbook/simple_lens.png :alt: The simple lens model, drawn as nested component cards with one pill per parameter. :width: 600 ``` @@ -155,7 +156,7 @@ model = af.Collection(galaxies=af.Collection(lens=lens, source=source)) af.ModelPlotter(model).figure() ``` -```{image} https://raw.githubusercontent.com/PyAutoLabs/PyAutoLens/main/docs/general/images/model_cookbook/complex_lens.png +```{image} images/model_cookbook/complex_lens.png :alt: A lens model whose lens and source galaxies each have a bulge and a disk, with an external shear. :width: 600 ``` @@ -212,7 +213,7 @@ model = af.Collection( af.ModelPlotter(model).figure() ``` -```{image} https://raw.githubusercontent.com/PyAutoLabs/PyAutoLens/main/docs/general/images/model_cookbook/four_galaxies.png +```{image} images/model_cookbook/four_galaxies.png :alt: A lens model with two lens galaxies and two source galaxies. :width: 600 ``` @@ -256,12 +257,12 @@ model = af.Collection(galaxies=af.Collection(lens=lens, source=source)) af.ModelPlotter(model).figure() ``` -```{image} https://raw.githubusercontent.com/PyAutoLabs/PyAutoLens/main/docs/general/images/model_cookbook/concise.png -:alt: The same lens and source model composed with the concise API. +```{image} images/model_cookbook/concise.png +:alt: A concise model with two Sersic lens light components and an extended source. :width: 600 ``` -The concise API is a shorthand for writing a model, not a different model. Note that this stage gives the lens +Passing profile classes is shorthand for wrapping them in `af.Model`. This example also changes the disk profile from the preceding example: it gives the lens galaxy a `Sersic` bulge *and* a `Sersic` disk, and each of the two has its own priors rather than sharing one. ## Prior Customization @@ -273,8 +274,7 @@ of priors: the effective radius of elliptical Sersic profiles typically assumes a uniform prior between 0.0" and 30.0". `LogUniformPrior`: Like a `UniformPrior` this randomly draws values between a `lower_limit` and `upper_limit`, but the -values are drawn from a distribution with base 10. This is used for the `intensity` of a light profile, as the -luminosity of galaxies follows a log10 distribution. +values are drawn from a distribution uniformly in logarithm, so equal multiplicative intervals have equal probability. It can be useful for a positive scale parameter spanning several orders of magnitude. The linear-profile intensities used here are solved during the fit, not sampled from such a prior. `GaussianPrior`: The values of a parameter are randomly drawn from a Gaussian distribution with a `mean` and width `sigma`. For example, the $y$ and $x$ centre values in a light profile typically assume a mean of 0.0" and a @@ -309,7 +309,7 @@ lens = af.Model( bulge = af.Model(al.lp_linear.SersicCore) source = af.Model(al.Galaxy, redshift=1.0, bulge=bulge) -source.effective_radius = af.TruncatedGaussianPrior( +source.bulge.effective_radius = af.TruncatedGaussianPrior( mean=0.1, sigma=0.05, lower_limit=0.0, upper_limit=1.0 ) @@ -320,7 +320,7 @@ model = af.Collection(galaxies=af.Collection(lens=lens, source=source)) af.ModelPlotter(model).figure() ``` -```{image} https://raw.githubusercontent.com/PyAutoLabs/PyAutoLens/main/docs/general/images/model_cookbook/prior_custom.png +```{image} images/model_cookbook/prior_custom.png :alt: A lens model whose sersic index, mass centre and einstein radius priors have been customized. :width: 600 ``` @@ -328,10 +328,7 @@ af.ModelPlotter(model).figure() Customizing a prior does not change a parameter's state — a parameter with a customized prior is still sampled. Print `model.info`, or call `af.ModelPlotter(model).figure(detail="priors")`, to read the prior on each parameter. -One thing in the code above is easy to misread: the last line sets `effective_radius` on the **source galaxy**, not on -the source galaxy's `bulge`. A `Galaxy` accepts any attribute, so this adds a *new* free `effective_radius` parameter -to the source galaxy itself rather than overriding the bulge's own prior. Writing -`source.bulge.effective_radius = ...` is what customizes the bulge. +Set profile priors on the profile itself: `source.bulge.effective_radius`, not `source.effective_radius`. The latter adds an unrelated galaxy attribute. ## Model Customization @@ -394,7 +391,7 @@ model.add_assertion(model.galaxies.lens.mass.einstein_radius < 3.0) af.ModelPlotter(model).figure() ``` -```{image} https://raw.githubusercontent.com/PyAutoLabs/PyAutoLens/main/docs/general/images/model_cookbook/model_custom.png +```{image} images/model_cookbook/model_custom.png :alt: A customized lens model showing a paired centre, a fixed sersic index, offset relations and two assertions. :width: 600 ``` @@ -427,7 +424,7 @@ model = af.Collection(galaxies=af.Collection(lens=lens, source=source)) af.ModelPlotter(model).figure() ``` -```{image} https://raw.githubusercontent.com/PyAutoLabs/PyAutoLens/main/docs/general/images/model_cookbook/redshift_free.png +```{image} images/model_cookbook/redshift_free.png :alt: A lens model whose lens galaxy redshift is a free parameter, drawn as an ordinary pill on the galaxy card. :width: 600 ``` @@ -438,13 +435,9 @@ at all, and the source galaxy above shows this. The model-fit will automatically enable multi-plane ray tracing and alter the ordering of the planes depending on the redshifts of the galaxies. -NOTE: For strong lenses with just two planes (an image-plane and source-plane) the redshifts of the galaxies do not -impact the model-fit. You should therefore never make the redshifts free if you are only modeling a two-plane lens -system. This is because lensing calculations can be defined in arc-second coordinates, which do not change as a -function of redshift. +For a single lens plane and source plane, an angularly parameterized model can leave the redshifts unconstrained by imaging alone. Do not add free redshifts unless the likelihood contains information that can constrain them. Physical-mass models, mass–concentration relations and time-delay calculations can depend on distances and cosmology even for a two-plane system. -Redshifts should be made free when modeling three or more planes, as the multi-plane ray-tracing calculations have an -obvious dependence on the redshifts of the galaxies which could be inferred by the model-fit. +Multi-plane ray tracing introduces distance-ratio dependence between planes. Use measured redshifts where available and ensure the priors preserve the intended foreground/background ordering. The broad prior in this composition example is for illustrating the API, not a science-ready redshift constraint. ## Solved and Unconfigured Parameters @@ -482,7 +475,7 @@ model = af.Collection( af.ModelPlotter(model).figure() ``` -```{image} https://raw.githubusercontent.com/PyAutoLabs/PyAutoLens/main/docs/general/images/model_cookbook/solved_parameters.png +```{image} images/model_cookbook/solved_parameters.png :alt: A lens model showing the three solved parameters and one missing configuration value. :width: 600 ``` @@ -492,8 +485,7 @@ Three parameters of this model are solved for during the fit: - the `intensity` of every linear light profile (`al.lp_linear.*`, and every member of an `al.lp_basis.Basis` built from them), which the inversion solves for by linear algebra rather than the search sampling it. A `Basis` has no solved amplitude of its own: the solved intensities belong to its member profiles, one per member. -- the `reconstruction` of an `al.Pixelization`, which is the solved surface brightness of every source pixel. The only - sampled parameters of a pixelization are its regularization coefficients. +- the `reconstruction` of an `al.Pixelization`, which is the solved surface brightness of every source pixel. Mesh settings and regularization coefficients may be sampled or fixed according to the model; the reconstructed pixel brightnesses are solved rather than sampled. - the `centre` of an `al.ps.PointSolved`, which is solved for analytically by the `*Solved` point-source fit classes. `al.ps.Point`, by contrast, samples its centre as an ordinary free parameter. @@ -507,7 +499,7 @@ PyAutoLens' own default configuration ships no prior for `areas_factor`. The `au `config/priors/mesh/delaunay.yaml`, as a constant `0.5`, so the same code run from the workspace has an ordinary fixed parameter instead: unset configuration is what you see when your own configuration has a gap. -## Available Model Components +## Available model components The light profiles, mass profiles and other components that can be used for lens modeling are given at the following API documentation pages: @@ -516,12 +508,15 @@ API documentation pages: > - > - -## JSon Outputs + + +## Save and load a model After a model is composed, it can easily be output to a .json file on hard-disk in a readable structure: ```python import os +from os import path import json model_path = path.join("path", "to", "model", "json") @@ -547,12 +542,10 @@ This is used for composing complex models of group scale lenses. ## Multi Galaxy, Group and Cluster Models -Above galaxy scale, models are composed for three regimes (see the New User Guide's "What Scale -System?" ladder — all groups and clusters are multi-galaxy systems, but not vice versa): +Above galaxy scale, models are composed for three regimes (see the New User Guide's "What scale lens?" ladder — all groups and clusters are multi-galaxy systems, but not vice versa): **Multi-galaxy lenses** (2+ co-dominant deflectors, no host halo): one free light + mass model per -deflector, composed in a loop with **untruncated** isothermals (no host halo means no tidal -truncation): +deflector, composed in a loop with **untruncated** isothermals (an example modelling choice, rather than a physical rule for every system): ```python lens_dict = {} @@ -589,7 +582,7 @@ extra galaxy per detected group member, each with a `SersicSph` light profile an `centre` is fixed to its measured position — is the script `autolens_workspace/scripts/group/modeling.py`. Drawn as a figure, with eight extra galaxies, it looks like this: -```{image} https://raw.githubusercontent.com/PyAutoLabs/PyAutoLens/main/docs/general/images/model_cookbook/acceptance_group_scale.png +```{image} images/model_cookbook/acceptance_group_scale.png :alt: A group-scale lens model, whose eight extra galaxies collapse into a single plate of eight components. :width: 600 ``` @@ -613,7 +606,7 @@ profiles. An MGE lens light model of 2 x 30 linear Gaussians, fitted alongside a pixelized source, draws like this: -```{image} https://raw.githubusercontent.com/PyAutoLabs/PyAutoLens/main/docs/general/images/model_cookbook/acceptance_mge_pixelized.png +```{image} images/model_cookbook/acceptance_mge_pixelized.png :alt: An MGE lens light model of two bases of thirty linear Gaussians, with a pixelized Delaunay source. :width: 600 ``` @@ -680,6 +673,8 @@ The **PyAutoFit** model composition cookbooks detail this API in more detail: -## Wrap Up + + +## Next steps -This cookbook shows how to compose simple lens models using the `af.Model()` and `af.Collection()` objects. +Use a workspace modelling example to fit your model, then inspect both the posterior and the fit residuals. The [likelihood guide](likelihood_function.md) explains the calculations behind the fit. diff --git a/docs/general/papers.md b/docs/general/papers.md index f397068b1..3aac09b63 100644 --- a/docs/general/papers.md +++ b/docs/general/papers.md @@ -2,100 +2,134 @@ # Papers -The following papers use **PyAutoLens**: +These papers use PyAutoLens for modelling, simulations or analysis products. The collection is organized by topic and includes preprints. For software and method citations, see [Citations and references](citations.md). -**Dark Matter** +## Dark Matter -[A forward-modelling method to infer the dark matter particle mass from strong gravitational lenses](https://arxiv.org/abs/2010.13221) +- [A forward-modelling method to infer the dark matter particle mass from strong gravitational lenses](https://arxiv.org/abs/2010.13221) -[Dark disk substructure and superfluid dark matter](https://arxiv.org/abs/1901.03694) +- [Dark disk substructure and superfluid dark matter](https://arxiv.org/abs/1901.03694) -[Galaxy-galaxy strong lens perturbations: line-of-sight haloes versus lens subhaloes](https://arxiv.org/abs/2110.04512) +- [Galaxy-galaxy strong lens perturbations: line-of-sight haloes versus lens subhaloes](https://arxiv.org/abs/2110.04512) -[Halo concentration strengthens dark matter constraints in galaxy–galaxy strong lensing analyses](https://arxiv.org/abs/2109.00018) +- [Halo concentration strengthens dark matter constraints in galaxy–galaxy strong lensing analyses](https://arxiv.org/abs/2109.00018) -[Novel Substructure & Superfluid Dark Matter](https://arxiv.org/abs/1901.03694) +- [Scanning for dark matter subhaloes in Hubble Space Telescope imaging of 54 strong lenses](https://doi.org/10.1093/mnras/stad3694) +- [Probing dark matter substructures with free-form modelling: a case study of the Jackpot strong lens](https://arxiv.org/abs/2504.19177) +- [Not so dark, not so dense: an alternative explanation for the lensing subhalo in SDSSJ0946+1006](https://arxiv.org/abs/2506.07978) +- [Galaxy mass modelling from multiwavelength JWST strong lens analysis: dark matter substructure, angular mass complexity, or both?](https://doi.org/10.1093/mnras/staf491) +- [Measuring the stellar-to-halo mass relation at approximately 10^10 solar masses, using forthcoming space-based imaging of galaxy–galaxy strong lenses](https://doi.org/10.1093/mnras/staf2253) +- [Using strong lensing to detect subhaloes with steep inner density profiles](https://doi.org/10.1093/mnras/stag066) -**Cosmology** +## Cosmology -[Kinematic cosmic dipole from a large sample of strong lenses](https://arxiv.org/abs/2603.11152) +- [Kinematic cosmic dipole from a large sample of strong lenses](https://arxiv.org/abs/2603.11152) -[Probing General Relativity in galactic scales at z ∼0.3](https://arxiv.org/abs/2212.08463) +- [Probing General Relativity in galactic scales at z ∼0.3](https://arxiv.org/abs/2212.08463) -[Why weak lensing cluster shapes are insensitive to self-interacting dark matter](https://arxiv.org/abs/2210.13474) +- [Why weak lensing cluster shapes are insensitive to self-interacting dark matter](https://arxiv.org/abs/2210.13474) -**Galaxy Formation & Evolution** +## Galaxy Formation & Evolution -[Two-dimensional kinematics and dynamical modelling of the 'Jackpot' gravitational lens from deep MUSE observations](https://arxiv.org/abs/2401.08771) +- [Two-dimensional kinematics and dynamical modelling of the 'Jackpot' gravitational lens from deep MUSE observations](https://arxiv.org/abs/2401.08771) -[Beyond the bulge-halo conspiracy? Density profiles of Early-type galaxies from extended-source strong lensing](https://arxiv.org/abs/2207.04070) +- [Beyond the bulge-halo conspiracy? Density profiles of Early-type galaxies from extended-source strong lensing](https://arxiv.org/abs/2207.04070) -[Galaxy structure with strong gravitational lensing: decomposing the internal mass distribution of massive elliptical galaxies](https://arxiv.org/abs/1901.07801) +- [Galaxy structure with strong gravitational lensing: decomposing the internal mass distribution of massive elliptical galaxies](https://arxiv.org/abs/1901.07801) -[Microlensing and the type Ia supernova iPTF16geu](https://arxiv.org/abs/2112.04524) +- [Microlensing and the type Ia supernova iPTF16geu](https://arxiv.org/abs/2112.04524) -**Lens Modeling / Theory** +- [Abell 1201: Detection of an Ultramassive Black Hole in a Strong Gravitational Lens](https://arxiv.org/abs/2303.15514) +- [Unveiling a 36 Billion Solar Mass Black Hole at the Centre of the Cosmic Horseshoe Gravitational Lens](https://arxiv.org/abs/2502.13788) -[Spectroscopical Confirmation and Lens Modeling of a Complex Strong Lensing System Produced by a Close Galaxy Pair at z_d = 0.79](https://arxiv.org/abs/2603.12790) +- [Pixel-level modelling of group-scale strong lens CASSOWARY 19](https://arxiv.org/abs/2504.11445) +- [The COSMOS-Web ring: In-depth characterization of an Einstein ring lensing system at z approximately 2](https://doi.org/10.1051/0004-6361/202348095) +- [What can strong lensing recover in edge-on disc galaxies? A mock study based on TNG50 simulations](https://arxiv.org/abs/2611.03084) — preprint. -[Strong gravitational lensings external shear is not shear](https://arxiv.org/abs/2301.05244) +## Lens Modeling / Theory -[Automated galaxy-galaxy strong lens modelling: no lens left behind](https://arxiv.org/abs/2202.09201) +- [Spectroscopical Confirmation and Lens Modeling of a Complex Strong Lensing System Produced by a Close Galaxy Pair at z_d = 0.79](https://arxiv.org/abs/2603.12790) -[Systematic Errors Induced by the Elliptical Power-law model in Galaxy–Galaxy Strong Lens Modeling](https://arxiv.org/abs/2110.14554) +- [Strong gravitational lensings external shear is not shear](https://arxiv.org/abs/2301.05244) -[Testing strong lensing subhalo detection with a cosmological simulation](https://arxiv.org/abs/2202.10191) +- [Automated galaxy-galaxy strong lens modelling: no lens left behind](https://arxiv.org/abs/2202.09201) -**Statistics / Machine Learning** +- [Systematic Errors Induced by the Elliptical Power-law model in Galaxy–Galaxy Strong Lens Modeling](https://arxiv.org/abs/2110.14554) -[A machine learning based approach to gravitational lens identification with the International LOFAR Telescope](https://arxiv.org/abs/2207.10698) +- [Testing strong lensing subhalo detection with a cosmological simulation](https://arxiv.org/abs/2202.10191) -[Auto-identification of unphysical source reconstructions in strong gravitational lens modelling](https://arxiv.org/abs/2012.04665) +- [Unveiling lens light complexity with a novel multi-Gaussian expansion approach for strong gravitational lensing](https://arxiv.org/abs/2403.16253) +- [The impact of CLEANing on strong gravitational lens modelling](https://doi.org/10.1093/mnras/staf161) -[Decoding Dark Matter Substructure without Supervision](https://arxiv.org/abs/2008.12731) +## Statistics / Machine Learning -[Deep Learning the Morphology of Dark Matter Substructure](https://arxiv.org/abs/1909.07346) +- [A machine learning based approach to gravitational lens identification with the International LOFAR Telescope](https://arxiv.org/abs/2207.10698) -[Domain Adaptation for Simulation-Based Dark Matter Searches Using Strong Gravitational Lensing](https://arxiv.org/abs/2112.12121) +- [Auto-identification of unphysical source reconstructions in strong gravitational lens modelling](https://arxiv.org/abs/2012.04665) -[Likelihood-free MCMC with Amortized Approximate Likelihood Ratios](https://arxiv.org/abs/1903.04057) +- [Decoding Dark Matter Substructure without Supervision](https://arxiv.org/abs/2008.12731) -[On machine learning search for gravitational lenses](https://arxiv.org/abs/2104.01014) +- [Deep Learning the Morphology of Dark Matter Substructure](https://arxiv.org/abs/1909.07346) -[Strong lens modelling: comparing and combining Bayesian neural networks and parametric profile fitting](https://arxiv.org/abs/2103.03257) +- [Domain Adaptation for Simulation-Based Dark Matter Searches Using Strong Gravitational Lensing](https://arxiv.org/abs/2112.12121) -[Streamlined Lensed Quasar Identification in Multiband Images via Ensemble Networks](https://arxiv.org/abs/2307.01090) +- [Likelihood-free MCMC with Amortized Approximate Likelihood Ratios](https://arxiv.org/abs/1903.04057) -**Source Science** +- [On machine learning search for gravitational lenses](https://arxiv.org/abs/2104.01014) -[A Glimpse of the Stellar Populations and Elemental Abundances of Gravitationally Lensed, Quiescent Galaxies at z≳1 with Keck Deep Spectroscopy](https://arxiv.org/abs/2212.04731) +- [Strong lens modelling: comparing and combining Bayesian neural networks and parametric profile fitting](https://arxiv.org/abs/2103.03257) -[Discovery of a radio lobe in the Cloverleaf Quasar at z = 2.56](https://arxiv.org/abs/2212.07027) +- [Streamlined Lensed Quasar Identification in Multiband Images via Ensemble Networks](https://arxiv.org/abs/2307.01090) -[ALMA [\{N} \{II}] 205 μm Imaging Spectroscopy of the Lensed Submillimeter Galaxy ID 141 at Redshift 4.24](https://arxiv.org/abs/2006.01147) +## Source Science -[CO, H2O, H2O+ line & dust emission in a z = 3.63 strongly lensed starburst merger at sub-kiloparsec scales](https://arxiv.org/abs/1903.00273) +- [A Glimpse of the Stellar Populations and Elemental Abundances of Gravitationally Lensed, Quiescent Galaxies at z≳1 with Keck Deep Spectroscopy](https://arxiv.org/abs/2212.04731) -[The molecular-gas properties in the gravitationally lensed merger HATLAS J142935.3-002836](https://arxiv.org/abs/1904.00307) +- [Discovery of a radio lobe in the Cloverleaf Quasar at z = 2.56](https://arxiv.org/abs/2212.07027) -[Modelling high-resolution ALMA observations of strongly lensed dusty star forming galaxies detected by Herschel](https://arxiv.org/abs/2111.09680) +- [ALMA [\{N} \{II}] 205 μm Imaging Spectroscopy of the Lensed Submillimeter Galaxy ID 141 at Redshift 4.24](https://arxiv.org/abs/2006.01147) -[ALMA resolves the first strongly-lensed Optical/NIR-dark galaxy](https://arxiv.org/abs/2207.00466) +- [CO, H2O, H2O+ line & dust emission in a z = 3.63 strongly lensed starburst merger at sub-kiloparsec scales](https://arxiv.org/abs/1903.00273) -[The Two 𝑧 ∼ 13 Galaxy Candidates HD1 and HD2 Are Likely Not Lensed](https://arxiv.org/abs/2209.06830) +- [The molecular-gas properties in the gravitationally lensed merger HATLAS J142935.3-002836](https://arxiv.org/abs/1904.00307) -[The Way of Water: ALMA resolves H2O emission lines in a strongly lensed dusty star-forming galaxy at z ∼ 3.1](https://arxiv.org/abs/2304.08563) +- [Modelling high-resolution ALMA observations of strongly lensed dusty star forming galaxies detected by Herschel](https://arxiv.org/abs/2111.09680) -[Characterisation of Herschel-selected strong lens candidates through HST and sub-mm/mm observations](https://arxiv.org/abs/2311.01158) +- [ALMA resolves the first strongly-lensed Optical/NIR-dark galaxy](https://arxiv.org/abs/2207.00466) -**Surveys** +- [The Two 𝑧 ∼ 13 Galaxy Candidates HD1 and HD2 Are Likely Not Lensed](https://arxiv.org/abs/2209.06830) -[Gaia GraL X.: The GraL catalogue of gravitationally lensed quasars Matched with Gaia data, redshifts, and time delays](https://arxiv.org/abs/2603.12810) +- [The Way of Water: ALMA resolves H2O emission lines in a strongly lensed dusty star-forming galaxy at z ∼ 3.1](https://arxiv.org/abs/2304.08563) -[When Spectral Modeling Meets Convolutional Networks: A Method for Discovering Reionization-era Lensed Quasars in Multi-band Imaging Data](https://arxiv.org/abs/2211.14543) +- [Characterisation of Herschel-selected strong lens candidates through HST and sub-mm/mm observations](https://arxiv.org/abs/2311.01158) -[Modeling Strong Lenses from Wide-Field Ground-Based Observations in KiDS and GAMA](https://arxiv.org/abs/2301.05320) +- [Gravitational lensing reveals cool gas within 10–20 kpc around a quiescent galaxy](https://doi.org/10.1038/s42005-024-01778-4) +- [Resolving the molecular gas emission of the z approximately 2.5–2.8 starburst galaxies SPT0125-47 and SPT2134-50](https://arxiv.org/abs/2512.05093) +- [Detailed lens modeling and kinematics of the submillimeter galaxy G09v1.97](https://arxiv.org/abs/2601.14685) -[MNELLS: The MUSE Nearby Early-Type Galaxy Lens Locator Survey](https://arxiv.org/abs/2002.07191) +## Surveys -[Subaru FOCAS IFU observations of two z=0.12 strong-lensing elliptical galaxies from SDSS MaNGA](https://arxiv.org/abs/1911.06338) +- [Gaia GraL X.: The GraL catalogue of gravitationally lensed quasars Matched with Gaia data, redshifts, and time delays](https://arxiv.org/abs/2603.12810) + +- [When Spectral Modeling Meets Convolutional Networks: A Method for Discovering Reionization-era Lensed Quasars in Multi-band Imaging Data](https://arxiv.org/abs/2211.14543) + +- [Modeling Strong Lenses from Wide-Field Ground-Based Observations in KiDS and GAMA](https://arxiv.org/abs/2301.05320) + +- [MNELLS: The MUSE Nearby Early-Type Galaxy Lens Locator Survey](https://arxiv.org/abs/2002.07191) + +- [Subaru FOCAS IFU observations of two z=0.12 strong-lensing elliptical galaxies from SDSS MaNGA](https://arxiv.org/abs/1911.06338) + +- [The COSMOS-Web Lens Survey (COWLS) I: discovery of >100 high redshift strong lenses in contiguous JWST imaging](https://arxiv.org/abs/2503.08777) +- [The COSMOS-Web Lens Survey (COWLS) II: depth, resolution, and NIR coverage from JWST reveal 17 spectacular lenses](https://arxiv.org/abs/2503.08782) — uses the COWLS I lens models. +- [The COSMOS-Web Lens Survey (COWLS) III: forecasts versus data](https://arxiv.org/abs/2503.08785) — compares lenspop forecasts with the model-supported COWLS catalogue. +- [Euclid Quick Data Release (Q1) XXVI: The Strong Lensing Discovery Engine A – System overview and first lens sample](https://doi.org/10.1051/0004-6361/202555141) +- [Euclid Quick Data Release (Q1) XXVII: The Strong Lensing Discovery Engine B – Early strong lens candidates from visual inspection of high-velocity dispersion galaxies](https://doi.org/10.1051/0004-6361/202554605) +- [Euclid Quick Data Release (Q1) XXXI: LEMON – LEns MOdelling with Neural networks](https://doi.org/10.1051/0004-6361/202554538) +- [Euclid: Finding strong gravitational lenses in the early release observations using convolutional neural networks](https://doi.org/10.1051/0004-6361/202554132) +- [Galaxy-scale lens search in the PEARLS NEP TDF and CEERS JWST fields](https://doi.org/10.1093/mnras/staf1991) +- [Euclid Quick Data Release (Q1): The Strong Lensing Discovery Engine F – Bright and low-redshift strong lenses](https://arxiv.org/abs/2603.28580) +- [Euclid Quick Data Release (Q1): The Strong Lensing Discovery Engine E – Ensemble classification and lessons for DR1](https://doi.org/10.1051/0004-6361/202554617) — uses the lens models from Engine A. + +## Add a paper + +Share a missing application in [PyAutoLabs Discussions](https://github.com/orgs/PyAutoLabs/discussions), including a link and a brief description of how it uses the software. diff --git a/docs/general/workspace.md b/docs/general/workspace.md index 9b1bbb880..2e1109e5d 100644 --- a/docs/general/workspace.md +++ b/docs/general/workspace.md @@ -1,59 +1,50 @@ (workspace)= +# Workspace tour -# Workspace Tour +The [autolens workspace](https://github.com/PyAutoLabs/autolens_workspace) contains examples and datasets for modelling strong lenses. Use this page to find where things live; the [workspace README](https://github.com/PyAutoLabs/autolens_workspace#readme) has the full directory guide. -You should have downloaded and configured the [autolens workspace](https://github.com/PyAutoLabs/autolens_workspace) -when you installed **PyAutoLens**. If you didn't, checkout the -[installation instructions](https://pyautolens.readthedocs.io/en/latest/general/installation.html#installation-with-pip) -for how to downloaded and configure the workspace. + + -The `README.md` files distributed throughout the workspace describe every folder and file, and specify if -examples are for beginner or advanced users. -New users should begin by checking out the following parts of the workspace. +## Find an example -## Scripts / Notebooks +Start with the [New User Guide](https://pyautolens.readthedocs.io/en/latest/overview/overview_2_new_user_guide.html) to choose an example for your observations. Open its notebook to read and run it, or use the matching Python script where provided. -There are numerous example describing how to perform lensing calculations, lens modeling, and many other -**PyAutoLens** features. All examples are provided as Python scripts and Jupyter notebooks. + -Descriptions of every configuration file and their input parameters are provided in the `README.md` in -the [config directory of the workspace](https://github.com/PyAutoLabs/autolens_workspace/tree/main/config) + -## Config + -Here, you'll find the configuration files which customize: +## Where files live -> - The default settings used by every non-linear search. -> - Visualization, including the backend used by *matplotlib*. -> - The priors and notation configs associated with the light and mass profiles used for lens modeling. -> - The behaviour of different (y,x) Cartesian grids used to perform lens calculations. -> - The general.yaml config which customizes other aspects of **PyAutoLens**. +| Folder | What you use it for | +|---|---| +| [`notebooks/`](https://github.com/PyAutoLabs/autolens_workspace/tree/main/notebooks) | Worked examples with explanations, code and figures. | +| [`scripts/`](https://github.com/PyAutoLabs/autolens_workspace/tree/main/scripts) | Python versions to run and adapt for your analysis. | +| [`dataset/`](https://github.com/PyAutoLabs/autolens_workspace/tree/main/dataset) | Example observations and inputs used by the scripts. | +| [`config/`](https://github.com/PyAutoLabs/autolens_workspace/tree/main/config) | Overrides for priors, plots, output and other defaults. See [Configuration](configs.md). | +| `output/` | Results written when you run a fit. The search's name and path settings organize each analysis. | -Checkout the [configuration](https://pyautolens.readthedocs.io/en/latest/general/installation.html#installation-with-pip) -section of the readthedocs for a complete description of every configuration file. +Run local examples from the workspace root so their relative dataset and configuration paths resolve. If you need to set up the workspace, follow the existing [installation guide](https://pyautolens.readthedocs.io/en/latest/installation/overview.html). -## Dataset + -Contains the dataset's used to perform lens modeling. Example datasets using simulators included with the workspace -are included here by default. +## SLaM pipelines -## Output +For analyses that fit the source, lens light and mass in stages, see the [SLaM examples](https://github.com/PyAutoLabs/autolens_workspace/blob/main/notebooks/imaging/features/pixelization/slam.ipynb). Start with a basic imaging fit before adapting a pipeline. -The folder where modeling results are stored. + -## SLaM + -Advanced lens modeling pipelines that use the Source, Light and Mass (SLaM) approach to lens modeling. +## Next steps -See [here](https://pyautolens.readthedocs.io/en/latest/advanced/slam.html) for an overview. +- Change plotting or output defaults in [Configuration](configs.md). +- Build and inspect your model with the [Model cookbook](model_cookbook.md). +- Work through [HowToLens](https://github.com/PyAutoLabs/HowToLens) for the science behind the examples. -## HowToLens +If you use the [AI Assistant](https://github.com/PyAutoLabs/autolens_assistant), you can ask: -The **HowToLens** lecture series is a collection of Jupyter notebooks describing how to build a **PyAutoLens** model -fitting project and giving illustrations of different statistical methods and techniques. It ships as a standalone -repository at [PyAutoLabs/HowToLens](https://github.com/PyAutoLabs/HowToLens) (separate from the workspace). - -Checkout the -[tutorials section](https://pyautolens.readthedocs.io/en/latest/howtolens/howtolens.html) for a -full description of the lectures and online examples of every notebook. +> I have [describe your observations] and want to model [describe the objects]. Find a matching workspace example, explain its inputs, and show me which parts I need to adapt. diff --git a/files/citations.bib b/files/citations.bib index 85e8158ef..9db3d3641 100644 --- a/files/citations.bib +++ b/files/citations.bib @@ -16,6 +16,7 @@ @article{astropy1 Year = 2013, Bdsk-Url-1 = {https://dx.doi.org/10.1051/0004-6361/201322068}} + @article{astropy2, Adsnote = {Provided by the SAO/NASA Astrophysics Data System}, Adsurl = {https://ui.adsabs.harvard.edu/#abs/2018AJ....156..123T}, @@ -34,6 +35,7 @@ @article{astropy2 } + @article{colossus, abstract = {This paper introduces Colossus, a public, open-source python package for calculations related to cosmology, the large-scale structure (LSS) of matter in the universe, and the properties of dark matter halos. The code is designed to be fast and easy to use, with a coherent, well-documented user interface. The cosmology module implements Friedman-Lemaitre-Robertson-Walker cosmologies including curvature, relativistic species, and different dark energy equations of state, and provides fast computations of the linear matter power spectrum, variance, and correlation function. The LSS module is concerned with the properties of peaks in Gaussian random fields and halos in a statistical sense, including their peak height, peak curvature, halo bias, and mass function. The halo module deals with spherical overdensity radii and masses, density profiles, concentration, and the splashback radius. To facilitate the rapid exploration of these quantities, Colossus implements more than 40 different fitting functions from the literature. I discuss the core routines in detail, with particular emphasis on their accuracy. Colossus is available at bitbucket.org/bdiemer/colossus.}, archivePrefix = {arXiv}, @@ -54,6 +56,7 @@ @article{colossus year = {2018} } + @article{corner, doi = {10.21105/joss.00024}, url = {https://doi.org/10.21105/joss.00024}, @@ -67,6 +70,7 @@ @article{corner title = {corner.py: Scatterplot matrices in Python}, journal = {The J. Open Source Softw.} } + @article{dynesty, abstract = {We present dynesty, a public, open-source, python package to estimate Bayesian posteriors and evidences (marginal likelihoods) using the dynamic nested sampling methods developed by Higson et al. By adaptively allocating samples based on posterior structure, dynamic nested sampling has the benefits of Markov chain Monte Carlo (MCMC) algorithms that focus exclusively on posterior estimation while retaining nested sampling's ability to estimate evidences and sample from complex, multimodal distributions. We provide an overview of nested sampling, its extension to dynamic nested sampling, the algorithmic challenges involved, and the various approaches taken to solve them in this and previous work. We then examine dynesty's performance on a variety of toy problems along with several astronomical applications. We find in particular problems dynesty can provide substantial improvements in sampling efficiency compared to popular MCMC approaches in the astronomical literature. More detailed statistical results related to nested sampling are also included in the appendix.}, archivePrefix = {arXiv}, @@ -84,6 +88,7 @@ @article{dynesty volume = {493}, year = {2020} } + @article{emcee, abstract = {We introduce a stable, well tested Python implementation of the affine-invariant ensemble sampler for Markov chain Monte Carlo (MCMC) proposed by Goodman {\&} Weare (2010). The code is open source and has already been used in several published projects in the astrophysics literature. The algorithm behind emcee has several advantages over traditional MCMC sampling methods and it has excellent performance as measured by the autocorrelation time (or function calls per independent sample). One major advantage of the algorithm is that it requires hand-tuning of only 1 or 2 parameters compared to {\$}\backslashsim N{\^{}}2{\$} for a traditional algorithm in an N-dimensional parameter space. In this document, we describe the algorithm and the details of our implementation and API. Exploiting the parallelism of the ensemble method, emcee permits any user to take advantage of multiple CPU cores without extra effort. The code is available online at http://dan.iel.fm/emcee under the MIT License.}, archivePrefix = {arXiv}, @@ -100,6 +105,7 @@ @article{emcee volume = {125}, year = {2013} } + @article{matplotlib, Author = {Hunter, J. D.}, Title = {Matplotlib: A 2D graphics environment}, @@ -114,6 +120,7 @@ @article{matplotlib doi = {10.1109/MCSE.2007.55}, year = 2007 } + @ARTICLE{nautilus, author = {{Lange}, Johannes U.}, title = "{NAUTILUS: boosting Bayesian importance nested sampling with deep learning}", @@ -131,6 +138,7 @@ @ARTICLE{nautilus adsurl = {https://ui.adsabs.harvard.edu/abs/2023MNRAS.525.3181L}, adsnote = {Provided by the SAO/NASA Astrophysics Data System} } + @article{numba, abstract = {Dynamic, interpreted languages, like Python, are attractive for domain-experts and scientists experimenting with new ideas. However, the performance of the interpreter is of-ten a barrier when scaling to larger data sets. This paper presents a just-in-time compiler for Python that focuses in scientific and array-oriented computing. Starting with the simple syntax of Python, Numba compiles a subset of the language into efficient machine code that is comparable in performance to a traditional compiled language. In addi-tion, we share our experience in building a JIT compiler using LLVM[1].}, author = {Lam, Siu Kwan and Pitrou, Antoine and Seibert, Stanley}, @@ -144,6 +152,7 @@ @article{numba url = {http://dl.acm.org/citation.cfm?doid=2833157.2833162}, year = {2015} } + @article{numpy, author={S. {van der Walt} and S. C. {Colbert} and G. {Varoquaux}}, doi={10.1109/MCSE.2011.37}, @@ -153,6 +162,7 @@ @article{numpy volume={13}, number={2}, pages={22-30},} + @article{pyautofit, doi = {10.21105/joss.02550}, url = {https://doi.org/10.21105/joss.02550}, @@ -165,6 +175,7 @@ @article{pyautofit title = {`PyAutoFit`: A Classy Probabilistic Programming Language for Model Composition and Fitting}, journal = {J. Open Source Softw.} } + @article{pyautogalaxy, doi = {10.21105/joss.04475}, url = {https://doi.org/10.21105/joss.04475}, @@ -177,6 +188,7 @@ @article{pyautogalaxy title = {PyAutoGalaxy: Open-Source Multiwavelength Galaxy Structure & Morphology}, journal = {J. Open Source Softw.} } + @article{pyautolens, doi = {10.21105/joss.02825}, url = {https://doi.org/10.21105/joss.02825}, @@ -197,6 +209,7 @@ @book{python publisher = {CreateSpace}, address = {Scotts Valley, CA} } + @article{scikit-image, title={scikit-image: image processing in Python}, author={Van der Walt, Stefan and Sch{\"o}nberger, Johannes L and Nunez-Iglesias, Juan and Boulogne, Fran{\c{c}}ois and Warner, Joshua D and Yager, Neil and Gouillart, Emmanuelle and Yu, Tony}, @@ -206,6 +219,7 @@ @article{scikit-image year={2014}, publisher={PeerJ Inc.} } + @article{scikit-learn, title={Scikit-learn: Machine Learning in {P}ython}, author={Pedregosa, F. and Varoquaux, G. and Gramfort, A. and Michel, V. @@ -217,6 +231,7 @@ @article{scikit-learn pages={2825--2830}, year={2011} } + @article{scipy, author = {{Virtanen}, Pauli and {Gommers}, Ralf and {Oliphant}, Travis E. and {Haberland}, Matt and {Reddy}, Tyler and @@ -240,6 +255,7 @@ @article{scipy adsurl = {https://rdcu.be/b08Wh}, doi = {10.1038/s41592-019-0686-2}, } + @misc{sqlite, title={{SQLite}}, url={https://www.sqlite.org/index.html}, @@ -247,6 +263,7 @@ @misc{sqlite year={2020}, author={Hipp, Richard D} } + @article{zeus1, title={zeus: A Python Implementation of the Ensemble Slice Sampling method}, author={Minas Karamanis and Florian Beutler}, @@ -254,6 +271,7 @@ @article{zeus1 note={in prep} } + @article{zeus2, title={Ensemble Slice Sampling}, author={Minas Karamanis and Florian Beutler}, @@ -262,6 +280,7 @@ @article{zeus2 archivePrefix={arXiv}, primaryClass={stat.ML} } + @article{Nightingale2015, abstract = {We present a new pixelized method for the inversion of gravitationally lensed extended source images which we term adaptive semi-linear inversion (SLI). At the heart of the method is an h-means clustering algorithm which is used to derive a source plane pixelization that adapts to the lens model magnification. The distinguishing feature of adaptive SLI is that every pixelization is derived from a random initialization, ensuring that data discretization is performed in a completely different and unique way for every model parameter set. We compare standard SLI on a fixed source pixel grid with the new method and demonstrate the shortcomings of the former when modelling singular power-law ellipsoid (SPLE) lens profiles. In particular, we demonstrate the superior reliability and efficiency of adaptive SLI which, by design, fixes the number of degrees of freedom (NDOF) of the optimization and thereby removes biases present with other methods that allow the NDOF to vary. In addition, we highlight the importance of data discretization in pixel-based inversion methods, showing that adaptive SLI averages over significant systematics that are present when a fixed source pixel grid is used. In the case of the SPLE lens profile, we show how the method successfully samples its highly degenerate posterior probability distribution function with a single nonlinear search. The robustness of adaptive SLI provides a firm foundation for the development of a strong lens modelling pipeline, which will become necessary in the short-term future to cope with the increasing rate of discovery of new strong lens systems.}, archivePrefix = {arXiv}, @@ -279,6 +298,7 @@ @article{Nightingale2015 volume = {452}, year = {2015} } + @article{Nightingale2018, abstract = {This work presents AutoLens, the first entirely automated modeling suite for the analysis of galaxy-scale strong gravitational lenses. AutoLens simultaneously models the lens galaxy's light and mass whilst reconstructing the extended source galaxy on an adaptive pixel-grid. The method's approach to source-plane discretization is amorphous, adapting its clustering and regularization to the intrinsic properties of the lensed source. The lens's light is fitted using a superposition of Sersic functions, allowing AutoLens to cleanly deblend its light from the source. Single-component mass models representing the lens's total mass density profile are demonstrated, which in conjunction with light modeling can detect central images using a centrally cored profile. Decomposed mass modeling is also shown, which can fully decouple a lens's light and dark matter and determine whether the two components are geometrically aligned. The complexity of the light and mass models is automatically chosen via Bayesian model comparison. These steps form AutoLens's automated analysis pipeline, such that all results in this work are generated without any user intervention. This is rigorously tested on a large suite of simulated images, assessing its performance on a broad range of lens profiles, source morphologies, and lensing geometries. The method's performance is excellent, with accurate light, mass, and source profiles inferred for data sets representative of both existing Hubble imaging and future Euclid wide-field observations.}, archivePrefix = {arXiv}, @@ -297,6 +317,7 @@ @article{Nightingale2018 volume = {478}, year = {2018} } + @article{Nightingale2019, abstract = {We investigate how strong gravitational lensing can test contemporary models of massive elliptical (ME) galaxy formation, by combining a traditional decomposition of their visible stellar distribution with a lensing analysis of their mass distribution. As a proof of concept, we study a sample of three ME lenses, observing that all are composed of two distinct baryonic structures, a 'red' central bulge surrounded by an extended envelope of stellar material. Whilst these two components look photometrically similar, their distinct lensing effects permit a clean decomposition of their mass structure. This allows us to infer two key pieces of information about each lens galaxy: (i) the stellar mass distribution (without invoking stellar populations models) and (ii) the inner dark matter halo mass. We argue that these two measurements are crucial to testing models of ME formation, as the stellar mass profile provides a diagnostic of baryonic accretion and feedback whilst the dark matter mass places each galaxy in the context of LCDM large-scale structure formation. We also detect large rotational offsets between the two stellar components and a lopsidedness in their outer mass distributions, which hold further information on the evolution of each ME. Finally, we discuss how this approach can be extended to galaxies of all Hubble types and what implication our results have for studies of strong gravitational lensing.}, archivePrefix = {arXiv}, @@ -315,6 +336,7 @@ @article{Nightingale2019 volume = {489}, year = {2019} } + @article{Anowar2019, author = {Shajib, Anowar J}, title = "{Unified lensing and kinematic analysis for any elliptical mass profile}", @@ -335,6 +357,7 @@ @article{Anowar2019 + @article{dynesty4, title={joshspeagle/dynesty: v2.1.2}, DOI={10.5281/zenodo.7995596}, abstractNote={

This is a bug release mostly concerning the checkpointing. Check the changelog for more details.

}, @@ -342,6 +365,7 @@ @article{dynesty4 author={Sergey Koposov and Josh Speagle and Kyle Barbary and Gregory Ashton and Ed Bennett and Johannes Buchner and Carl Scheffler and Ben Cook and Colm Talbot and James Guillochon and et al.}, year={2023}, month={Jun} } + @software{jax, author = {Bradbury, James and Frostig, Roy and Hawkins, Peter and Johnson, Matthew James and Leary, Chris and Maclaurin, Dougal and Necula, George and Paszke, Adam and VanderPlas, Jake and Wanderman-Milne, Skye and Zhang, Qiao}, title = {{JAX}: composable transformations of {Python}+{NumPy} programs}, @@ -349,6 +373,7 @@ @software{jax year = {2018} } + @software{optax, author = {{DeepMind} and Babuschkin, Igor and Baumli, Kate and Bell, Alison and Bhupatiraju, Surya and Bruce, Jake and Buchlovsky, Peter and Budden, David and Cai, Trevor and Clark, Aidan and Danihelka, Ivo and Fantacci, Claudio and Godwin, Jonathan and Jones, Chris and Hemsley, Ross and Hennigan, Tom and Hessel, Matteo and Hou, Shaobo and Kapturowski, Steven and others}, title = {The {D}eep{M}ind {JAX} Ecosystem}, @@ -356,6 +381,7 @@ @software{optax year = {2020} } + @inproceedings{prodigy, author = {Mishchenko, Konstantin and Defazio, Aaron}, title = {{Prodigy: An Expeditiously Adaptive Parameter-Free Learner}}, @@ -368,6 +394,7 @@ @inproceedings{prodigy year = {2024} } + @article{anesthetic, author = {Handley, Will}, title = {anesthetic: nested sampling visualisation}, @@ -379,6 +406,7 @@ @article{anesthetic year = {2019} } + @article{getdist, author = {Lewis, Antony}, title = {{GetDist}: a {Python} package for analysing {Monte Carlo} samples}, @@ -388,6 +416,7 @@ @article{getdist year = {2019} } + @article{blackjax, author = {Cabezas, Alberto and Corenflos, Adrien and Lao, Junpeng and Louf, R{\'e}mi and others}, title = {{BlackJAX}: Composable {B}ayesian inference in {JAX}}, @@ -397,6 +426,7 @@ @article{blackjax year = {2024} } + @article{coolest, author = {Galan, A. and Vernardos, G. and Minor, Q. and Sluse, D. and {Van de Vyvere}, L. and Gomer, M.}, title = {{Exploiting the diversity of modeling methods to probe systematic biases in strong lensing analyses}}, @@ -407,6 +437,7 @@ @article{coolest year = {2024} } + @inproceedings{networkx, author = {Hagberg, Aric A. and Schult, Daniel A. and Swart, Pieter J.}, title = {Exploring Network Structure, Dynamics, and Function using {NetworkX}}, @@ -417,6 +448,7 @@ @inproceedings{networkx year = {2008} } + @article{tfp, author = {Dillon, Joshua V. and Langmore, Ian and Tran, Dustin and Brevdo, Eugene and Vasudevan, Srinivas and Moore, Dave and Patton, Brian and Alemi, Alex and Hoffman, Matthew D. and Saurous, Rif A.}, title = {{TensorFlow} Distributions}, @@ -426,6 +458,7 @@ @article{tfp year = {2017} } + @software{nufftax, author = {Gragas and Oudoumanessah, Geoffroy and Iollo, Jacopo}, title = {nufftax: Pure {JAX} implementation of the Non-Uniform Fast Fourier Transform}, @@ -433,6 +466,7 @@ @software{nufftax year = {2026} } + @article{finufft, author = {Barnett, Alexander H. and Magland, Jeremy F. and af Klinteberg, Ludvig}, title = {A parallel non-uniform fast {F}ourier transform library based on an 'exponential of semicircle' kernel}, @@ -443,6 +477,7 @@ @article{finufft year = {2019} } + @software{jax_zero_contour, author = {Krawczyk, Coleman}, title = {{CKrawczyk/Jax-Zero-Contour}: Version 2.0.0}, @@ -453,6 +488,7 @@ @software{jax_zero_contour year = {2025} } + @article{Enzi2026, author = {Enzi, Wolfgang J. R. and Krawczyk, Coleman M. and Li, Tian and Collett, Thomas E.}, title = {Gaussian processes on ray-guided transformed uniform grids for fast, flexible, and auto-differentiable adaptive source reconstruction in lens modelling}, @@ -463,3 +499,23 @@ @article{Enzi2026 year = {2026}, url = {https://arxiv.org/abs/2606.30620}, } + +@article{He2024, + author = {He, Qiuhan and Nightingale, James W and Amvrosiadis, Aris and Robertson, Andrew and Cole, Shaun and Frenk, Carlos S and Massey, Richard and Li, Ran and Cao, Xiaoyue and Lange, Samuel C and França, João Paulo C}, + title = {Unveiling lens light complexity with a novel multi-Gaussian expansion approach for strong gravitational lensing}, + journal = {Monthly Notices of the Royal Astronomical Society}, + year = {2024}, + doi = {10.1093/mnras/stae1577}, + volume = {532}, + pages = {2441-2462}, +} + +@article{Oguri2021, + author = {Oguri, Masamune}, + title = {Fast Calculation of Gravitational Lensing Properties of Elliptical Navarro–Frenk–White and Hernquist Density Profiles}, + journal = {Publications of the Astronomical Society of the Pacific}, + year = {2021}, + doi = {10.1088/1538-3873/ac12db}, + volume = {133}, + pages = {074504}, +}