SinglePixel is a code for modelling, simulating, and fitting the frequency spectra of complex dust foregrounds, as well as other components of the microwave sky. It operates on individual pixels (i.e. single lines of sight), hence the name.
The code is written entirely in Python, and makes use of the numpy, scipy, matplotlib, mpi4py, and emcee packages. You can clone it from the philbull/SinglePixel repository on GitHub. It is available under an open source MIT license, and contributions (e.g. pull requests and bug reports) are welcome. Please cite the paper (see below) if you use or modify the code.
The following is a list of the scripts that make up SinglePixel:
models.py: Python classes that define the various dust models and other foregrounds.
model_list.py: Instantiations of the various dust/foreground model classes with representative parameter values.
fitting.py: Infrastructure for simulating and fitting multi-band frequency spectra.
run_joint_mcmc.py: Main script for running the simulation/fitting procedure over a grid of models, band specifications, and noise realisations. MPI-enabled.
If you wish to repeat the analysis in the paper, you will find everything you need in run_joint_mcmc.py. Please study the code carefully before running, as the script must be modified in order to set certain parameters. Importantly, if you do not want to generate large amounts of output by storing the raw MCMC samples to disk, make sure that you have set fname_samples = None in the model_test() function.
The run_joint_mcmc.py script accepts several command line arguments that specify the models to simulate, the models to fit, and the random seed to use. Example usage:
$ mpirun -n 2 python run_joint_mcmc.py 99 synch,2mbb_fe synch,genmbb
This fits a CMB + synchrotron + 2MBB model to a CMB + synchrotron + Fe input model, with a random seed value of 99. Note that there are no spaces between the commas.
The code for the 2022 paper on probabilistic MBB models and depolarisation effects can be found in the prob_models branch on GitHub.
We have made summary data from the MCMC runs used in this project available to download below.
The SinglePixel simulation and fitting code was run over a grid of seven input dust models using two different fitting models (MBB and 2MBB). This was done for both polarisation-only and temperature + polarisation data, and for an array of band configurations (3 values of νmin and 6 values of νmax), as described in the paper. The whole procedure was repeated for 100 noise realisations for each combination of all of these parameters, resulting in 7 (models) x 2 (MBB/2MBB) x 2 (P/T+P) x 36 (band configurations) x 100 (realisations) = 100,800 runs, each with 10,000 samples from each of 50 workers. The whole dataset, including the full chains, is very large, and was not stored to disk.
We did store summary statistics from every run, however. These are provided separately for the polarisation-only and temperature + polarisation runs:
Polarisation-only summary data [tarball, 18 MB] (md5sum: c93e634f87d1c119613630f0628d149a)
Temperature + polarisation summary data [tarball, 2.3 MB] (md5sum: 2c27e89350931d8ef50920d5119b8dde)
The T+P runs were performed for a much smaller selection of band configurations, and only for the MBB fits.
All of the summary data files are provided for a cut (or burn-in) on the chains of 8,000 per worker, and so the summary statistics are estimated from 2,000 samples per worker. The data files are simple ASCII files, with column names specified in the headers, and run identifiers specified in the filename. For example, the filename paper01_summary_cmb-synch-hd.cmb-synch-mbb_nb7_seed101_cut8000.dat contains the results for a CMB + synchrotron + MBB model fit to a CMB + synchrotron + HD input model, with 7 bands, and random seed 101.
The following summary statistics are calculated from the MCMC chain for each parameter: mean (mean); std (standard deviation); Delta (error-normalised bias, calculated using the mean); MedDelta (error-normalised bias, calculated using the median); MLDelta (error-normalised bias, calculated using the maximum a posteriori estimate).
Note that the 2mbb_f99 model is actually the MF15 model referred to in the paper (the MF15 paper is an update of the Finkbeiner et al. 1999 paper).
The data for the 2022 paper are stored as compressed numpy (.npz) binary files in the corresponding GitHub branch. A Jupyter notebook is available that loads the data and generates the plots that were included in the paper.
The 2018 paper is available as ApJ 853, 127 (2018) and arXiv:1709.07897.
The 2022 paper is available as arXiv:2207.14213.