PyAutoLens
PyAutoLens: Open-Source Strong Gravitational Lensing - Published in JOSS (2021)
Science Score: 100.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 4 DOI reference(s) in README and JOSS metadata -
✓Academic publication links
Links to: arxiv.org, joss.theoj.org -
✓Committers with academic emails
4 of 16 committers (25.0%) from academic institutions -
○Institutional organization owner
-
✓JOSS paper metadata
Published in Journal of Open Source Software
Keywords
astronomy
astrophysics
cosmology
galaxy
gravitational-lenses
gravitational-lensing
image
image-processing
lens-modeling
physics
python
Keywords from Contributors
bayesian-inference
mcmc
probabilistic-programming
bayesian-methods
graphical-models
statistical-analysis
stats
blackhole
pde
meshes
Scientific Fields
Engineering
Computer Science -
60% confidence
Last synced: 4 months ago
·
JSON representation
·
Repository
PyAutoLens: Open Source Strong Gravitational Lensing
Basic Info
- Host: GitHub
- Owner: Jammy2211
- License: mit
- Language: Python
- Default Branch: main
- Homepage: https://pyautolens.readthedocs.io/
- Size: 263 MB
Statistics
- Stars: 173
- Watchers: 15
- Forks: 34
- Open Issues: 18
- Releases: 31
Topics
astronomy
astrophysics
cosmology
galaxy
gravitational-lenses
gravitational-lensing
image
image-processing
lens-modeling
physics
python
Created about 8 years ago
· Last pushed 4 months ago
Metadata Files
Readme
Contributing
License
Code of conduct
Citation
README.rst
PyAutoLens: Open-Source Strong Lensing
======================================
.. |nbsp| unicode:: 0xA0
:trim:
.. |binder| image:: https://mybinder.org/badge_logo.svg
:target: https://mybinder.org/v2/gh/Jammy2211/autolens_workspace/HEAD
.. |RTD| image:: https://readthedocs.org/projects/pyautolens/badge/?version=latest
:target: https://pyautolens.readthedocs.io/en/latest/?badge=latest
:alt: Documentation Status
.. |Tests| image:: https://github.com/Jammy2211/PyAutoLens/actions/workflows/main.yml/badge.svg
:target: https://github.com/Jammy2211/PyAutoLens/actions
.. |Build| image:: https://github.com/Jammy2211/PyAutoBuild/actions/workflows/release.yml/badge.svg
:target: https://github.com/Jammy2211/PyAutoBuild/actions
.. |code-style| image:: https://img.shields.io/badge/code%20style-black-000000.svg
:target: https://github.com/psf/black
.. |JOSS| image:: https://joss.theoj.org/papers/10.21105/joss.02825/status.svg
:target: https://doi.org/10.21105/joss.02825
.. |arXiv| image:: https://img.shields.io/badge/arXiv-1708.07377-blue
:target: https://arxiv.org/abs/1708.07377
|binder| |RTD| |Tests| |Build| |code-style| |JOSS| |arXiv|
`Installation Guide `_ |
`readthedocs `_ |
`Introduction on Binder `_ |
`HowToLens `_
.. image:: https://github.com/Jammy2211/PyAutoLogo/blob/main/gifs/pyautolens.gif?raw=true
:width: 900
When two or more galaxies are aligned perfectly down our line-of-sight, the background galaxy appears multiple times.
This is called strong gravitational lensing and **PyAutoLens** makes it simple to model strong gravitational lenses.
Getting Started
---------------
The following links are useful for new starters:
- `The PyAutoLens readthedocs `_: which includes `an overview of PyAutoLens's core features `_, `a new user starting guide `_ and `an installation guide `_.
- `The introduction Jupyter Notebook on Binder `_: try **PyAutoLens** in a web browser (without installation).
- `The autolens_workspace GitHub repository `_: example scripts and the HowToLens Jupyter notebook lectures.
Support
-------
Support for installation issues, help with lens modeling and using **PyAutoLens** is available by
`raising an issue on the GitHub issues page `_.
We also offer support on the **PyAutoLens** `Slack channel `_, where we also provide the
latest updates on **PyAutoLens**. Slack is invitation-only, so if you'd like to join send
an `email `_ requesting an invite.
HowToLens
---------
For users less familiar with gravitational lensing, Bayesian inference and scientific analysis
you may wish to read through the **HowToLens** lectures. These teach you the basic principles of gravitational lensing
and Bayesian inference, with the content pitched at undergraduate level and above.
A complete overview of the lectures `is provided on the HowToLens readthedocs page `_
API Overview
------------
Lensing calculations are performed in **PyAutoLens** by building a ``Tracer`` object from ``LightProfile``,
``MassProfile`` and ``Galaxy`` objects. Below, we create a simple strong lens system where a redshift 0.5
lens ``Galaxy`` with an ``Isothermal`` ``MassProfile`` lenses a background source at redshift 1.0 with an
``Exponential`` ``LightProfile`` representing a disk.
.. code-block:: python
import autolens as al
import autolens.plot as aplt
from astropy import cosmology as cosmo
"""
To describe the deflection of light by mass, two-dimensional grids of (y,x) Cartesian
coordinates are used.
"""
grid = al.Grid2D.uniform(
shape_native=(50, 50),
pixel_scales=0.05, # <- Conversion from pixel units to arc-seconds.
)
"""
The lens galaxy has an elliptical isothermal mass profile and is at redshift 0.5.
"""
mass = al.mp.Isothermal(
centre=(0.0, 0.0), ell_comps=(0.1, 0.05), einstein_radius=1.6
)
lens_galaxy = al.Galaxy(redshift=0.5, mass=mass)
"""
The source galaxy has an elliptical exponential light profile and is at redshift 1.0.
"""
disk = al.lp.Exponential(
centre=(0.3, 0.2),
ell_comps=(0.05, 0.25),
intensity=0.05,
effective_radius=0.5,
)
source_galaxy = al.Galaxy(redshift=1.0, disk=disk)
"""
We create the strong lens using a Tracer, which uses the galaxies, their redshifts
and an input cosmology to determine how light is deflected on its path to Earth.
"""
tracer = al.Tracer(
galaxies=[lens_galaxy, source_galaxy],
cosmology = al.cosmo.Planck15()
)
"""
We can use the Grid2D and Tracer to perform many lensing calculations, for example
plotting the image of the lensed source.
"""
tracer_plotter = aplt.TracerPlotter(tracer=tracer, grid=grid)
tracer_plotter.figures_2d(image=True)
With **PyAutoLens**, you can begin modeling a lens in minutes. The example below demonstrates a simple analysis which
fits the lens galaxy's mass with an ``Isothermal`` and the source galaxy's light with a ``Sersic``.
.. code-block:: python
import autofit as af
import autolens as al
import autolens.plot as aplt
"""
Load Imaging data of the strong lens from the dataset folder of the workspace.
"""
dataset = al.Imaging.from_fits(
data_path="/path/to/dataset/image.fits",
noise_map_path="/path/to/dataset/noise_map.fits",
psf_path="/path/to/dataset/psf.fits",
pixel_scales=0.1,
)
"""
Create a mask for the imaging data, which we setup as a 3.0" circle, and apply it.
"""
mask = al.Mask2D.circular(
shape_native=dataset.shape_native,
pixel_scales=dataset.pixel_scales,
radius=3.0
)
dataset = dataset.apply_mask(mask=mask)
"""
We model the lens galaxy using an elliptical isothermal mass profile and
the source galaxy using an elliptical sersic light profile.
To setup these profiles as model components whose parameters are free & fitted for
we set up each Galaxy as a `Model` and define the model as a `Collection` of all galaxies.
"""
# Lens:
mass = af.Model(al.mp.Isothermal)
lens = af.Model(al.Galaxy, redshift=0.5, mass=lens_mass_profile)
# Source:
disk = af.Model(al.lp.Sersic)
source = af.Model(al.Galaxy, redshift=1.0, disk=disk)
# Overall Lens Model:
model = af.Collection(galaxies=af.Collection(lens=lens, source=source))
"""
We define the non-linear search used to fit the model to the data (in this case, Dynesty).
"""
search = af.Nautilus(name="search[example]", n_live=50)
"""
We next set up the `Analysis`, which contains the `log likelihood function` that the
non-linear search calls to fit the lens model to the data.
"""
analysis = al.AnalysisImaging(dataset=dataset)
"""
To perform the model-fit we pass the model and analysis to the search's fit method. This will
output results (e.g., dynesty samples, model parameters, visualization) to hard-disk.
"""
result = search.fit(model=model, analysis=analysis)
"""
The results contain information on the fit, for example the maximum likelihood
model from the Dynesty parameter space search.
"""
print(result.samples.max_log_likelihood())
Owner
- Name: James Nightingale
- Login: Jammy2211
- Kind: user
- Location: Durham
- Company: Durham University
- Website: www.jamesnightingale.net
- Repositories: 16
- Profile: https://github.com/Jammy2211
Postdoc in Astronomy at Durham University Developer of PyAutoLens
JOSS Publication
PyAutoLens: Open-Source Strong Gravitational Lensing
Published
February 20, 2021
Volume 6, Issue 58, Page 2825
Authors
Richard G. Hayes
Institute for Computational Cosmology, Stockton Rd, Durham DH1 3LE
Institute for Computational Cosmology, Stockton Rd, Durham DH1 3LE
Amy Etherington
Institute for Computational Cosmology, Stockton Rd, Durham DH1 3LE
Institute for Computational Cosmology, Stockton Rd, Durham DH1 3LE
Nan Li
Key Laboratory of Space Astronomy and Technology, National Astronomical Observatories, Chinese Academy of Sciences, Beijing 100101, China
Key Laboratory of Space Astronomy and Technology, National Astronomical Observatories, Chinese Academy of Sciences, Beijing 100101, China
XiaoYue Cao
National Astronomical Observatories, Chinese Academy of Sciences, 20A Datun Road, Chaoyang District, Beijing 100012, China
National Astronomical Observatories, Chinese Academy of Sciences, 20A Datun Road, Chaoyang District, Beijing 100012, China
Andrea Enia
Dipartimento di Fisica e Astronomia, Università degli Studi di Bologna, Via Berti Pichat 6/2, I-40127 Bologna, Italy
Dipartimento di Fisica e Astronomia, Università degli Studi di Bologna, Via Berti Pichat 6/2, I-40127 Bologna, Italy
David R. Harvey
Lorentz Institute, Leiden University, Niels Bohrweg 2, Leiden, NL-2333 CA, The Netherlands
Lorentz Institute, Leiden University, Niels Bohrweg 2, Leiden, NL-2333 CA, The Netherlands
Ran Li
National Astronomical Observatories, Chinese Academy of Sciences, 20A Datun Road, Chaoyang District, Beijing 100012, China
National Astronomical Observatories, Chinese Academy of Sciences, 20A Datun Road, Chaoyang District, Beijing 100012, China
Tags
astronomy gravitational lensing galaxies cosmologyCitation (CITATIONS.rst)
.. _references:
Citations & References
======================
The bibtex entries for **PyAutoLens** and its affiliated software packages can be found
`here <https://github.com/Jammy2211/PyAutoLens/blob/main/files/citations.bib>`_, with example text for citing **PyAutoLens**
in `.tex format here <https://github.com/Jammy2211/PyAutoLens/blob/main/files/citations.tex>`_ format here and
`.md format here <https://github.com/Jammy2211/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. Dynesty, Emcee, PySwarms, 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.
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 ``GeneralizedNFW`` please cite the following paper https://academic.oup.com/mnras/article/488/1/1387/5526256 under
citation key ``Anowar2019``.
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] ;).
GitHub Events
Total
- Create event: 63
- Release event: 4
- Issues event: 7
- Watch event: 11
- Delete event: 64
- Member event: 1
- Issue comment event: 14
- Push event: 137
- Pull request review comment event: 5
- Pull request review event: 11
- Pull request event: 81
- Fork event: 2
Last Year
- Create event: 63
- Release event: 4
- Issues event: 7
- Watch event: 11
- Delete event: 64
- Member event: 1
- Issue comment event: 14
- Push event: 137
- Pull request review comment event: 5
- Pull request review event: 11
- Pull request event: 81
- Fork event: 2
Committers
Last synced: 5 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Richard Hayes | r****7@g****m | 11,166 |
| Jammy2211 | j****e@d****k | 7,878 |
| Jammy2211 | J****1@g****m | 66 |
| amyetherington | a****5@h****m | 40 |
| Jonathan Frawley | j****y@d****k | 15 |
| Richard Hayes | r****s@R****n | 8 |
| Nan Li | l****6@g****m | 7 |
| ashkelly | a****y@d****k | 4 |
| Juanjo Bazán | j****n@g****m | 3 |
| Raghavendra Kaushik | 4****r | 2 |
| Richard Hayes | r****s@R****l | 2 |
| AlexKurek | a****k@u****l | 1 |
| Arfon Smith | a****n | 1 |
| Kian-Meng Ang | k****g@c****g | 1 |
| a-mere-peasant | 5****t | 1 |
| dependabot[bot] | 4****] | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 4 months ago
All Time
- Total issues: 61
- Total pull requests: 207
- Average time to close issues: about 1 year
- Average time to close pull requests: 6 days
- Total issue authors: 17
- Total pull request authors: 13
- Average comments per issue: 3.31
- Average comments per pull request: 0.14
- Merged pull requests: 189
- Bot issues: 0
- Bot pull requests: 1
Past Year
- Issues: 6
- Pull requests: 81
- Average time to close issues: about 2 months
- Average time to close pull requests: 5 days
- Issue authors: 1
- Pull request authors: 2
- Average comments per issue: 1.33
- Average comments per pull request: 0.1
- Merged pull requests: 77
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- Jammy2211 (38)
- AstroAaron (5)
- zonca (2)
- joaofrancafisica (2)
- linan7788626 (2)
- rhayes777 (2)
- aureliocarnero (1)
- felavila (1)
- HRSAstro (1)
- AndreaEnia (1)
- allangabrielsch (1)
- MAX22110 (1)
- LovelyBuggies (1)
- PeterEDz (1)
- AndreaDosiUniversity (1)
Pull Request Authors
- Jammy2211 (183)
- rhayes777 (64)
- jonathanfrawley (4)
- xuanxu (2)
- a-mere-peasant (2)
- AlexKurek (2)
- vardaan-raj (1)
- kianmeng (1)
- rakaar (1)
- agarwalutkarsh554 (1)
- arfon (1)
- dependabot[bot] (1)
- pranath-reddy (1)
Top Labels
Issue Labels
good first issue (3)
enhancement (2)
Pull Request Labels
dependencies (1)
Packages
- Total packages: 1
-
Total downloads:
- pypi 2,832 last-month
- Total dependent packages: 0
- Total dependent repositories: 2
- Total versions: 372
- Total maintainers: 2
pypi.org: autolens
Open-Source Strong Lensing
- Homepage: https://github.com/Jammy2211/PyAutoLens
- Documentation: https://autolens.readthedocs.io/
- License: mit
-
Latest release: 1.15.3
published over 4 years ago
Rankings
Stargazers count: 5.9%
Dependent packages count: 7.4%
Forks count: 7.8%
Downloads: 7.9%
Average: 8.2%
Dependent repos count: 11.9%
Last synced:
4 months ago
Dependencies
.github/workflows/main.yml
actions
- actions/checkout v2 composite
- actions/setup-python v2 composite
- slackapi/slack-github-action v1.21.0 composite
docs/requirements.txt
pypi
- autoconf *
- furo *
- myst-parser *
- numba *
- pyprojroot ==0.2.0
- sphinx ==5.2.3
- sphinx_autodoc_typehints *
- sphinx_copybutton *
- sphinx_design *
- sphinx_inline_tabs *
optional_requirements.txt
pypi
- getdist ==1.4
- jax ==0.3.1
- jaxlib ==0.3.0
- numba *
- pylops >=1.10.0,<=1.18.3
- pynufft *
- ultranest ==3.2.0
- zeus-mcmc ==2.4.1
autolens/analysis/setup.py
pypi
requirements.txt
pypi
- nautilus-sampler ==0.7.4
setup.py
pypi