simCMB

#### Description:

simCMB is a C program that generates mock cosmic microwave background (CMB) temperature and polarization data. The noise characteristics can be adjusted to simulate data from different observational platforms. The default settings generate a simulated 3 frequency channel dataset representative of the European Space Agency Planck Surveyor. The experimental specifications can be set by adjusting the parameters identified below, however, the code currently is hardcoded for three or fewer frequency channels. It is not difficult to modify the code to use more channels.

The code works by reading in fiducial CMB temperature and polarization spectra and computing a data realization based on the theoretical variance of the spectra and the noise characteristics of the experiment. These spectra are most easily generated by a CMB code, like CAMB. See my notes for additional details.

Download the source from here. You will also need to install the GNU Scientific Library (GSL) if you wish to use the default random number generator I've chosen. If not, the code is clearly marked and you can modify it; GSL is not required for anything else in the code. If you're running Linux, your distribution should provide a suitable GSL package.

Compile as follows if using GSL (the gsl flags can be dropped otherwise):

gcc -o simCMB simCMB.c -lgsl -lgslcblas -lm

#### Parameters:

There are a couple of user-defined parameters. These are specified as #define's at the top of the source file:

lmax: maximum number of multipole moments
f_sky: fraction of sky covered
cols: number of columns in the input file. This should be set to 5 for including TT, EE, TE, and BB spectra.

There are other values that must be set in order to tweak the noise characteristics of the data. These are defined elsewhere in the code:

fwhm_arcmin: full width at half maximum of the beam in arc minutes. This single variable is reused to set the fwhm of each channel.
nT[i]: pixel noise ($$\sigma^2$$) of the $$i^{th}$$ channel in units of $$\mu{\rm K}^2$$. Set $$i=0$$ for unused channels.

#### Input Files:

simCMB generates data based on a set of fiducial temperature and polarization data. The code was originally designed to take CAMB output spectra as input, so the expected format is space (or tab) separated columns: $$\ell,\,TT,\,EE,\,BB,\,TE$$. This input file is called fiducial_model.dat. The basic idea is that the user supplies the true underlying model of the universe and simCMB creates a dataset arising from this model. Because the data is subject to statistical fluctuations, running simCMB twice with the same fiducial model will result in two different datasets!

#### Output Files:

The mock spectra are output to a file called data.dat. The format is $$\ell,\,C^{TT}_\ell,\,C^{TE}_\ell,\,C^{EE}_\ell,\,C^{BB}_\ell,\,N^T_\ell,\,N^P_\ell,\,f_{\rm sky}$$, where these are the raw $$C_\ell$$'s (no factors of $$\ell(\ell+1)/2\pi$$) and the $$N_\ell$$'s are the temperature and polarization noise spectra, respectively. This output format is compatible with cosmomc so that your mock data can be easily analyzed.

#### Use with cosmomc:

In addition to the output data, you must also create a file called data.dataset with the contents,

name = data
has_pol = T
all_l_exact = T
all_l_file = data/data.dat
all_l_lmax = lmax

modified according to your needs (replace lmax with the actual value from the code settings.) Place both the data.dat and data.dataset files in the cosmomc data directory and you're all set.