Installation¶
Clone the repository and install it in editable mode from the repository root (the folder holding pyproject.toml):
This pulls in JAX (pinned to jax == jaxlib == 0.9.2), Flax, CAMB, NumPy, SciPy and Matplotlib. Python 3.10 or newer is required. JAX is configured for float64 globally on import.
Optional extras:
pip install -e ".[dev]" #pytest + jupyter
pip install -e ".[docs]" #MkDocs, to build this site locally
Check the install¶
from cmb_lensing.simulate import load_sim
data_set = load_sim(nside = 64, theta_pix = 5, pol = "I", master_seed = 1)
print(f"Pixel resolution = {data_set.theta_pix} arcminutes per pixel")
If you wish to run the unit tests or actively contribute to the development of the repository it will also be necessary to have juliacall installed and a CMBLensing.jl checkout - see Testing for more information.
Downloading the 5D CAMB grid¶
sample_joint evaluates its theory spectra through a 5D CAMB spline, camb_splines/camb_grid_spline.npz (~7.9 GB). This file is too large to store on GitHub. It is hosted on the Hugging Face dataset zaneblood1/cmb_lensing_data and is downloaded automatically into camb_splines/ the first time the code needs it (cmb_lensing/camb_splines.py). No manual step is needed.
To fetch it ahead of time, run
On a cluster, run this once on a login node: compute nodes often have no internet access. You can also rebuild the grid yourself (Building the CAMB Grid) and place it at camb_splines/camb_grid_spline.npz. See The CAMB Grid for more information on how the grid is used.
The same dataset holds the chains, phi noise, delensed covariance and map_joint comparison outputs. None of those is downloaded automatically; see Data.
HPC setup (hpc_local.sh)¶
If you wish to run any of the HPC slurm scripts for e.g. sampling LCDM parameters en masse or generating data for Fisher forecasting, you will need to make a copy of the hpc_local.example.sh script and fill it in with your own personal cluster configurations. The example script is gitignored to avoid sharing personal email accounts, etc.
then edit hpc_local.sh:
#the conda install and environment the jobs run in
source /path/to/miniconda3/etc/profile.d/conda.sh
conda activate myenv
#where Slurm mails job failures
export SBATCH_MAIL_USER=you@example.edu
#the CMBLensing.jl checkout, used only by runtime_comparison/
export CMBLENSING_JL_PATH=/path/to/CMBLensing.jl
Every driver and every job script it submits sources this file. See HPC setup for how the drivers work.