# Recipe to generate performance based S4 simulations with arbitrary sky distribution (in progress)

B. Racine & V. Buza

In this posting we present an end-to-end prescriptive recipe for making new S4 simulations that are directly scaled from BK performance based noise spectra.
We start from BK inputs:

• Survey weight per detector year, per bandpower,
• number of detector year,
• Equivalent $$f_{sky}$$ per bandpower,
scale the noise to a given S4 frequency and distribute this noise using a hitcount map following a given scan strategy.
To test this, we use these BK inputs and the BK inverse variance to recover BK noise spectra and statistics -- through this process we will empirically derive a ell-dependent scaling factor that accounts for effects such as filtering that are not captured in these simple simulations.

## 1. Inputs

We start by taking achieved noise BK15 bandpowers ($$N_\ell$$'s) and number of detector-years corresponding to these noise levels, and compute the effective sky fraction and survey weight per detector-year at each of the three BK frequencies.

As explained in Tegmark (1997) and Colin's posting, we can start from the sample variance of our $$N_\ell$$: $$$\sigma(N_\ell) = \sqrt{\frac{2}{\Sigma_{\ell \in bin} (2 \ell + 1) f_{sky}}} N_\ell.$$$ We can then estimate the equivalent $$f_{sky}$$ using the mean and standard deviation of the bandpowers of the 499 BK15 noise simulations: $$$f_{sky} = \frac{2}{\Sigma_{\ell \in bin} (2 \ell + 1)} \left( \frac{N_\ell}{\sigma(N_\ell)} \right)^2=\frac{1}{\ell \Delta \ell}\left( \frac{N_\ell}{\sigma(N_\ell)} \right)^2$$$ Where we used the fact that $$\Sigma_{\ell-\Delta \ell/2}^{\ell+\Delta \ell/2}(2\ell ' +1)=(\Delta\ell+1)(2\ell+1) ≈ \ell\Delta\ell$$. Here $$\ell$$ is the center of the bin, and $$\Delta\ell$$ is it's width.

We then compute the survey weight per detector-year. It is simply the ratio: $$$SW_{det-year} = \frac{2f_{sky}}{n_{det}\times N_\ell}$$$ where $$n_{det}$$ is the number of detector-years. For BK15 [95 GHz, 150 GHz, 220 GHz] this is [1152, 5835, 1024] det-yrs.
The factor of 2 here comes from the fact that we report the survey weight for total Q and U polarization, whereas we only used the BB bandpowers here.

Remark: The noise bandpowers have had a suppression factor applied, that includes filtering and beam deconvolution. In the current exercise, we plan to share the $$SW_{det-year}$$ that has been re-convolved by the beam, The definition that makes more physical sense for comparison between experiments includes the beam roll-off (i.e. not from the re-convolved bandpowers) as it represents how deep our data are at a given $$\ell$$. Here we show both for completeness.

## 2. Automatic Noise Fitting

To generated full sky noise map, we need a $$\ell$$-by-$$\ell$$ noise spectrum. We fit a 1/f model: $$$N_\ell^{fit} = N_0 \left(1+\left(\frac{l}{l_{knee}}\right)^{\alpha}\right),$$$ to the beam "re-convolved" noise bandpowers. We set to 0 the power below $$\ell=30$$.

## 3. Making full-sky and cut-sky noise maps

We generate full sky noise $$N_{side}=512$$ maps, using $$\texttt{synfast}$$ from Healpix.
We then divide by the square root of the BK15 peak-normalized inverse variance map, $$m_i = \frac{V^{-1}}{max(V^{-1})}$$ to recover the noise in-homogeneity of BK. This inverse variance map is generated by accumulating sign-flip noise from the timeline into the map.

## 4. Power Spectrum Estimation and Noise Variance

We use Healpix' $$\texttt{anafast}$$ to compute the power spectrum, masking the data with the same inverse variance "mask".
We rescale these spectra, dividing by the $$f_{sky-hit}$$ factor: $$$f_{sky-hit} = \frac{\sum_i{m_i}}{N_{pix}}$$$ where $$N_{pix}$$ is the number of pixel in the full map, here 12*512*512, and $$m_i$$ is the peak-normalized inverse-variance map.
The resulting spectra are distributed around the mean that lies on top of the input spectra (see figure 5).

We then integrate all these output $$\ell$$-by-$$\ell$$ spectra in the measured bandpower window functions. In figure 5b we show the mean of these output bandpowers and in figure 6 the std.

While the binned mean lies on top of the input spectrum, for the standard deviation, we also need to apply an additional factor 1/sf: $$$sf = \frac{\sum_i{m_i^2}}{\sum_i{m_i}}.$$$

## 6. Reobtaining the survey weight per det-yr

We can then compute the output $$f_{sky}$$ and $$SW_{det-year}$$ using equations (2) and (3).