Source-linked AI summary

Lenstronomy: multi-purpose gravitational lens modelling software package

Simon Birrer, Adam Amara

arXiv:1803.09746v2astro-ph.CO

TL;DR

Strong-lensing analyses need flexible modelling tools as data and scientific applications expand. Lenstronomy addresses this need with an open-source, modular Python package for lens, light, point-source, and image modelling. It has been used for cosmography, dark-matter studies, cosmic-shear measurements, and source reconstruction, while requiring rigorous validation for each application.

  • Problem

    Expanding strong-lensing datasets require modelling tools that support diverse analyses, independent cross-checks, and processing from individual systems to large survey samples.

  • Method

    Lenstronomy combines modular lens, light, point-source, data, and image-simulation components with numerical tools for reconstruction, optimization, and inference.

  • Results

    Lenstronomy has been used for time-delay cosmography, dark-matter substructure studies, Einstein-ring cosmic-shear measurements, and source reconstruction that compared well with SLIT in speed and accuracy.

  • Takeaways & Limitations

    The package provides integrated support for a wide range of strong-lensing studies and transparent comparison with other modelling software.

  • Takeaways & Limitations

    Users must choose and rigorously test the modelling method for each system, preferably with simulations, and source resolution must be sufficiently high to avoid misattributing residuals to substructure.

Abstract

from arXiv · show

We present Lenstronomy, a multi-purpose open-source gravitational lens modeling python package. Lenstronomy is able to reconstruct the lens mass and surface brightness distributions of strong lensing systems using forward modelling. Lenstronomy supports a wide range of analytic lens and light models in arbitrary combination. The software is also able to reconstruct complex extended sources (Birrer et. al 2015) as well as being able to model point sources. We designed Lenstronomy to be stable, flexible and numerically accurate, with a clear user interface that could be deployed across different platforms. Throughout its development, we have actively used Lenstronomy to make several measurements including deriving constraints on dark matter properties in strong lenses, measuring the expansion history of the universe with time-delay cosmography, measuring cosmic shear with Einstein rings and decomposing quasar and host galaxy light. The software is distributed under the MIT license. The documentation, starter guide, example notebooks, source code and installation guidelines can be found at https://lenstronomy.readthedocs.io.

1. Introduction

Lenstronomy is introduced as an open-source, multi-purpose strong-lensing package developed to exploit expanding lens samples and support precision measurements. Its modular, flexible design targets diverse applications, independent cross-checks, and future large-scale processing.

  • Motivation: Strong-lensing data probe matter distribution and universe geometry, motivating improved modelling tools as lens samples expand.Applications include constraints on dark matter properties and measurements of the Hubble constant.
  • Contribution: Lenstronomy is a public, open-source package used for time-delay cosmography, substructure analysis, Einstein-ring shear measurements, and pixel-level HST modelling.The software was used as a research tool throughout its development.
  • Design goals: The software was designed for stability, flexibility, numerical accuracy, and a clear API that scales from individual lenses to hundreds of survey lenses.Its API is intended for use across different platforms.
  • Community role: Its public release enables transparent comparison with other strong-lensing software and supports independent pipeline cross-checks for precision measurements.The motivation is control of systematic errors in complex analyses.
  • Capabilities: Lenstronomy supports linear Shapelet source reconstruction, Particle Swarm Optimization, and MCMC Bayesian inference across varied lens, source, and image complexities.The package supports broad angular scales and diverse science applications.

2. Package overview

Lenstronomy is a Python package organized around modular lens-modelling components, with public deployment infrastructure and documentation. Its independent core modules can operate separately while remaining integrated for complete modelling workflows.

  • Deployment: Lenstronomy is distributed under the MIT license through Python tooling and uses NumPy, SciPy, Astropy, Matplotlib, and CosmoHammer.CosmoHammer supports MPI and parallelized emcee inference.
  • Deployment: The package is coordinated on GitHub, released through PyPI, and designed to let third parties share dependent packages, routines, and workflows.The text states compatibility with Python 2 and Python 3.
  • Documentation and testing: Continuous integration, cross-platform virtual-environment tests, public coverage reports, Sphinx documentation, and Jupyter examples support development and use.Starter guidance and application examples are provided through an extension module.
  • Architecture: Core modules provide distinct tasks through well-defined APIs, including lensing, light, point-source, data, image-simulation, sampling, and kinematic functionality.The listed modules divide major modelling responsibilities.
  • Architecture: Each core module can be used independently, while integrated support connects the individual tasks into complete lens-modelling workflows.Extension modules are also available.

3. Core modules of lenstronomy

The core lens-modelling functionality centers on LensModel, which supports flexible single- and multi-plane calculations and lens-equation solving through a consistent API. Examples demonstrate model setup, ray tracing, magnification, and image-position computation.

  • LensModel: LensModel performs ray shooting, lens-equation solving, arrival-time computation, and nonlinear lens-model optimization.It supports arbitrary superpositions of lens models in single- and multi-plane configurations.
  • LensModel: LensModel computes deflection angles, lensing potentials, Hessian matrices, shear, convergence, and magnification-compatible lensing quantities.These routines accept NumPy arrays and arbitrary numbers of superposed lens models.
  • LensModel: The same LensModel API supports single-plane and multi-plane configurations, including deflectors placed at different redshifts.The multi-plane example specifies deflector and source redshifts.
  • Lens-equation solving: The lens-equation solver returns multiple image positions for a specified source position using a general LensModel instance.The example also evaluates point-source image magnifications.
  • Examples: Figure 2 illustrates single- and multi-plane models using convergence maps, critical curves, caustics, source positions, and image positions.The source and corresponding solutions are marked in the figure.

3.2. LightModel module

LightModel describes lens and source surface brightness with analytic profiles and Shapelet bases, while PointSource handles point-source positions and fluxes through a consistent interface. Examples show separate lens and source light models and alternative point-source parameterizations.

  • LightModel: LightModel represents galaxy surface brightness using varied analytic profiles, Shapelet basis sets, and arbitrary superpositions.The full profile list and parameterizations are provided in the documentation.
  • LightModel: The example uses spherical and elliptical Sersic profiles for source and lens light, respectively, and evaluates surface brightness at a chosen position.The lens and source LightModel instances are later used in image modelling.
  • PointSource: PointSource provides a homogeneous API for point-source image positions and magnifications across image-plane and source-plane parameterizations.It requires a LensModel instance.
  • PointSource: Source-plane point-source models can return lensed image positions and amplitudes, while image-plane models can allow individual magnification variations.The examples instantiate both parameterization types.

3.4. Data module

The Data and ImSim components organize imaging information and combine lens, light, point-source, and data models to render numerically accurate images. They support subpixel ray-tracing, PSF convolution, noise modelling, and linear inversion for fitting.

  • The Data class manages coordinate frames, pixel transformations, imaging data, and noise properties, while PSF handles analytic or pixelized convolution kernels.
  • ImageModel combines LensModel, LightModel, PointSource, and Data to model images, with ImageNumerics executing numerical options.
  • Subpixel ray-tracing and high-resolution PSF convolution improve accuracy for small lensing perturbations or highly variable surface-brightness profiles.
  • The ImSim workflow can simulate model images, add Poisson and background noise, and reconstruct linear surface-brightness parameters from noisy data.
  • The likelihood combines model predictions with pixel noise, using Gaussian background and Poisson count-statistics terms; masks, extra errors, and covariance marginalization are supported.

3.6. Sampling module

The Sampling module connects lenstronomy’s likelihood and parameter conventions to nonlinear optimization and Bayesian inference, while allowing external samplers and modelling constraints. Its interfaces support fixed, linear, joint, bounded, multiband, and additional-data configurations.

  • The Sampling module manages nonlinear fitting and parameter inference while allowing users to plug in customized samplers.
  • 3.6.1. Parameter handling: Param translates lenstronomy keyword-argument parameters into standardized arrays for external samplers and back again.
  • 3.6.1. Parameter handling: Parameter handling supports fixed parameters, linear-parameter treatment, and additional modelling constraints such as linking source and point-source positions.
  • LikelihoodModule combines ImSim and Param, executes likelihoods from ordered parameter arrays, and supports multiband data and time-delay measurements.
  • The sampling workflow demonstrates Particle Swarm Optimization with configurable initial parameter values, spreads, hard bounds, and lower or upper parameter ranges.

3.7. Workflow module

The Workflow module sequences PSO and/or MCMC fitting runs, passing results between routines and allowing selected model components or PSF optimization to vary across the sequence.

  • FittingSequence chains PSO and/or MCMC runs by using each routine’s results as the next routine’s input.
  • Users can keep selected lens, source, or light-model parameter classes fixed during individual fitting runs.
  • Iterative PSF optimization can be inserted into the fitting sequence.

3.8. GalKin module

GalKin adds self-consistent lens-galaxy kinematics modelling to constrain lens models, using surface-brightness and lens-model information. It requires assumptions about three-dimensional light and mass profiles, and not all model combinations are analytically supported.

  • GalKin predicts the lensing galaxy’s velocity dispersion from its surface-brightness profile and lens model.
  • Kinematic modelling requires knowledge or assumptions about the lens galaxy’s three-dimensional light and mass profiles.
  • The available analytic treatment does not cover all combinations of lens and light models.

4. Modelling examples

Lenstronomy’s modular design supports source reconstruction, de-convolution, structural analysis, quasar-host decomposition, and multiband fitting through combined modelling components.

  • Modelling examples: Five examples demonstrate source reconstruction, image de-convolution, galaxy structural analysis, quasar-host decomposition, and multiband fitting.Detailed workflows are provided in the online documentation.
  • Source reconstruction: Shapelet reconstruction with nmax = 29 represents complex image features and reproduces the input galaxy’s macroscopic morphology.The required reconstruction complexity depends on galaxy type, resolution, and signal-to-noise.
  • Source reconstruction: The source reconstruction performs well in speed and accuracy compared with SLIT, while supporting analytical models combined with basis sets.Bayesian evidence optimization is left to user post-processing.
  • Image de-convolution: Source reconstruction combines de-lensing, a nonlinear image-to-source mapping, with de-convolution through linear inversion.Removing lens models from ImSim makes the same inversion perform de-convolution alone.
  • Galaxy structural analysis: Lenstronomy extracts structural components from lensed or unlensed galaxies and provides MCMC-based parameter covariances.Its structural-analysis flexibility is described as similar to GALFIT, with a Python open-source alternative.
  • Quasar-host decomposition: Joint fitting recovers a two-component Sérsic host galaxy and a significantly brighter central quasar.The model separates the components and supports their subtraction from the data.
  • Multiband fitting: Multiband fitting shares coordinate systems and APIs across an arbitrary number of datasets, with iterative alignment available for differing coordinate frames.The Multiband class works with Sampling and Workflow modules.

5. Science applications of lenstronomy

Lenstronomy enables strong-lensing applications spanning substructure, cosmography, and cosmic shear, while requiring users to test system-specific modelling choices and systematics.

  • Science applications: Science examples cover substructure lensing, time-delay cosmography, and cosmic shear measurements with Einstein rings.The section highlights settings required for these application domains.
  • Science applications: The expanding diversity of strong-lensing systems supports applications including lensed supernova cosmography, microlensing, double source-plane cosmography, and Einstein-ring shear.These applications are presented as examples of topics enabled by larger lens samples.
  • Methodological boundary: Users remain responsible for modelling choices and should rigorously test specific methods, preferably with simulations.Lenstronomy can generate accurate complex mock data to explore analysis systematics.
  • Substructure lensing: Substructure models can combine arbitrary lens profiles, including NFW and truncated NFW components, with multi-plane lensing.An arbitrary number of profiles based on a mass function can be superposed.
  • Substructure lensing: Sub-grid ray tracing and sufficiently resolved source brightness models are needed to capture milliarcsecond deflection effects without confusing source-reconstruction residuals for substructure.Higher numerical accuracy carries computational cost, and source resolution was enhanced around proposed clumps in prior work.
  • Time-delay cosmography: The workflow API supports exploring lensing degeneracies and their impact on cosmographic inference across varied model settings.Examples include mapping source-size degeneracy and combining 128 settings using relative Bayesian Information Criteria.
  • Cosmic shear measurements: Einstein-ring modelling in COSMOS constrained nonlinear shear distortions to very high precision and was designed to scale to hundreds or thousands of future lenses.The projected surveys would provide complementary cosmic-shear measurements.

6. Conclusion

The paper presents Lenstronomy as a modular, open-source Python package for diverse lens-modelling studies, with public distribution and documentation.

  • Conclusion: Lenstronomy is a multi-purpose open-source Python lens-modelling package whose modular design supports diverse scientific studies.The paper illustrates its capabilities through modelling and science examples.
  • Conclusion: Applications include studying cosmic expansion through time-delay cosmography and probing dark-matter properties through substructure lensing.The software is actively used and maintained.
  • Conclusion: The software is distributed under the MIT license, with stable releases, source code, installation guidance, starter materials, and example notebooks available online.The latest release is distributed through the Python Packaging Index.

Appendix A. Publicly available lens modelling software

The appendix lists publicly available lens-modelling software and briefly distinguishes their stated modelling approaches, inference methods, computational platforms, and application scopes.

  • Appendix A: The appendix directs readers to the literature and online documentation for each listed package’s scope and development status.The catalogue is not presented as a detailed comparative evaluation.
  • Appendix A: gravlens offers standard lens calculations and strong-lens modelling extensions, while lenstool models galaxy and cluster mass distributions with Bayesian inference.Both are described as established lens-modelling tools.
  • Appendix A: PixeLens reconstructs lenses from multiply imaged point sources and explores ensembles of models consistent with several systems.Its stated scope centers on point-source lens reconstruction.
  • Appendix A: glafic supports many mass and parametric light models and simulates lensed extended images with PSF convolution.Its description emphasizes model breadth and image simulation.
  • Appendix A: LENSED performs forward parametric strong-lens modelling and supports GPU computation, whereas AutoLens uses adaptive-grid source reconstruction.The listed packages represent different computational and source-modelling strategies.
  • Appendix A: Ensai estimates strong-lens parameters with convolutional neural networks, while pySPT quantifies systematic errors from the Source Position Transformation.Their stated purposes are parameter estimation and systematic-error analysis, respectively.
Loading 1803.09746v2…