csiborgtools/notebooks/diagnostic/powerspectrum_H0.ipynb
Richard Stiskalek ee222cd010
Fix overlap runs (#125)
* Update nb

* Update script

* Update script

* Rename

* Update script

* Update script

* Remove warning

* Ignore minors when extracting MAH

* Fix paths bug

* Move notebooks

* Move files

* Rename and delete things

* Rename file

* Move file

* Rename things

* Remove old print statement

* Add basic MAH plot

* Add random MAH path

* Output snapshot numbers

* Add MAH random extraction

* Fix redshift bug

* Edit script

* Add extracting random MAH

* Little updates

* Add CB2 redshift

* Add some caching

* Add diagnostic plots

* Add caching

* Minor updates

* Update nb

* Update notebook

* Update script

* Add Sorce randoms

* Add CB2 varysmall

* Update nb

* Update nb

* Update nb

* Use catalogue HMF

* Move definition of radec2galactic

* Update nb

* Update import

* Update import

* Add galatic coords to catalogues

* Update nb
2024-04-08 11:23:21 +02:00

55 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()
No description has been provided for this image
In [ ]: