mirror of
https://github.com/Richard-Sti/csiborgtools.git
synced 2024-12-22 22:08:02 +00:00
eb8d070fff
* Add moving FoF membership files * add FoF membership path * Add notes where its PHEW * Add FoF catalogue path * Correct typo * Add more functionalities * Make work with halo IDs from FoF * Edit print statement * Fix copy bug * copy * Add FoF catalogue reading * Clean up script * Fix typo * Little edits * Fix naming convention * Rename key * Remove loading substructure particles * Rename CSiBORG Cat * Rename clumps cat * Rename cat * Remove misplaced import * Switch to halos * rm import * structfit of only halos * Add FoF halo reading * Add a short comment * Fix __getitem__ to work with int * Fix problems * Improve __getitem__ * Add more conversion * Fix indexing * Fix __getitem__ assertion * Fix numbers * Rename * Fix verbosity flags * Add full Quijote HMF option * Add plot of Quijote only * Add quijote full paths * Fix the fit_init script * Renam arg * Update .gitignore * add default argument name * Change default verbosity flag * Modernise script structure * Fix dictionary * Fix reading to include m200c * Modernise script * Add args
25 KiB
25 KiB
$P(k, H_0)$¶
Quick notebook to see how the power spectrum depends on $H_0$.
In [1]:
import numpy as np
import matplotlib.pyplot as plt
import camb
from camb import model
%matplotlib inline
In [19]:
def get_pk(h):
pars = camb.CAMBparams()
pars.set_cosmology(H0=h*100, ombh2=0.04825 * h**2, omch2=(0.307 - 0.04825) * h**2)
pars.InitPower.set_params(ns=0.9611)
pars.set_matter_power(redshifts=[0.], kmax=40)
#Non-Linear spectra (Halofit)
pars.NonLinear = model.NonLinear_both
results = camb.get_results(pars)
results.calc_power_spectra(pars)
kh_nonlin, z_nonlin, pk_nonlin = results.get_matter_power_spectrum(minkh=1e-3, maxkh=50, npoints = 200)
return kh_nonlin, pk_nonlin[0]
kh_nonlin, pk_nonlin_reference = get_pk(0.705)
In [25]:
plt.figure()
for h in [0.65, 0.70, 0.75]:
__, pk = get_pk(h)
plt.plot(kh_nonlnie, pk / pk_nonlin_reference, label=r"$h = {}$".format(h))
plt.legend()
plt.xscale("log")
plt.xlabel(r"$k ~ [h / \mathrm{Mpc}]$")
plt.ylabel(r"$P(k, h) / P(k, h=0.705)$")
plt.tight_layout()
plt.savefig("../plots/pk_h0_dependence.png", dpi=450)
plt.show()
In [ ]: