Skip to content

Latest commit

 

History

History
74 lines (47 loc) · 5.59 KB

README.md

File metadata and controls

74 lines (47 loc) · 5.59 KB

CMBLensing.jl

Gitter

Binder

CMBLensing.jl is a next-generation tool for analysis of the lensed Cosmic Microwave Background. It is written in Julia and transparently callable from Python.

At its heart, CMBLensing.jl maximizes, samples, or performs MUSE inference on the Bayesian posterior for the CMB lensing problem. It also contains tools to quickly manipulate and process CMB maps, set up modified posteriors with a probabilistic programming language, and take gradients using automatic differentiation.

Highlights

  • Fully Nvidia GPU compatible (1-2 orders of magnitude speedups over CPU, depending on the problem size and hardware).
  • Automatic differentiation (via Zygote.jl) provides for-free gradients of your custom posteriors.
  • Includes the following algorithms to lense a map:
  • Maximize and sample $\mathcal{P}(f,\phi,\theta,|,d)$, the joint maximum a posteriori estimate of the lensing potential, $\phi$, the temperature and/or polarization fields, $f$, and cosmological parameters, $\theta$ (Millea, Anderes, & Wandelt 2017, Millea, Anderes, & Wandelt 2020)
  • Maximize $\mathcal{P}(\phi,|,d,\theta)$, i.e. the marginal maximum a posteriori estimate of the lensing potential, $\phi$, at fixed cosmological parameters, $\theta$ (Carron & Lewis 2017)
  • Compute MUSE inferences of bandpowers of $\phi$ and unlensed $f$ via MuseInference.jl (Millea & Seljak, 2021).
  • Do basic quadratic estimation of $\phi$ (Hu & Okamoto 2003)

Documentation

The best place to get started is to read the documentation (which is a work-in-progress, but contains many useful examples).

Most of the pages in the documentation are Jupyter notebooks, and you can click the "launch binder" link at the top of each page to launch a Jupyterlab server running the notebook in your browser (courtesy of binder).

You can also clone the repository and open the notebooks in docs/src if you want to run them locally (which will usually lead to higher performance). The notebooks are stored as .md files rather than .ipynb format. Its recommended to install Jupytext (pip install jupytext) and then you can run these .md directly from Jupyterlab by right-clicking on them and selecting Open With -> Notebook. Otherwise, run the script docs/make_notebooks.sh to convert the .md files to .ipynb which you can then open as desired.

Installation

Requirements

  • Julia 1.8+
  • (recommended) An Nvidia GPU and CUDA.jl for GPU support
  • (recommended) Python 3 + matplotlib (used for plotting)
  • (recommended) pycamb to generate $C_\ell$'s (run pip install --user camb)
  • (recommended) JuliaMono font to ensure characters like f̃, ϕ, ∇, ℓ, etc... are rendered correctly

Native installation

To install the Julia package locally, run:

pkg> add CMBLensing

(type ] at the Julia REPL to reach the pkg> prompt)

(recommended) After installing, switch your Julia to use Intel MKL FFT libraries, which provide significantly faster FFTs when running on CPU. You can do so by running using CMBLensing.FFTW; FFTW.set_provider!("mkl") from the same environment in which you added CMBLensing. This only needs to be done once per-environment (see also here).

Docker installation

Also provided is a Docker container which includes a Jupyterlab server and all the recommended and optional dependencies to run and use CMBLensing.jl. Launch this container with:

git clone https://github.com/marius311/CMBLensing.jl.git
cd CMBLensing.jl
docker-compose pull main
docker-compose up main

The first time you run this, it will automatically download the (~1Gb) container from the Docker hub. The command will prompt you with the URL which you should open in a browser to access the notebook.

To run the notebook on a different port than the default 8888, do PORT=1234 docker-compose up main where 1234 is whatever port number you want.

You can also build the container locally by replacing docker-compose pull main with docker-compose build main.