PyAutoLens: Open Source Strong Gravitational Lensing
autolens_workspace now has advanced
packages which make navigation simpler for new users to find beginner scritps.
Redesign of position based lens mass model resampling. This feature now uses a likelihood penalty term based API, which includes a new default approach which traces (y,x) coordinates of multiple images from the image plane to the source plane and decreases the likelihood based on how far part in the source-plane they are (as opposed to resampling the mass model). See this doc for a full descritipon (https://pyautolens.readthedocs.io/en/latest/general/demagnified_solutions.html).
If the position-based likelihood penalty term is not included in a fit using an Inversion
(e.g. pixelized source reconstruction) an exception is raised, because the fit will likely cause a demagnified solution. This can be disabled manually (see https://pyautolens.readthedocs.io/en/latest/general/demagnified_solutions.html).
LightProfileOperated objects implemented, which are already convolved with the imaging dataset's PSF for modeling point source components in a galaxy (see https://github.com/Jammy2211/autolens_workspace/blob/release/scripts/imaging/modeling/advanced/light_parametric_operated__mass_total__source_parametric.py).
Numba is now an optional installation, see this doc page for a full description (https://pyautolens.readthedocs.io/en/latest/installation/numba.html).
Starting point API for starting an MCMC fit with walkers in certain positions or maximum likelihood estimator fit with a start point implemented (https://github.com/rhayes777/PyAutoFit/pull/562). The example tutorial script for this feature is not written yet.
Multiwavelength lens modeling:
Full Likelihood description notebook:
PyAutoGalaxy full release:
Galaxy
, Plane
, Tracer
to and from json via output_to_json
and from_json
methods.Added a step-by-step guide to the log_likelihood_function
:
Documentation showing how to analyze the results of a lens model fit now available on workspace:
https://github.com/Jammy2211/autolens_workspace/tree/release/notebooks/results
The primary new functionality are new source-plane pixelization (Delaunay triangulations and a Voronoi mesh) and regularization schemes which:
These offer a general improvement to the quality of lens modeling using inversions and they correspond to the following classes:
Other features include:
Directly fitting a lens model to a lens model quantity (e.g. the deflection angles, convergence) as opposed to using data (https://github.com/Jammy2211/autolens_workspace/tree/release/scripts/misc/model_quantity).
Cored steep elliptical (CSE) implementation of various stellar and dark matter mass profiles for deflection calculation speed up (https://arxiv.org/pdf/2106.11464.pdf).
Simulating lens datasets where the source signal-to-noise ratio is an input (https://github.com/Jammy2211/autolens_workspace/blob/release/notebooks/imaging/simulators/misc/manual_signal_to_noise_ratio.ipynb).
Note on backwards compatibility
The unique identifers of certain lens model will change as a result of this release, meaning that backwards compatibility may not be possible. We have a tool which updates the identifiers to this version such that existing results can be updated and retained, please contact me on SLACK if this is necessary.
Function Renames
Many core functions have been renamed for conciseness, for example:
deflections_2d_from_grid
-> deflections_2d_from
convergence_2d_from_grid
-> convergence_2d_from
This should not impact general use and the workspace has been updated with new templates using these functions.
Double Source Plane Lens Inversions
Reconstruction of multiple strong lensed sources at different redshifts (e.g. double Einstein ring systems) is now supported, including full model-fitting pipelines. The API for this is a natural extension of the existing API whereby multiple sources are allocated a Pixelization
and Regularization
:
lens = af.Model(
al.Galaxy,
redshift=0.5,
bulge=af.Model(al.lp.EllSersic),
mass=af.Model(al.mp.EllIsothermal)
)
source_0 = af.Model(
al.Galaxy,
redshift=1.0,
mass=al.mp.SphericalIsothermal,
pixelization=al.pix.VoronoiMagnification,
regularization=al.reg.Constant,
)
source_1 = af.Model(
al.Galaxy,
redshift=2.0,
pixelization=al.pix.VoronoiMagnification,
regularization=al.reg.Constant,
)
model = af.Collection(galaxies=af.Collection(lens=lens, source_0=source_0, source_1=source_1))
The following workspace examples demonstrate double source modeling and visualization further:
https://github.com/Jammy2211/autolens_workspace/blob/release/scripts/imaging/modeling/mass_total__source_sis_parametric__source_parametric.py https://github.com/Jammy2211/autolens_workspace/blob/release/scripts/imaging/chaining/double_einstein_ring.py https://github.com/Jammy2211/autolens_workspace/blob/release/scripts/imaging/chaining/pipelines/double_einstein_ring.py
https://github.com/Jammy2211/autolens_workspace/blob/release/scripts/plot/plotters/InversionPlotter.py https://github.com/Jammy2211/autolens_workspace/blob/release/scripts/plot/plotters/FitImagingPlotter.py
Signal To Noise Light Profile Simulations
A class of signal-to-noise based light profiles, accessible via the command al.lp_snr
, are now available. When used to simulate strtong lens imaging, these light profiles automatically adjust their intensity
parameter based on the noise properties simulation to give the desired signal to noise ratio:
bulge=al.lp_snr.EllSersic(
signal_to_noise_ratio=50.0,
centre=(0.0, 0.0),
elliptical_comps=al.convert.elliptical_comps_from(axis_ratio=0.9, angle=45.0),
effective_radius=0.6,
sersic_index=3.0,
),
When combined with a Tracer
the signal to noise of the light profile's image is adjusted based on the ray-traced image, thus it fully accounts for magnification when setting the signal to noise.
A full description of this feature can be found at this link:
W-Tilde Inversion Imaging Formalism
All Imaging Inversion analysis uses a new formalism for the linear algebra, which provides numerically equivalent results to the previous formalism (which is still implemented and used in certain scenarions).
The W-tilde formalism provides a > x3 speed up on high resolution imaging datasets. For example, for HST images with a pixel scale of 0.05" and a circular mask of 3.5", this formalism speeds up the overall run-time of a fit (e.g. one evaluation of the log likelihood function) from 4.8 seconds to 1.55 seconds. For higher resolution data or bigger masks an even more significant speed up is provided.
Users so not need to do anything to activate this formalism, it is now the default method used when an inversion is performed.
Implicit Preloading
Imaging and Interferometer analysis now use implicit preloading, whereby before a model-fit the model is inspected and preloadsare automatically generated for the parts aspects of the model-fit which do not change between each lens model. Previously, these would have been recomputed for every model fit, making the log likelihood evaluation time longer than necessary.
Example quantities which are stored via implicit preloading are:
This will provide significantl speed up for certain lens model fits.
Removed the use of pyquad from the EllipticalIsothermal
mass profile's potential_2d_from_grid
method.
This release switches our versionin scheme to dates of the format year.month.day.release
. This version is shared across all PyAuto
projects.
There is no major new functionality in this release.
This release brings in a number of features for improved model-fitting, all of which come from an updated to PyAutoFit:
search = af.DynestyStatic(
path_prefix=path.join("imaging", "modeling"),
name="mass[sie]_source[bulge]",
unique_tag=dataset_name,
nlive=50,
number_of_cores=1, # Number of cores controls parallelization
)
https://github.com/Jammy2211/autolens_workspace/tree/release/scripts/plot/search
Updated to the unique tag generation, which control the output model folder based on the model, search and name of the dataset.
Improved database tools for querying, including queries based on the name of the specific fit of the non-linear search and the dataset name unique tag.