LensFactory.jl
Introduction
LensFactory is an efficient, open-source, general-purpose strong gravitational lens modeling package written in Julia. It supports single- and multi-plane lensing with a wide range of analytic lens profiles, and reconstructs lens mass distributions from multiple-image constraints — scaling from galaxy-scale lenses up to full galaxy-cluster reconstructions.
Installation
To install, activate pkg mode by pressing ] in Julia REPL and then type:
pkg> add LensFactoryTo use the LensFactory package in your current Julia session, type:
julia> using LensFactoryQuick start
using LensFactory
# Initialize the default cosmology
cosmo = Cosmology.init_cosmology()
# Lens and source redshifts
zl = 0.5
zs = 1.5
# Angular diameter distances and distance ratio
Dol = Cosmology.angular_diameter_distance(cosmo, 0., zl)
Dls = Cosmology.angular_diameter_distance(cosmo, zl, zs)
Dos = Cosmology.angular_diameter_distance(cosmo, 0., zs)
adis = Dls/Dos
# Initialize a point mass lens of mass 10^12 Solar mass
lens = Lenses.init_PointLens(D_d=Dol, mass=1E12)
# An arbitrary position (in arcseconds) in the image plane
x, y = 1.23, 0.57
# Get lens potential at the above position
pot = Lenses.get_potential(lens, x, y)
# Get scaled deflection component
dx, dy = Lenses.get_deflection(lens, x, y)
# Get (signed) magnification
mu = Lenses.get_magnification_image(lens, x, y, adis)Examples
To understand the use of various modules and functions in LensFactory, readers are encouraged to go through the examples here: LensFactory_Examples. Please keep in mind that LensFactory is in heavy developement and examples are validated with the current dev version. If any of the examples are not working, please let me know.
Citation
If you use LensFactory.jl in your research, please cite:
@ARTICLE{LensFactory.jl,
author = {{Meena}, Ashish Kumar},
title = "{$\texttt{LensFactory.jl}$: A general-purpose strong lens modeling package}",
journal = {arXiv e-prints},
keywords = {Cosmology and Nongalactic Astrophysics},
year = 2026,
month = sep,
eid = {arXiv:2609.08649},
pages = {arXiv:2609.08649},
archivePrefix = {arXiv},
eprint = {2609.08649},
primaryClass = {astro-ph.CO},
adsurl = {https://ui.adsabs.harvard.edu/abs/2026arXiv260908649M},
adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}Feedback
Bug reports and feature requests are welcome via GitHub issues. For questions, suggestions, or comments, feel free to email akm@iisc.ac.in or ashishmeena766@gmail.com.