# Install Latex to render labels
!apt install texlive texlive-latex-extra texlive-fonts-recommended cm-super-minimal dvipng
Generate figures for PySM
This notebook generates some figures of Galactic and Extra-Galactic emissions using PySM. Mostly for displaying purposes.
This notebook is designed to work on Google Colab, remove the apt
lines if executing locally but make sure you have a Latex environment.
%pip install pysm3
import pysm3
from pysm3 import units as u
import healpy as hp
= pysm3.Sky(nside=128, preset_strings=["c3"], output_unit=u.uK_CMB) sky
= sky.get_emission(100 * u.GHz) cmb
import matplotlib.pyplot as plt
'text.usetex'] = True plt.rcParams[
={"title":30, "cbar_label":20, "cbar_tick_label":20} fontsize
0].value, min=-250, max=250,
hp.projview(cmb[=fontsize,
fontsize=r'$\mu K_{CMB}$', title="Cosmic Microwave Background");
unit"1.jpg", bbox_inches="tight") plt.savefig(
= pysm3.Sky(nside=256, preset_strings=["s5"], output_unit=u.mK_RJ)
sky = sky.get_emission(23 * u.GHz)[0] sync
min=0.02, max=2,
hp.projview(sync.value, =fontsize, norm="symlog2", cmap="planck_log",
fontsize=r'$mK$', title=r"Synchrotron at $23 GHz$");
unit"2.jpg", bbox_inches="tight") plt.savefig(
= pysm3.Sky(nside=256, preset_strings=["f1"], output_unit=u.mK_RJ)
sky = sky.get_emission(30 * u.GHz)[0] freefree
min(), freefree.max() freefree.
(<Quantity 1.9947761e-07 mK_RJ>, <Quantity 212.05362 mK_RJ>)
min=0, max=10,
hp.projview(freefree.value, =fontsize,
fontsize#norm="hist",
= "plasma",
cmap #norm="symlog2", cmap="planck_log",
=r'$mK$', title=r"Free-free emission at $30 GHz$"); unit
= pysm3.Sky(nside=256, preset_strings=["a1"], output_unit=u.mK_RJ)
sky = sky.get_emission(30 * u.GHz)[0] ame
min=0.01, max=10,
hp.projview(ame.value, =fontsize,
fontsize="log",
norm= "magma",
cmap #norm="symlog2", cmap="planck_log",
=r'$mK_{RJ}$', title=r"Spinning dust at $30 GHz$");
unit"3.jpg", bbox_inches="tight") plt.savefig(
= pysm3.Sky(nside=256, preset_strings=["d10"], output_unit=u.mK_RJ)
sky = sky.get_emission(545 * u.GHz)[0] dust
min() dust.value.
0.03938505
-dust.value.min(), min=0.001, max=10,
hp.projview(dust.value=fontsize,
fontsize="log",
norm= "inferno",
cmap #norm="symlog2", cmap="planck_log",
=r'$mK_{RJ}$', title=r"Thermal Dust at $545 GHz$");
unit"4.jpg", bbox_inches="tight") plt.savefig(
= pysm3.Sky(nside=256, preset_strings=["co1"], output_unit=u.mK_RJ)
sky = sky.get_emission(sky.components[0].line_frequency['10'])[0] co
=sky.components[0] c
c.line_frequency
{'10': <Quantity 115.271 GHz>,
'21': <Quantity 230.538 GHz>,
'32': <Quantity 345.796 GHz>}
min=0.01, max=1,
hp.projview(co.value, =fontsize,
fontsize#norm="log",
= "Greys_r",
cmap #norm="symlog2", cmap="planck_log",
=r'$mK_{RJ}$', title=r"Carbon Monoxyde line at $115 GHz$");
unit"5.jpg", bbox_inches="tight") plt.savefig(
= pysm3.Sky(nside=2048, preset_strings=["rg1"], output_unit=u.uK_RJ)
sky = sky.get_emission(353*u.GHz)[0] rg
pysm3.apply_smoothing_and_coord_transform?
= pysm3.apply_smoothing_and_coord_transform(rg, output_nside=256,
rg_smoothed
=3 * u.arcmin) fwhm
min=0, max=10,
hp.projview(rg_smoothed.value, =fontsize,
fontsize#norm="log",
= "Oranges_r",
cmap #norm="symlog2", cmap="planck_log",
=r'$\mu K_{RJ}$', title=r"Radio galaxies at $353 GHz$");
unit"6.jpg", bbox_inches="tight") plt.savefig(
!apt install imagemagick
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
imagemagick is already the newest version (8:6.9.11.60+dfsg-1.3ubuntu0.22.04.3).
0 upgraded, 0 newly installed, 0 to remove and 45 not upgraded.
!rm -f montage.jpg
!montage -geometry -0+0 -size 2000 *.jpg montage.jpg
from IPython.display import Image
='montage.jpg') Image(filename