Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
224 changes: 76 additions & 148 deletions docs/general/citations.md
Original file line number Diff line number Diff line change
@@ -1,150 +1,78 @@
(references)=
<span id="citations--references"></span>
<span id="citations-references"></span>

# 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 (<https://academic.oup.com/mnras/article/452/3/2940/1749640> and <https://academic.oup.com/mnras/article-abstract/478/4/4738/5001434?redirectedFrom=fulltext>) 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 <https://github.com/konstmish/prodigy> and the preprint
at <https://arxiv.org/abs/2306.06101>.

## 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 <https://github.com/CKrawczyk/Jax-Zero-Contour> and archived at
<https://doi.org/10.5281/zenodo.15730415>.

## 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 <https://github.com/GragasLab/nufftax>.

## Rectangular Mesh (Pixelized Source Reconstructions)

If you reconstruct a source using the adaptive rectangular meshes (`RectangularAdaptDensity` or
`RectangularAdaptImage`), you **must cite** the following paper <https://arxiv.org/abs/2606.30620> 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 <https://arxiv.org/abs/2106.11464> 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 <https://academic.oup.com/mnras/article/488/1/1387/5526256> 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.

<span id="dynesty"></span>

## 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.

<span id="jax"></span>

<span id="jax-zero-contour"></span>

<span id="nufftax"></span>

## 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`.

<span id="rectangular-mesh-pixelized-source-reconstructions"></span>

<span id="rectangular-mesh-pixelized-reconstructions"></span>

## 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.

<span id="mass-models"></span>

## 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.

<span id="science-papers"></span>

## 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.
117 changes: 104 additions & 13 deletions docs/general/configs.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,115 @@
# Configs
<span id="configs"></span>

**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.

<span id="setup"></span>

## 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.
Loading
Loading