<jupyter_start><jupyter_text>`darkemu` module tutorial notebook<jupyter_code>%load_ext autoreload
%autoreload 2
%pylab inline
import logging 
mpl_logger = logging.getLogger('matplotlib') 
mpl_logger.setLevel(logging.WARNING) 
plt.rcParams['font.family'] = 'sans-serif'
plt.rcParams['font.size'] = 18
plt.rcParams['axes.linewidth'] = 1.5
plt.rcParams['xtick.major.size'] = 5
plt.rcParams['ytick.major.size'] = 5
plt.rcParams['xtick.minor.size'] = 3
plt.rcParams['ytick.minor.size'] = 3
plt.rcParams['xtick.top'] = True
plt.rcParams['ytick.right'] = True
plt.rcParams['xtick.minor.visible'] = True
plt.rcParams['ytick.minor.visible'] = True
plt.rcParams['xtick.direction'] = 'in'
plt.rcParams['ytick.direction'] = 'in'
plt.rcParams['figure.figsize'] = (10,6)
from dark_emulator import darkemu
emu = darkemu.base_class()<jupyter_output>initialize cosmo_class
Initialize pklin emulator
initialize propagator emulator
Initialize sigma_d emulator
initialize cross-correlation emulator
initialize auto-correlation emulator
Initialize sigmaM emulator
initialize xinl emulator<jupyter_text>how to set cosmology<jupyter_code>cparam = np.array([0.02225,0.1198,0.6844,3.094,0.9645,-1.])
emu.set_cosmology(cparam)<jupyter_output><empty_output><jupyter_text>how to plot halo-mass cross correlation for mass threshold halo samples<jupyter_code>rs = np.logspace(-2,2.5,200)

plt.figure(figsize=(10,6))

z = 0

for i, Mmin in enumerate(np.logspace(12,15,7)):
    xihm = emu.get_xicross_massthreshold(rs,Mmin,z)
    plt.loglog(rs,xihm,color="C{}".format(i),label='$M_\mathrm{th}=%0.2g$' %Mmin)
    plt.loglog(rs,-xihm,':',color="C{}".format(i))
plt.legend(fontsize=12)
plt.ylim(0.00001,1000000)
plt.xlabel("$x\,[h^{-1}\mathrm{Mpc}]$")
plt.ylabel("$\\xi_\mathrm{hm}(x)$")<jupyter_output><empty_output><jupyter_text>how to plot DeltaSigma(R) for a mass threshold halo samples<jupyter_code>rs = np.logspace(-1.5,2.5,100)

plt.figure(figsize=(10,6))

z = 0

for i, Mmin in enumerate(np.logspace(12,15,7)):
    dsigma = emu.get_DeltaSigma_massthreshold(rs,Mmin,z)
    plt.loglog(rs,dsigma,label='$M_\mathrm{th}=%0.2g$' %Mmin)
plt.legend(fontsize=12)
plt.ylim(0.002,1000)
plt.xlabel("$r_p\,[h^{-1}\mathrm{Mpc}]$")
plt.ylabel("$\Delta\Sigma(r_p)\,[h M_\odot \mathrm{pc}^{-2}]$")<jupyter_output><empty_output><jupyter_text>how to plot halo-halo correlation for mass threshold halo samples<jupyter_code>rs = np.logspace(-0.5,2.5,400)

plt.figure(figsize=(10,6))

z = 0

for i, Mmin in enumerate(np.logspace(12,14,5)):
    xih = emu.get_xiauto_massthreshold(rs,Mmin,z)
    plt.loglog(rs,xih,color="C{}".format(i),label='$M_\mathrm{th}=%0.2g$' %Mmin)
    plt.loglog(rs,-xih,':',color="C{}".format(i))
plt.legend(fontsize=12)
plt.ylim(0.0001,20)
plt.xlabel("$x\,[h^{-1}\mathrm{Mpc}]$")
plt.ylabel("$\\xi_\mathrm{hh}(x)$")<jupyter_output><empty_output><jupyter_text>how to plot halo-halo projected correlation function for mass threshold halo samples<jupyter_code>rs = np.logspace(-0.5,2.5,400)

z = 0

plt.figure(figsize=(10,6))

for i, Mmin in enumerate(np.logspace(12,14,5)):
    wh = emu.get_wauto_massthreshold(rs,Mmin,z)
    plt.loglog(rs,wh,color="C{}".format(i),label='$M_\mathrm{th}=%0.2g$' %Mmin)
    plt.loglog(rs,-wh,':',color="C{}".format(i))
plt.legend(fontsize=12)
plt.xlabel("$r_p\,[h^{-1}\mathrm{Mpc}]$")
plt.ylabel("$w_\mathrm{hh}(r_p)\,[h^{-1}\mathrm{Mpc}]$")<jupyter_output><empty_output><jupyter_text>Same as before, but for halos with fixed masses instead of mass threshold samples.<jupyter_code>rs = np.logspace(-2,2.5,200)
plt.figure(figsize=(10,6))
for i, M in enumerate(np.logspace(12,15,7)):
    xihm = emu.get_xicross_mass(rs,M,z)
    plt.loglog(rs,xihm,color="C{}".format(i),label='$M=%0.2g$' %M)
    plt.loglog(rs,-xihm,':',color="C{}".format(i))
plt.legend(fontsize=12)
plt.ylim(0.00001,1000000)
plt.xlabel("$x\,[h^{-1}\mathrm{Mpc}]$")
plt.ylabel("$\\xi_\mathrm{hm}(x)$")

rs = np.logspace(-1.5,2.5,100)
plt.figure(figsize=(10,6))
for i, M in enumerate(np.logspace(12,15,7)):
    dsigma = emu.get_DeltaSigma_mass(rs,M,z)
    plt.loglog(rs,dsigma,label='$M=%0.2g$' %M)
plt.legend(fontsize=12)
plt.ylim(0.002,1000)
plt.xlabel("$r_p\,[h^{-1}\mathrm{Mpc}]$")
plt.ylabel("$\Delta\Sigma(r_p)\,[h M_\odot \mathrm{pc}^{-2}]$")

rs = np.logspace(-0.5,2.5,400)
plt.figure(figsize=(10,6))
for i, M in enumerate(np.logspace(12,14,5)):
    xih = emu.get_xiauto_mass(rs,M,M,z)
    plt.loglog(rs,xih,color="C{}".format(i),label='$M=%0.2g$' %M)
    plt.loglog(rs,-xih,':',color="C{}".format(i))
plt.legend(fontsize=12)
plt.ylim(0.0001,40)
plt.xlabel("$x\,[h^{-1}\mathrm{Mpc}]$")
plt.ylabel("$\\xi_\mathrm{hh}(x)$")

rs = np.logspace(-0.5,2.5,400)
plt.figure(figsize=(10,6))
for i, M in enumerate(np.logspace(12,14,5)):
    wh = emu.get_wauto_mass(rs,M,M,z)
    plt.loglog(rs,wh,color="C{}".format(i),label='$M=%0.2g$' %M)
    plt.loglog(rs,-wh,':',color="C{}".format(i))
plt.legend(fontsize=12)
plt.xlabel("$r_p\,[h^{-1}\mathrm{Mpc}]$")
plt.ylabel("$w_\mathrm{hh}(r_p)\,[h^{-1}\mathrm{Mpc}]$")<jupyter_output><empty_output><jupyter_text>Halo-halo correlation function for halos with 2 different masses<jupyter_code>rs = np.logspace(-0.5,2.5,400)
Ms = np.logspace(12,14,3)
plt.figure(figsize=(10,6))
ii = 0
for i in range(3):
    for j in range(i,3):
        xih = emu.get_xiauto_mass(rs,Ms[i],Ms[j],z)
        plt.loglog(rs,xih,color="C{}".format(ii),label='$M_1=%0.2g,\,M_2=%0.2g$' %(Ms[i],Ms[j]))
        plt.loglog(rs,-xih,':',color="C{}".format(ii))
        ii+=1
plt.legend(fontsize=12)
plt.ylim(0.0001,40)
plt.xlabel("$x\,[h^{-1}\mathrm{Mpc}]$")
plt.ylabel("$\\xi_\mathrm{hh}(x)$")

rs = np.logspace(-0.5,2.5,400)
plt.figure(figsize=(10,6))
ii = 0
for i in range(3):
    for j in range(i,3):
        wh = emu.get_wauto_mass(rs,Ms[i],Ms[j],z)
        plt.loglog(rs,wh,color="C{}".format(ii),label='$M_1=%0.2g,\,M_2=%0.2g$' %(Ms[i],Ms[j]))
        plt.loglog(rs,-wh,':',color="C{}".format(ii))
        ii+=1
plt.legend(fontsize=12)
plt.xlabel("$r_p\,[h^{-1}\mathrm{Mpc}]$")
plt.ylabel("$w_\mathrm{hh}(r_p)\,[h^{-1}\mathrm{Mpc}]$")<jupyter_output><empty_output><jupyter_text>Projected Halo-halo correlation function with finite projection widthsThis takes more time because of an additional direct integration, which is bypassed by using pyfftlog in other routines.<jupyter_code>plt.figure(figsize=(10,6))
ii = 0
M = 1e13

for i, pimax in enumerate(np.linspace(50,200,4)):
    wh = emu.get_wauto_mass_cut(rs,M,M,z,pimax)
    plt.loglog(rs,wh,color="C{}".format(i),label='$\Pi_\mathrm{max}=%.1f$' %(pimax))
    plt.loglog(rs,-wh,':',color="C{}".format(i))

wh = emu.get_wauto_mass(rs,M,M,z)
plt.loglog(rs,wh,color="C{}".format(4),label='$\Pi_\mathrm{max}=\infty$')
plt.loglog(rs,-wh,':',color="C{}".format(4))

plt.legend(fontsize=12)
plt.xlabel("$r_p\,[h^{-1}\mathrm{Mpc}]$")
plt.ylabel("$w_\mathrm{hh}(r_p)\,[h^{-1}\mathrm{Mpc}]$")
plt.ylim(0.01,100)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.22990681421083284, 'fraction_numerical': 0.050378567268491554, 'mean_word_length': 6.315228966986155, 'pattern_counts': {'":': 0, '<': 36, '<?xml version=': 0, '>': 36, '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': '9', 'dir': 'jupyter-structured-clean-dedup', 'id': '404962', 'license': 'MIT', 'n_tokens_mistral': 3285, 'n_tokens_neox': 3012, 'n_words': 367, 'path': 'docs/tutorial.ipynb', 'repo_name': 'DarkQuestCosmology/dark_emulator_public', 'size': '6868'}