h0rton - Deep Modeling of Strong Gravitational Time Delay Lenses for Bayesian Inference of the Hubble Constant
This package models strong gravitational time delay lenses using Bayesian neural networks to infer the Hubble constant. It represents LSST Dark Energy Science Collaboration research in progress. Please contact Ji Won Park (@jiwoncpark) for questions on using the code or the data.
- Virtual environments are strongly recommended, to prevent dependencies with conflicting versions. Create a conda virtual environment and activate it:
$conda create -n h0rton python=3.6 -y $conda activate h0rton
- You'll need a Fortran compiler and Fortran-compiled fastell4py, which you can get on a debian system by running
$sudo apt-get install gfortran $git clone https://github.com/sibirrer/fastell4py.git <desired location> $cd <desired location>/fastell4py $python setup.py install --user
- Now do one of the following.
Option 2(a): clone the repo (please do this if you'd like to contribute to the development).
$git clone https://github.com/jiwoncpark/h0rton.git $cd h0rton $pip install -e . -r requirements.txt
Option 2(b): pip install the release version (only recommended if you're a user).
$pip install h0rton
- (Optional) To run the notebooks, add the Jupyter kernel.
$python -m ipykernel install --user --name h0rton --display-name "Python (h0rton)"
- (Optional) To experiment with H0 inference using the TDLMC data, download all their data first using the provided convenience script:
$source h0rton/tdlmc_data/download_tdlmc_data.sh
- Generate the training and validation data, e.g.
$python -m baobab.generate h0rton/trainval_data/train_tdlmc_diagonal_config.py
- Edit the configuration parameters h0rton/example_user_config.py. Make sure the cfg.data field agrees with the training data you generated.
- Run
$python -m h0rton.train h0rton/example_user_config.py
You can visualize the training results by running
$tensorboard --logdir runs
Suggestions are always welcome! If you encounter issues or areas for improvement, please message @jiwoncpark or make an issue.
h0rton was used to enter the Time Delay Lens Modeling Challenge:
- Challenge webpage: https://tdlmc.github.io/
- Experimental design paper: https://arxiv.org/abs/1801.01506
This software was developed within the LSST DESC using LSST DESC resources, and so meets the criteria given in, and is bound by, the LSST DESC Publication Policy for being a “DESC product."
When referring to h0rton, please cite our paper and provide a link to this repo.