mirror of
https://github.com/Richard-Sti/csiborgtools.git
synced 2024-12-22 22:08:02 +00:00
9e4b34f579
* Update README * Update density field reader * Update name of SDSSxALFAFA * Fix quick bug * Add little fixes * Update README * Put back fit_init * Add paths to initial snapshots * Add export * Remove some choices * Edit README * Add Jens' comments * Organize imports * Rename snapshot * Add additional print statement * Add paths to initial snapshots * Add masses to the initial files * Add normalization * Edit README * Update README * Fix bug in CSiBORG1 so that does not read fof_00001 * Edit README * Edit README * Overwrite comments * Add paths to init lag * Fix Quijote path * Add lagpatch * Edit submits * Update README * Fix numpy int problem * Update README * Add a flag to keep the snapshots open when fitting * Add a flag to keep snapshots open * Comment out some path issue * Keep snapshots open * Access directly snasphot * Add lagpatch for CSiBORG2 * Add treatment of x-z coordinates flipping * Add radial velocity field loader * Update README * Add lagpatch to Quijote * Fix typo * Add setter * Fix typo * Update README * Add output halo cat as ASCII * Add import * Add halo plot * Update README * Add evaluating field at radial distanfe * Add field shell evaluation * Add enclosed mass computation * Add BORG2 import * Add BORG boxsize * Add BORG paths * Edit run * Add BORG2 overdensity field * Add bulk flow clauclation * Update README * Add new plots * Add nbs * Edit paper * Update plotting * Fix overlap paths to contain simname * Add normalization of positions * Add default paths to CSiBORG1 * Add overlap path simname * Fix little things * Add CSiBORG2 catalogue * Update README * Add import * Add TNG density field constructor * Add TNG density * Add draft of calculating BORG ACL * Fix bug * Add ACL of enclosed density * Add nmean acl * Add galaxy bias calculation * Add BORG acl notebook * Add enclosed mass calculation * Add TNG300-1 dir * Add TNG300 and BORG1 dir * Update nb
829 KiB
829 KiB
In [6]:
import numpy as np
import matplotlib.pyplot as plt
import csiborgtools
from hmf import *
%load_ext autoreload
%autoreload 2
%matplotlib inline
In [22]:
bin_edges = np.arange(11.8, 15.2, 0.25)
xbin = (bin_edges[1:] + bin_edges[:-1]) / 2
bin_edges = 10**bin_edges
xbin = 10**xbin
paths = csiborgtools.read.Paths(**csiborgtools.paths_glamdring)
In [23]:
hmf_cb2_main = calculate_hmf("csiborg2_main", bin_edges)
hmf_cb2_random = calculate_hmf("csiborg2_random", bin_edges)
hmf_cb2_varysmall = calculate_hmf("csiborg2_varysmall", bin_edges)
hmf_mpdpl2 = MDPL2_HMF(bin_edges)
CB2_varysmall HMF¶
In [25]:
k = np.where(paths.get_ics("csiborg2_main") == 16417)[0][0]
fig, axs = plt.subplots(1, 2, figsize=(10, 4))
lw = plt.rcParams['lines.linewidth']
fig.subplots_adjust(hspace=0)
axs[0].plot(xbin, hmf_cb2_main[k], zorder=1, color="red", label="CB2 Main")
for i in range(len(hmf_cb2_varysmall)):
axs[0].plot(xbin, hmf_cb2_varysmall[i], lw=lw/2, color="black", zorder=0,
label="CB2 Varysmall" if i == 0 else None)
axs[1].plot(xbin, hmf_cb2_varysmall[i] / hmf_cb2_main[k], lw=lw/3, color="black", zorder=0)
xmin, xmax = xbin.min(), xbin.max()
for i in range(2):
axs[i].set_xscale("log")
axs[i].set_xlabel(r"$M_{\mathrm{FoF}}$ $[M_{\odot}]$")
axs[i].set_xlim(xmin, xmax)
axs[0].legend()
axs[0].set_ylabel(r"HMF $[1 / (h^{-3} \mathrm{Mpc}^3~\mathrm{dex})]$")
axs[1].set_ylabel(r"$\mathrm{HMF}_{\mathrm{Varysmall}}~/~\mathrm{HMF}_{\mathrm{Main}}$")
axs[0].set_yscale("log")
axs[1].set_ylim(0.9, 1.1)
axs[1].axhline(1, color="red", lw=lw, zorder=0)
fig.tight_layout()
fig.savefig("../../plots/varysmall_hmf.png", dpi=450)
fig.show()
In [24]:
plt.figure()
ylow, yhigh = np.percentile(hmf_cb2_main, [16, 84], axis=0)
plt.fill_between(xbin, ylow, yhigh, alpha=0.75, label="CB2 Main")
ylow, yhigh = np.percentile(hmf_cb2_random, [16, 84], axis=0)
plt.fill_between(xbin, ylow, yhigh, alpha=0.75, label="CB2 Random")
plt.plot(xbin, hmf_mpdpl2, label="MDPL2", color="red", ls="--")
plt.yscale("log")
plt.xscale("log")
plt.xlabel(r"$M_{\rm FoF} ~ [M_\odot / h]$")
plt.ylabel(r"HMF $[1 / (h^{-3} \mathrm{Mpc}^3~\mathrm{dex})]$")
plt.legend()
plt.xlim(xbin.min(), xbin.max())
plt.tight_layout()
plt.savefig("../../plots/HMF_comparison.png", dpi=450)
plt.show()
In [ ]: