Skip to main content

Bayesian neural network for hierarchical inference of the Hubble constant

Project description

plots/overlaid_200_posteriors.png https://travis-ci.com/jiwoncpark/h0rton.svg?branch=master Documentation Status https://coveralls.io/repos/github/jiwoncpark/h0rton/badge.svg?branch=master https://img.shields.io/badge/license-MIT-blue.svg?style=flat Powered by Astropy Badge

Hierarchical Bayesian inference of the Hubble constant from samples of strong gravitational time delay lenses. This package represents LSST Dark Energy Science Collaboration research in progress. Please contact Ji Won Park (@jiwoncpark) for questions on using the code.

Installation

  1. 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
  1. 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
  1. 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
  1. (Optional) To run the notebooks, add the Jupyter kernel.

$python -m ipykernel install --user --name h0rton --display-name "Python (h0rton)"
  1. (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

How to train

  1. Generate the training and validation data, e.g.

$python -m baobab.generate h0rton/trainval_data/train_tdlmc_diagonal_config.py
  1. Edit the configuration parameters h0rton/example_user_config.py. Make sure the cfg.data field agrees with the training data you generated.

  2. Run

$python -m h0rton.train h0rton/example_user_config.py

You can visualize the training results by running

$tensorboard --logdir runs

Feedback and More

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:

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 (Park et al 2020) and provide a link to this repo.

Project details


Release history Release notifications | RSS feed

This version

1.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

h0rton-1.0.tar.gz (71.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

h0rton-1.0-py3-none-any.whl (97.8 kB view details)

Uploaded Python 3

File details

Details for the file h0rton-1.0.tar.gz.

File metadata

  • Download URL: h0rton-1.0.tar.gz
  • Upload date:
  • Size: 71.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.6.10

File hashes

Hashes for h0rton-1.0.tar.gz
Algorithm Hash digest
SHA256 ddceb9e1f27b77d654110ddd9f09cda940d0e2adf958027fff1071e5c3b1b51c
MD5 3f973580a0e1a613c7ed13c07aaf36aa
BLAKE2b-256 5d0961eda6aa668c4b4c4759984f15792f3c96186909830cd8407ea97054fb9f

See more details on using hashes here.

File details

Details for the file h0rton-1.0-py3-none-any.whl.

File metadata

  • Download URL: h0rton-1.0-py3-none-any.whl
  • Upload date:
  • Size: 97.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.6.10

File hashes

Hashes for h0rton-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b7d8f990b45d7607392db56fe1fb1f1ea790ad808150262697a436a7397afcb1
MD5 e4555b4c3f8350da608b40f602d74670
BLAKE2b-256 b5b2c3074852a290fc0f2fd5c111bdc412caa27410e0397ddb9122c5ac2e156e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page