Metadata-Version: 2.1
Name: autolens
Version: 0.27.0
Summary: Automated Strong Gravitational Lens Modeling
Home-page: https://github.com/Jammy2211/PyAutoLens
Author: James Nightingale and Richard Hayes
Author-email: james.w.nightingale@durham.ac.uk
License: MIT License
Keywords: cli
Platform: UNKNOWN
Classifier: Intended Audience :: Science/Research
Classifier: Topic :: Scientific/Engineering :: Physics
Classifier: License :: OSI Approved :: MIT License
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.2
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Description-Content-Type: text/markdown
Requires-Dist: autofit (==0.31.4)
Requires-Dist: argh (==0.26.2)
Requires-Dist: asteval (==0.9.12)
Requires-Dist: astropy (==3.0)
Requires-Dist: attrs (==17.4.0)
Requires-Dist: backcall (==0.1.0)
Requires-Dist: bleach (==2.1.3)
Requires-Dist: black (==19.3b0)
Requires-Dist: blackcellmagic (==0.0.2)
Requires-Dist: certifi (==2018.1.18)
Requires-Dist: cffi (==1.11.5)
Requires-Dist: chardet (==3.0.4)
Requires-Dist: cmarkgfm (==0.4.2)
Requires-Dist: colorama (==0.3.9)
Requires-Dist: cycler (==0.10.0)
Requires-Dist: decorator (==4.2.1)
Requires-Dist: dill (==0.2.8.2)
Requires-Dist: docopt (==0.6.2)
Requires-Dist: docutils (==0.14)
Requires-Dist: entrypoints (==0.2.3)
Requires-Dist: future (==0.16.0)
Requires-Dist: GetDist (==0.2.8)
Requires-Dist: html5lib (==1.0.1)
Requires-Dist: idna (==2.7)
Requires-Dist: ipykernel (==5.1.0)
Requires-Dist: ipython (==7.0.1)
Requires-Dist: ipython-genutils (==0.2.0)
Requires-Dist: ipywidgets (==7.2.1)
Requires-Dist: jedi (==0.12.0)
Requires-Dist: Jinja2 (==2.10)
Requires-Dist: jsonschema (==2.6.0)
Requires-Dist: jupyter (==1.0.0)
Requires-Dist: jupyter-client (==5.2.3)
Requires-Dist: jupyter-console (==5.2.0)
Requires-Dist: jupyter-core (==4.4.0)
Requires-Dist: kiwisolver (==1.0.1)
Requires-Dist: llvmlite (==0.27.0)
Requires-Dist: lmfit (==0.9.10)
Requires-Dist: MarkupSafe (==1.0)
Requires-Dist: matplotlib (==3.0.3)
Requires-Dist: mistune (==0.8.3)
Requires-Dist: nbconvert (==5.3.1)
Requires-Dist: nbformat (==4.4.0)
Requires-Dist: networkx (==2.1)
Requires-Dist: notebook (==5.4.1)
Requires-Dist: numba (==0.42.1)
Requires-Dist: numpy (==1.16.2)
Requires-Dist: pandocfilters (==1.4.2)
Requires-Dist: parso (==0.2.1)
Requires-Dist: pathtools (==0.1.2)
Requires-Dist: pexpect (==4.5.0)
Requires-Dist: pickleshare (==0.7.4)
Requires-Dist: Pillow (==5.1.0)
Requires-Dist: pkginfo (==1.4.2)
Requires-Dist: pluggy (==0.6.0)
Requires-Dist: prompt-toolkit (==2.0.6)
Requires-Dist: ptpython (==0.41)
Requires-Dist: ptyprocess (==0.5.2)
Requires-Dist: py (==1.5.2)
Requires-Dist: pycparser (==2.19)
Requires-Dist: Pygments (==2.2.0)
Requires-Dist: pymultinest (==2.6)
Requires-Dist: pyquad (==0.0.4.0)
Requires-Dist: pyparsing (==2.2.0)
Requires-Dist: pytest (==3.4.2)
Requires-Dist: pytest-watch (==4.2.0)
Requires-Dist: python-dateutil (==2.6.1)
Requires-Dist: pytz (==2018.3)
Requires-Dist: PyWavelets (==0.5.2)
Requires-Dist: PyYAML (==3.12)
Requires-Dist: pyzmq (==17.0.0)
Requires-Dist: qtconsole (==4.3.1)
Requires-Dist: readme-renderer (==22.0)
Requires-Dist: requests (==2.19.1)
Requires-Dist: requests-toolbelt (==0.8.0)
Requires-Dist: scikit-image (==0.14.2)
Requires-Dist: scikit-learn (==0.21.2)
Requires-Dist: scipy (==1.2.0)
Requires-Dist: Send2Trash (==1.5.0)
Requires-Dist: simplegeneric (==0.8.1)
Requires-Dist: six (==1.11.0)
Requires-Dist: terminado (==0.8.1)
Requires-Dist: testpath (==0.3.1)
Requires-Dist: tornado (==5.0.2)
Requires-Dist: tqdm (==4.26.0)
Requires-Dist: traitlets (==4.3.2)
Requires-Dist: twine (==1.12.1)
Requires-Dist: uncertainties (==3.0.2)
Requires-Dist: urllib3 (==1.23)
Requires-Dist: watchdog (==0.8.3)
Requires-Dist: wcwidth (==0.1.7)
Requires-Dist: webencodings (==0.5.1)
Requires-Dist: widgetsnbextension (==3.2.1)
Provides-Extra: test
Requires-Dist: coverage ; extra == 'test'
Requires-Dist: pytest ; extra == 'test'
Requires-Dist: pytest-cov ; extra == 'test'

# PyAutoLens

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, & **PyAutoLens** makes it simple to model strong gravitational lenses, like this one: 

![alt text](https://raw.githubusercontent.com/Jammy2211/PyAutoLens/master/gitimage.png)

**PyAutoLens** is based on the following papers:

[Adaptive Semi-linear Inversion of Strong Gravitational Lens Imaging](https://arxiv.org/abs/1412.7436)

[AutoLens: Automated Modeling of a Strong Lens's Light, Mass & Source](https://arxiv.org/abs/1708.07377)

## Python Example

With **PyAutoLens**, you can begin modeling a lens in just a couple of minutes. The example below demonstrates a simple analysis which fits the foreground lens galaxy's mass & the background source galaxy's light.

```python
import autofit as af
from autolens.pipeline.phase import phase_imaging, phase_hyper
from autolens.data.array import mask as msk
from autolens.model.galaxy import galaxy_model as gm
from autolens.data.instrument import abstract_data
from autolens.data.instrument import ccd
from autolens.model.profiles import light_profiles as lp
from autolens.model.profiles import mass_profiles as mp
from autolens.lens.plotters import lens_fit_plotters

import os

# In this example, we'll fit a simple lens galaxy + source galaxy system.

instrument
path = '{}/../'.format(os.path.dirname(os.path.realpath(__file__)))

lens_name = 'example_lens'

ccd_data = ccd.load_ccd_data_from_fits(
    image_path=path + instrument + lens_name + '/image.fits',
    psf_path=path+instrument+lens_name+'/psf.fits',
    noise_map_path=path+instrument+lens_name+'/noise_map.fits', 
    pixel_scale=0.1)

instrument
mask = msk.Mask.circular(
shape=ccd_data.shape, pixel_scale=ccd_data.pixel_scale, radius_arcsec=3.0)

# We model our lens galaxy using a mass profile (a singular isothermal ellipsoid) & our source galaxy 
# a light profile (an elliptical Sersic). We load these profiles from the 'light_profiles (lp)' & 
# 'mass_profiles (mp)' modules.
lens_mass_profile = mp.EllipticalIsothermal
source_light_profile = lp.EllipticalSersic

# To setup our model galaxies, we use the GalaxyModel class, which represents a galaxy whose parameters 
# are variable & fitted for by PyAutoLens. The galaxies are also assigned redshifts.
lens_galaxy_model = gm.GalaxyModel(redshift=0.5, mass=lens_mass_profile)
source_galaxy_model = gm.GalaxyModel(redshsift=1.0, light=source_light_profile)

# To perform the analysis, we set up a phase using the 'phase' module (imported as 'ph').
# A phase takes our galaxy models & fits their parameters using a non-linear search 
# (in this case, MultiNest).
phase = phase_imaging.PhaseImaging(
    galaxies=dict(lens=lens_galaxy_model, source=source_galaxy_model),
    phase_name='example/phase_example', optimizer_class=af.MultiNest)

instrument
result = phase.run(data=ccd_data)
lens_fit_plotters.plot_fit_subplot(fit=result.most_likely_fit)
```

## Slack

We're building a **PyAutoLens** community on Slack, so you should contact us on our [Slack channel](https://pyautolens.slack.com/) before getting started. Here, I will give you the latest updates on the software & discuss how best to use **PyAutoLens** for your science case.

Unfortunately, Slack is invitation-only, so first send me an [email](https://github.com/Jammy2211) requesting an invite.

## Features

**PyAutoLens's** advanced modeling features include:

- **Galaxies** - Use light & mass profiles to make galaxies & perform lensing calculations.
- **Pipelines** - Write automated analysis pipelines to fit complex lens models to large samples of strong lenses.
- **Extended Sources** - Reconstruct complex source galaxy morphologies on a variety of pixel-grids.
- **Adaption** - Adapt the lensing analysis to the features of the observed strong lens imaging.
- **Multi-Plane** - Perform multi-plane ray-tracing & model multi-plane lens systems.
- **Visualization** - Custom visualization libraries for plotting physical lensing quantities & modeling results.

## HowToLens

Included with **PyAutoLens** is the **HowToLens** lecture series, which provides an introduction to strong gravitational lens modeling with **PyAutoLens**. It can be found in the workspace & consists of 4 chapters:

- **Introduction** - An introduction to strong gravitational lensing & **PyAutolens**.
- **Lens Modeling** - How to model strong lenses, including a primer on Bayesian non-linear analysis.
- **Pipelines** - How to build pipelines & tailor them to your own science case.
- **Inversions** - How to perform pixelized reconstructions of the source-galaxy.

## Workspace

**PyAutoLens** comes with a workspace, which can be found [here](https://github.com/Jammy2211/autolens_workspace) & which includes:

- **Config** - Configuration files which customize the **PyAutoLens** analysis.
- **Data** - Your data folder, including example data-sets distributed with **PyAutoLens**.
- **HowToLens** - The **HowToLens** lecture series.
- **Output** - Where the **PyAutoLens** analysis & visualization are output.
- **Pipelines** - Example pipelines for modeling strong lenses or to use a template for your own pipeline.
- **Plotting** - Scripts enabling customized figures & images.
- **Runners** - Scripts for running a **PyAutoLens** pipeline.
- **Tools** - Tools for simulating strong lens data, creating masks & using many other **PyAutoLens** features.

If you install **PyAutoLens** with conda or pip, you will need to download the workspace from the [autolens_workspace](https://github.com/Jammy2211/autolens_workspace) repository, which is described in the installation instructions below.

## Depedencies

**PyAutoLens** requires [PyMultiNest](http://johannesbuchner.github.io/pymultinest-tutorial/install.html) & [Numba](https://github.com/numba/numba).

## Installation with conda

We recommend installation using a conda environment as this circumvents a number of compatibility issues when installing **PyMultiNest**.

First, install [conda](https://conda.io/miniconda.html).

Create a conda environment:

```
conda create -n autolens python=3.7 anaconda
```

Activate the conda environment:

```
conda activate autolens
```

Install multinest:

```
conda install -c conda-forge multinest
```

Install autolens:

```
pip install autolens
```

Clone autolens workspace & set WORKSPACE enviroment variable:
```
cd /path/where/you/want/autolens_workspace
git clone https://github.com/Jammy2211/autolens_workspace
export WORKSPACE=/path/to/autolens_workspace/
```

Set PYTHONPATH to include the autolens_workspace directory:
```
export PYTHONPATH=/path/to/autolens_workspace/
```

You can test everything is working by running the example pipeline runner in the autolens_workspace
```
python3 /path/to/autolens_workspace/runners/simple/runner_lens_mass_&_source.py
```

## Installation with pip

Installation is also available via pip, however there are reported issues with installing **PyMultiNest** that can make installation difficult, see the file [INSTALL.notes](https://github.com/Jammy2211/PyAutoLens/blob/master/INSTALL.notes)

```
$ pip install autolens
```

Clone autolens workspace & set WORKSPACE enviroment variable:
```
cd /path/where/you/want/autolens_workspace
git clone https://github.com/Jammy2211/autolens_workspace
export WORKSPACE=/path/to/autolens_workspace/
```

Set PYTHONPATH to include the autolens_workspace directory:
```
export PYTHONPATH=/path/to/autolens_workspace/
```

You can test everything is working by running the example pipeline runner in the autolens_workspace
```
python3 /path/to/autolens_workspace/runners/simple/runner_lens_mass_&_source.py
```

## Support & Discussion

If you're having difficulty with installation, lens modeling, or just want a chat, feel free to message us on our [Slack channel](https://pyautolens.slack.com/).

## Contributing

If you have any suggestions or would like to contribute please get in touch.

## Publications

The following papers use **PyAutoLens**:

[The molecular-gas properties in the gravitationally lensed merger HATLAS J142935.3-002836](https://arxiv.org/abs/1904.00307)

[Galaxy structure with strong gravitational lensing: decomposing the internal mass distribution of massive elliptical galaxies](https://arxiv.org/abs/1901.07801)

[Novel Substructure & Superfluid Dark Matter](https://arxiv.org/abs/1901.03694)

[CO, H2O, H2O+ line & dust emission in a z = 3.63 strongly lensed starburst merger at sub-kiloparsec scales](https://arxiv.org/abs/1903.00273)

## Credits

### Developers

[James Nightingale](https://github.com/Jammy2211) - Lead developer & PyAutoLens guru.

[Richard Hayes](https://github.com/rhayes777) - Lead developer & [PyAutoFit](https://github.com/rhayes777/PyAutoFit) guru.

[Ashley Kelly](https://github.com/AshKelly) - Developer of [pyquad](https://github.com/AshKelly/pyquad) for fast deflections computations.

[Amy Etherington](https://github.com/amyetherington) - Magnification, Critical Curves and Caustic Calculations.

[Xiaoyue Cao](https://github.com/caoxiaoyue) - Analytic Ellipitcal Power-Law Deflection Angle Calculations.

[Nan Li](https://github.com/linan7788626) - Docker integration & support.

### Code Donors

[Andrew Robertson](https://github.com/Andrew-Robertson) - Critical curve & caustic calculations.

[Andrea Enia](https://github.com/AndreaEnia) - Voronoi source-plane plotting tools.

[Aristeidis Amvrosiadis](https://github.com/Sketos) - ALMA imaging data loading.

