Library to generate simulations for the SOOPERCOOL
pipeline (https://github.com/simonsobs/SOOPERCOOL), for transfer function estimation or covariance matrix calculation.
The scripts generate two type of simulations:
- simulations for transfer function estimation
- simulations for covariance matrix calculation
The transfer function can be estimated by computing the power spectra of simulated maps before filtering and comparing them with the spectra of the same maps after filtering.
The tf_sims.py
script produces the spherical harmonics coefficients (nside
can be configured.
The code generates the
Spherical harmonics coefficients are saved to disk in .fits.gz
format:
- T-only (
$a^T_{\ell m}$ ,$\quad$ 0,$\quad$ 0)alm_tf_pureT_lmax{lmax}_{seed}.fits.gz
- E-only (0,
$\quad$ $a^E_{\ell m}$ ,$\quad$ 0)alm_tf_pureE_...
- B-only (0,
$\quad$ 0,$\quad$ $a^B_{\ell m}$ )alm_tf_pureB_...
Generation of simulations for covariance estimation is separated in two scripts:
-
templates_fit.py
first reads the PySMd9s4
foregrounds templates for synchrotron ($\nu_0=23$ GHz) and thermal dust ($\nu_0=353$ GHz) stored at NERSC. IQU maps are converted from Rayleigh-Jeans ($\mu K_{RJ}$ ) to thermodynamic (CMB,$\mu K_{CMB}$ ) units and processed into a SAT-like configuration, meaning that they are rotated from galactic to equatorial coordinates and downgraded to the desirednside
(both operations are carried out in harmonic space). Then, for each template, the script computes angular power spectra on the SAT MSS2 apodized mask withNaMaster
and extracts power laws amplitudes and slopes by fitting the spectra with:$$C^{XX}_\ell = A^{XX}_c \left(\frac{\ell}{\ell_0}\right)^{\alpha^{XX}_c}$$ where$c=s, d$ stands for synchrotron or dust, and$X=T,E,B$ . Finally, it updates theparamfile_cov.yaml
file with the fitted parameters for it to be read by the simulation script. -
cov_sims.py
generates Gaussian$a_{\ell m}$ realizations from the power spectra of each component (CMB, synchrotron and dust), up to$\ell_{max}=3*nside-1$ . The code loads CMB spectra from thedata
directory (default is Planck 2018), while foregrounds spectra are computed as power laws$C_\ell = A_c \left(\ell/\ell_0\right)^{\alpha_c}$ with spectral parameters fitted in the previous stage. In order to generate multi-frequency realizations, each$a_{\ell m}$ is frequency-scaled with the corresponding spectral energy distribution (SED,$S^\nu_c$ ). Synchrotron radiation is rescaled with a power law ($\beta_s = -3$ ); thermal dust is rescaled with a modified blackbody ($\beta_d=1.59$ ,$T_d = 19.6 K$ ):$$a^\nu_{\ell m} = \sum_c a^c_{\ell m} S^\nu_c.$$ Bandpass integration is not included: frequency bandpasses are assumed as delta-like centered at the nominal frequencies. Outputs spherical harmonics coefficients are saved to disk in$\mu K_{CMB}$ units, the filename beingalm_{freq}GHz_lmax{lmax}_{seed}.fits
.
numpy
scipy
healpy
(https://healpy.readthedocs.io/en/latest/)pymaster
(https://namaster.readthedocs.io/en/latest/)
Just clone or download the repository, for example with:
git clone https://github.com/simonsobs/SOOPERSIMS.git
Scripts need a .yaml
configuration file with instructions and parameters. Create a .yaml
file in the paramfiles
directory (or just adapt one of the sample files there to your needs).
To run, go to the scripts
directory (cd scripts
) and run the bash scripts:
bash run_tf_sims.sh
to generate transfer function simulationsbash run_cov_sims.sh
to generate covariance simulations
Get in touch with Claudio Ranucci (cranucci) if you have questions or feedbacks about the codes.