<jupyter_start><jupyter_text>White noise NET in Radio-astronomy and Cosmology> Create a white noise map and compare with power spectrum expected from the NET- categories: [cosmology, python, healpy] Noise-Equivalent-Temperature, it is a measure of sensitivity of a detector, in cosmology, it is often quotedin $\mu K \sqrt(s)$, i.e. it is the sensitivity per unit time and can be divided by the integration time toget the actual standard deviation of the white noise of the instrument.For example let's consider a white noise NET of $200 \mu K \sqrt(s)$it means that if you integrate for 100 seconds for each pixel, the standard deviation will be $20 \mu K$.<jupyter_code>net = 200 * u.Unit("uK * sqrt(s)")
net
integration_time_per_pixel = 100 * u.s
standard_deviation = net / np.sqrt(integration_time_per_pixel)<jupyter_output><empty_output><jupyter_text>Create a white noise mapNow that we have an estimate of the standard deviation per pixel, we can use `numpy` to create a map of gaussian white noise.<jupyter_code>nside = 128
npix = hp.nside2npix(nside)
m = np.random.normal(scale = standard_deviation.value, size=npix) * standard_deviation.unit
hp.mollview(m, unit=m.unit, title="White noise map")<jupyter_output><empty_output><jupyter_text>Power spectrumFinally we can compute the angular power spectrum with `anafast`, i.e. the power as a function of the angular scales, from low $\ell$ values for large angular scales, to high $\ell$ values for small angular scales.At low $\ell$ there is not much statistics and the power spectrum is biased, but if we exclude lower ells, we can have an estimate of the white noise $C_\ell$ coefficients. We can then compare with the theoretical power computed as:$$ C_\ell = \Omega_{pix}\sigma^2 $$Where: $\Omega_{pix}$ is the pixel are in square-radians and $\sigma^2$ is the white noise standard variance.<jupyter_code>cl = hp.anafast(m)
cl[100:].mean()
pixel_area = hp.nside2pixarea(nside)
white_noise_cl = standard_deviation.value**2 * pixel_area
white_noise_cl
plt.figure(figsize=(6,4))
plt.loglog(cl, label="Map power spectrum", alpha=.7)
plt.hlines(white_noise_cl, 0, len(cl), label="White noise level")
plt.xlabel("$\ell$")
plt.ylabel("$C_\ell [\mu K ^ 2]$");<jupyter_output><empty_output><jupyter_text>MaskingIn case we are removing some pixels from a map, for example to mask out a strong signal (e.g. the Milky Way), our estimate of the power spectrum on the partial sky is lower.However we assume that the properties of the noise will be the same also in the masked region.At first order, for simple masks, we can just correct for the amplitude by dividing the power spectrum by the sky fraction.<jupyter_code>m.value[len(m)//2-30000:len(m)//2+30000] = hp.UNSEEN
hp.mollview(m, unit=m.unit, title="White noise map")
cl_masked = hp.anafast(m)
plt.figure(figsize=(6,4))
plt.loglog(cl, label="Map power spectrum", alpha=.7)
plt.loglog(cl_masked, label="Map power spectrum (Masked)", alpha=.7)
plt.hlines(white_noise_cl, 0, len(cl), label="White noise level")
plt.xlabel("$\ell$")
plt.ylabel("$C_\ell [\mu K ^ 2]$")
plt.legend();
sky_fraction = hp.mask_good(m).sum() / len(m)
print(sky_fraction)
plt.figure(figsize=(6,4))
plt.loglog(cl, label="Map power spectrum", alpha=.7)
plt.loglog(cl_masked / sky_fraction, label="Map power spectrum (Masked) - corrected", alpha=.7)
plt.hlines(white_noise_cl, 0, len(cl), label="White noise level")
plt.xlabel("$\ell$")
plt.ylabel("$C_\ell [\mu K ^ 2]$")
plt.legend();<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11897935779816514, 'fraction_numerical': 0.01548165137614679, 'mean_word_length': 5.607954545454546, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 18, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '19965', 'license': 'Apache-2.0', 'n_tokens_mistral': 1197, 'n_tokens_neox': 1119, 'n_words': 405, 'path': '_notebooks/2020-04-24-white-noise-angular-power-spectrum.ipynb', 'repo_name': 'julienchastang/zonca-blog', 'size': '3488'}