Installation
Install pysm3 with pip or conda and read about development installs and NERSC.

Installation
Install pysm3 with pip or conda and read about development installs and NERSC.
Models
A summary of every preset: dust d0-d12, synchrotron s0-s7, CMB c1-c4, AME a1-a2, free-free f1 and more.
Tutorials
Jupyter notebooks for every component: from the first map to bandpass integration and MPI.
API reference
The full pysm3 Python API reference generated from the source code.
PySM 3 generates full-sky simulations of Galactic foregrounds in intensity and polarization relevant for CMB experiments. The components simulated are: thermal dust, synchrotron, AME, free-free, and CMB at a given HEALPix , with an option to integrate over a bandpass and to smooth with a given beam.
There is scope for a few options for the model for each component, attempting to be consistent with current data.
Currently much of the available data is limited in resolution at degree-scale. We therefore make efforts to provide reasonable small-scale simulations to extend the data to higher multipoles. The details of the procedures developed can be found in the accompanying paper.
This code is based on the large-scale Galactic part of Planck Sky Model (Delabrouille 2012) code and uses some of its inputs.
If you are using this code please cite:
See the Bibtex format file CITATION
Each model is identified with a letter and a number, the letter indicates the kind of emission and the number the type of model, generally in order of complexity starting at 1. For example for dust we start with d1 based on Planck commander results, d4 has 2 dust populations and d6 implements a model of dust frequency decorrelation.
For example free-free:
f1: We model the free-free emission using the analytic model assumed in the Commander fit to the Planck 2015 data (Draine 2011 Physics of the Interstellar and Intergalactic Medium) to produce a degree-scale map of free-free emission at 30 GHz. We add small scales to this using a procedure outlined in the accompanying paper. This map is then scaled in frequency by applying a spatially constant power law index of -2.14.
See the PySM 2 paper Thorne at al
See the documentation about models
PySM is written in pure Python, multi-threading and Just-In-Time compilation are provided by numba.
The required packages are:
healpynumbatomlastropyimportlib_metadata just for Python 3.7How many threads are used by numba can be controlled by setting:
export OMP_NUM_THREADS=2export NUMBA_NUM_THREADS=2For debugging purposes, you can also completely disable the numba JIT compilation and have the code just use plain
Python, which is slower, but easier to debug:
export NUMBA_DISABLE_JIT=1PySM 3 is capable of running across multiple nodes using a MPI communicator.
See the details in the MPI section of the tutorial.
In order to run in parallel with MPI, it also needs a functioning MPI environment and:
mpi4pyMPI-Distributed smoothing (optional) requires libsharp, it is easiest to install the conda package:
conda install -c conda-forge libsharp=*=*openmpi*It also has a mpich version:
conda install -c conda-forge libsharp=*=*mpich*All the tutorials are Jupyter Notebooks and can be accessed from the repository:
The following notebooks document the data-processing workflow used to build the high-resolution templates shipped with PySM.
See the pysm3 API reference.