Skip to content

Conducts hierarchical inference of strongly-lensed systems with Bayesian neural networks

License

Notifications You must be signed in to change notification settings

swagnercarena/ovejero

Repository files navigation

ovejero - Bayesian Neural Network Inference of Strong Gravitational Lenses

Documentation Status https://coveralls.io/repos/github/swagnercarena/ovejero/badge.svg?branch=master https://img.shields.io/badge/license-MIT-blue.svg?style=flat

ovejero conducts hierarchical inference of strongly-lensed systems with Bayesian neural networks

Installation

Lenstronomy requires an additional fortran package (fastell) to run lens models with elliptical mass distributions. Thankfully, installing the package is fairly easy (although a fortran compiler is required).

$ git clone https://github.com/sibirrer/fastell4py.git <desired location>
$ cd <desired location>
$ python setup.py install --user

In the future, ovejero will be a pypi package. For now, it can be installed by cloning the git repo.

$ git clone https://github.com/swagnercarena/ovejero.git
$ cd overjero/
$ pip install -e . -r requirements.txt

The addition of the -e option will allow you to pull ovejero updates and have them work automatically.

Main Features

  • Ability to train Bayesian Neural Networks (BNNs) to predict posteriors on strong gravitational lensing images
  • Integration with forward modeling tools in lenstronomy to allow comparison between BNN outputs and more traditional methods
  • Hierarchical Inference tools that allow for population parameter estimates and unbiased posteriors on independent test sets

Demos

The jupyter notebooks in the demos folder walk you through how to use all the main features of the ovejero package.

Datasets, Chains, Model Weights, and Paper Figures

To reproduce all of the figures (and results) of "Hierarchical Inference With Bayesian Neural Networks: An Application to Strong Gravitational Lensing" you can download the datasets, chains, model weights, and BNN samples from zenodo.

If you simply want to run the notebooks in the ovejero/paper folder (and therefore reproduce all the figures of the paper) you will need to download and unzip the following files:

  • datasets.zip
  • forward_modeling.zip
  • hierarchical_results.zip
  • validation_results.zip

The contents of theses files will have to be placed in <ovejero_root_path>/<folder_name> for the notebooks to find the data. For example, for datasets.zip, the contents will need to be placed in $ovejero/datasets.

This list does not include the model weights or the training dataset, since neither are needed to generate the plots (the BNN samples are saved to avoid needing a GPU to generate plots quickly). The BNN weights and training dataset can also be downloaded from the zenodo dataset:

  • train.zip
  • models.zip

Attribution

If you use ovejero or its datasets for your own research, please cite the lenstronomy package (Birrer & Amara 2018), the lens simulation package baobab (Park et al. 2020), and the BNN package ovejero (Wagner-Carena et al. 2020).

About

Conducts hierarchical inference of strongly-lensed systems with Bayesian neural networks

Resources

License

Stars

Watchers

Forks

Packages

No packages published