Nbar module

Computes mean HOD galaxy number density $\bar{n}(z)$,

$$ \bar{n}(z) = \int_0^\infty n_\mathrm{cen} (1 + n_\mathrm{sat}) \frac{dn(M, z)}{dM} dM $$

Related: PowerSpectrum, Hod, MassFunction.

nbar = Nbar(PowerSpectrum, Hod)

Operation Result
nbar(z) $\bar{n}(z)$ at redshift $z$
In [1]:
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
import mockgallib as mock

mock.cosmology_set(0.31) # set omega_m
ps = mock.PowerSpectrum('../data/planck1_matterpower.dat') # power spectrum is required to compute mass function
hod = mock.Hod()

nbar = mock.Nbar(ps, hod)

nbar
Out[1]:
nbar integration object
In [3]:
# See hod.ipynb for HOD parameterisation
hod.set_coef([12.0, 1.0, 0, 0, 1.0, 0, 13.0, 0, 1.5, 0])
print(hod)

z = np.arange(0.4, 1.2, 0.01)
n = [nbar(zz) for zz in z]

#plt.yscale('log')
plt.xlabel('$z$')
plt.ylabel('$\\bar{n}$')

plt.plot(z, n, 'r-');
HOD coef= [12.0, 1.0, 0.0, 0.0, 1.0, 0.0, 13.0, 0.0, 1.5, 0.0]
In [2]:
%%html
<style>table {float:left}</style>