Modeling galaxy redshifts and magnitudes with normalizing flows
Project description
pzflow
Modeling galaxy redshifts and magnitudes with a normalizing flow
See this Jupyter notebook for an introduction.
Installation
You can install pzflow from PyPI with pip:
pip install pzflow
If you want to run pzflow on a GPU with CUDA, then you need to follow the GPU-enabled installation instructions for jaxlib here.
You may also need to add the following to your .bashrc
:
# cuda setup
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH
export PATH=$PATH:/usr/local/cuda/bin
If you have the GPU enabled version of jax installed, but would like to run on the CPU, add the following to the top of your scripts/notebooks:
import jax
# Global flag to set a specific platform, must be used at startup.
jax.config.update('jax_platform_name', 'cpu')
Development
To work on pzflow, after forking and cloning this repo:
- Create a virtual environment with Python
E.g., with condaconda create -n pzflow
- Activate the environment.
E.g.,conda activate pzflow
- Install pzflow in edit mode with the
dev
flag
I.e., in the root directory,pip install -e .[dev]
Sources
The idea to use normalizing flows for photometric redshifts orginated with Bryce Kalmbach.
The early stages of this package were developed as a part of the DESC RAIL project, and included contributions from Francois Lanusse and Alex Malz.
The jax structure of pzflow
is largely based on jax-flows
by Chris Waites. The implementation of the Neural Spline Coupling is largely based on the Tensorflow implementation, with some inspiration from nflows
.
Neural Spline Flows are based on the following papers:
NICE: Non-linear Independent Components Estimation
Laurent Dinh, David Krueger, Yoshua Bengio
arXiv:1410.8516
Density estimation using Real NVP
Laurent Dinh, Jascha Sohl-Dickstein, Samy Bengio
arXiv:1605.08803
Neural Spline Flows
Conor Durkan, Artur Bekasov, Iain Murray, George Papamakarios
arXiv:1906.04032
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.