In [1]:
import numpy as np
import matplotlib.pyplot as plt
import hmf as hmf_calc
from colossus import lss

In [2]:
hmfBehroozi = hmf_calc.MassFunction(hmf_model=hmf_calc.fitting_functions.Behroozi)
hmfTinker08 = hmf_calc.MassFunction(hmf_model=hmf_calc.fitting_functions.Tinker08)
hmfTinker10 = hmf_calc.MassFunction(hmf_model=hmf_calc.fitting_functions.Tinker10)
hmfCrocce = hmf_calc.MassFunction(hmf_model=hmf_calc.fitting_functions.Crocce)
hmfWatson = hmf_calc.MassFunction(hmf_model= hmf_calc.fitting_functions.Watson)
hmfBhattacharya = hmf_calc.MassFunction(hmf_model= hmf_calc.fitting_functions.Bhattacharya)
hmfManera = hmf_calc.MassFunction(hmf_model= hmf_calc.fitting_functions.Manera)
hmfAngulo = hmf_calc.MassFunction(hmf_model= hmf_calc.fitting_functions.Angulo)

In [3]:
plt.loglog(hmfBehroozi.m, hmfBehroozi.dndlog10m)
plt.loglog(hmfTinker08.m, hmfTinker08.dndlog10m)


Out[3]:
[<matplotlib.lines.Line2D at 0x107c82550>]

In [4]:
plt.semilogx(hmfBehroozi.m, hmfBehroozi.dndlog10m/hmfTinker08.dndlog10m, label='Behroozi/Tinker08')
plt.semilogx(hmfBehroozi.m, hmfTinker10.dndlog10m/hmfTinker08.dndlog10m, '--', label='Tinker10/Tinker08')
plt.semilogx(hmfBehroozi.m, hmfCrocce.dndlog10m/hmfTinker08.dndlog10m, label='Crocce10/Tinker08' )
plt.semilogx(hmfBehroozi.m, hmfWatson.dndlog10m/hmfTinker08.dndlog10m, label='Watson13/Tinker08' )
plt.semilogx(hmfBehroozi.m, hmfBhattacharya.dndlog10m/hmfTinker08.dndlog10m, label='Bhattacharya/Tinker08' )
plt.semilogx(hmfBehroozi.m, hmfManera.dndlog10m/hmfTinker08.dndlog10m, label='Manera10/Tinker08' )
plt.semilogx(hmfBehroozi.m, hmfAngulo.dndlog10m/hmfTinker08.dndlog10m, label='Angulo/Tinker08' )
plt.xlabel('$\mathrm{log}_{10}(M_{\mathrm{h}})$', size=15)
plt.ylabel('$\phi / \phi_{\mathrm{Tinker08}}$', size=15)
plt.legend()


Out[4]:
<matplotlib.legend.Legend at 0x108cac630>

In [ ]:


In [ ]:


In [5]:
from colossus.cosmology import cosmology
cosmo = cosmology.setCosmology('planck13');

In [6]:
from colossus.lss import mass_function

In [7]:
z = [0.0, 1.0, 2.0, 4.0]
M = 10**np.arange(11.0, 15.5, 0.1)

plt.figure()
plt.xlabel('M200m')
plt.ylabel('dn/dln(M)')
plt.loglog()
plt.xlim(1E11, 4E15)
plt.ylim(1E-7, 1E-1)
for i in range(len(z)):
    mfunc = mass_function.massFunction(M, z[i], mdef = '200m', model = 'tinker08', q_out = 'dndlnM')
    plt.plot(M, mfunc, '-', label = 'z = %.1f' % (z[i]))
plt.legend();



In [8]:
z = 0.0
M = 10**np.arange(9.0, 15.5, 0.1)

plt.figure()
plt.xscale('log')
plt.xlabel('$M_{FOF}$')
plt.ylabel('$f/f_{sheth99} - 1$')
plt.xlim(1E5, 5E15)
plt.ylim(-0.6, 0.6)
plt.axhline(1.0, ls = '--', color = 'gray')

ref = mass_function.massFunction(M, z, model = 'sheth99')
for model in mass_function.models:
    if 'fof' in mass_function.models[model].mdefs:
        mfunc = mass_function.massFunction(M, z, mdef = 'fof', model = model)
        plt.plot(M, mfunc / ref - 1.0, '-', label = model)
plt.legend(loc = 3);



In [9]:
plt.figure()
plt.xscale('log')
plt.xlabel('$M_{200m}$')
plt.ylabel('$f/f_{sheth99} - 1$')
plt.xlim(1E5, 5E15)
plt.ylim(-0.6, 0.6)
plt.axhline(1.0, ls = '--', color = 'gray')

ref = mass_function.massFunction(M, z, model = 'tinker08', mdef = '200m')
for model in mass_function.models:
    if '200m' in mass_function.models[model].mdefs or '*' in mass_function.models[model].mdefs:
        mfunc = mass_function.massFunction(M, z, mdef = '200m', model = model)
        plt.plot(M, mfunc / ref - 1.0, '-', label = model)
plt.legend(loc = 3);



In [10]:
redshifts = np.array([0.2, 0.5, 0.8, 1.1, 1.5, 2, 2.5, 3, 3.5, 4.5, 5.5])
redshiftsbin = (redshifts[1:]+redshifts[:-1])
numzbin = np.size(redshifts) - 1

In [11]:
hmf=[]
print('Use Depsali+16 HMF in Planck15 cosmo from Colossus module')
mdef = '200m'
print('Use '+mdef+' for the SO defintion.')

redshift_haloes = redshiftsbin
M = 10**np.arange(8.0, 15.5, 0.01)
for i in range(numzbin):
    hmf.append(np.transpose(np.array([np.log10(M / cosmo.h), np.log10(mass_function.massFunction(M, redshift_haloes[i], mdef = mdef, model ='despali16', q_out = 'dndlnM'))])))


Use Depsali+16 HMF in Planck15 cosmo from Colossus module
Use 200m for the SO defintion.

In [12]:
hmfct=[]
mdef = '200m'
print('Use '+mdef+' for the SO defintion.')

redshift_haloes = redshiftsbin
M = 10**np.arange(8.0, 15.5, 0.01)
for i in range(numzbin):
    hmfct.append(np.transpose(np.array([np.log10(M / cosmo.h), np.log10(mass_function.massFunction(M, redshift_haloes[i], mdef = mdef, model ='tinker08', q_out = 'dndlnM'))])))


Use 200m for the SO defintion.

In [ ]:


In [ ]:


In [67]:
hmft=[]
# print hmf parameters with h.param_values
print('Use Tinker+08 HMF in PLanck cosmo from hmf module')
h = hmf_calc.MassFunction()
h.update(Mmin=8)
h.update(Mmax=15.5)

print(h.parameter_values)
redshift_haloes = redshiftsbin
for i in range(numzbin):
    h.update(z=redshiftsbin[i])
    hmft.append(np.transpose(np.array([np.log10(h.m / h.cosmo_model.h),
               np.log10(h.dndlog10m * (h.cosmo_model.h)**3)])))  # Replace the h implicit in the HMF


Use Tinker+08 HMF in PLanck cosmo from hmf module
{'cosmo_model': FlatLambdaCDM(name="Planck15", H0=67.7 km / (Mpc s), Om0=0.307, Tcmb0=2.725 K, Neff=3.05, m_nu=[0.   0.   0.06] eV, Ob0=0.0486), 'cosmo_params': {}, 'n': 0.9667, 'sigma_8': 0.8159, 'growth_model': <class 'hmf.growth_factor.GrowthFactor'>, 'growth_params': {}, 'lnk_min': -18.420680743952367, 'lnk_max': 9.903487552536127, 'dlnk': 0.05, 'z': 0.0, 'transfer_model': <class 'hmf.transfer_models.EH'>, 'transfer_params': {}, 'takahashi': True, 'hmf_model': <class 'hmf.fitting_functions.Tinker08'>, 'Mmin': 8, 'Mmax': 15.5, 'dlog10m': 0.01, 'delta_h': 200.0, 'delta_wrt': 'mean', 'delta_c': 1.686, 'hmf_params': {}, 'filter_model': <class 'hmf.filters.TopHat'>, 'filter_params': {}}

In [14]:
h.cosmo_model.Om0


Out[14]:
0.3075

In [62]:
print(cosmo)


Cosmology "planck15" 
    flat = True, Om0 = 0.3089, Ode0 = 0.6910, Ob0 = 0.0486, H0 = 67.74, sigma8 = 0.8159, ns = 0.9667
    de_model = lambda, relspecies = True, Tcmb0 = 2.7255, Neff = 3.0460, powerlaw = False

In [ ]:


In [60]:
plt.plot(hmf[0][:,0], hmf[0][:,1])
plt.plot(hmfct[0][:,0], hmfct[0][:,1])
plt.plot(hmft[0][:,0], hmft[0][:,1])


Out[60]:
[<matplotlib.lines.Line2D at 0x10c7ac080>]

In [18]:
#plt.plot(hmf[0][:,0], 10**hmf[0][:,1] / 10**hmft[0][:,1])
plt.plot(hmfct[0][:,0], 10**hmfct[0][:,1] / 10**hmft[0][:,1])

#plt.ylim(1, 1.7)


Out[18]:
[<matplotlib.lines.Line2D at 0x10992bb38>]

In [90]:
hmfCalcCrocce = hmf_calc.MassFunction(hmf_model=hmf_calc.fitting_functions.Crocce)
hmfCalcCrocce.update(Mmin=8)
hmfCalcCrocce.update(Mmax=15.5)
print(hmfCalcCrocce.parameter_values)


M = 10**np.arange(8.0, 18, 0.01)
cosmo = cosmology.setCosmology('planck15');
colossusCrocce = mass_function.massFunction(M, 5, mdef = 'fof', model ='crocce10', q_out = 'dndlnM')


{'cosmo_model': FlatLambdaCDM(name="Planck15", H0=67.7 km / (Mpc s), Om0=0.307, Tcmb0=2.725 K, Neff=3.05, m_nu=[0.   0.   0.06] eV, Ob0=0.0486), 'cosmo_params': {}, 'n': 0.9667, 'sigma_8': 0.8159, 'growth_model': <class 'hmf.growth_factor.GrowthFactor'>, 'growth_params': {}, 'lnk_min': -18.420680743952367, 'lnk_max': 9.903487552536127, 'dlnk': 0.05, 'z': 0.0, 'transfer_model': <class 'hmf.transfer_models.EH'>, 'transfer_params': {}, 'takahashi': True, 'hmf_model': <class 'hmf.fitting_functions.Crocce'>, 'Mmin': 8, 'Mmax': 15.5, 'dlog10m': 0.01, 'delta_h': 200.0, 'delta_wrt': 'mean', 'delta_c': 1.686, 'hmf_params': {}, 'filter_model': <class 'hmf.filters.TopHat'>, 'filter_params': {}}

In [91]:
colossusCrocce


Out[91]:
array([1.75192878e+001, 1.71250708e+001, 1.67395830e+001, 1.63626328e+001,
       1.59940332e+001, 1.56336011e+001, 1.52811573e+001, 1.49365268e+001,
       1.45995382e+001, 1.42700238e+001, 1.39478196e+001, 1.36327654e+001,
       1.33247041e+001, 1.30234824e+001, 1.27289501e+001, 1.24409603e+001,
       1.21593694e+001, 1.18840369e+001, 1.16148254e+001, 1.13516004e+001,
       1.10942304e+001, 1.08425867e+001, 1.05965435e+001, 1.03559778e+001,
       1.01207691e+001, 9.89079961e+000, 9.66595418e+000, 9.44612009e+000,
       9.23118711e+000, 9.02104743e+000, 8.81559558e+000, 8.61472837e+000,
       8.41834491e+000, 8.22634647e+000, 8.03863651e+000, 7.85512058e+000,
       7.67570629e+000, 7.50030328e+000, 7.32882316e+000, 7.16117946e+000,
       6.99728762e+000, 6.83706492e+000, 6.68043043e+000, 6.52730502e+000,
       6.37761126e+000, 6.23127343e+000, 6.08821746e+000, 5.94837090e+000,
       5.81166289e+000, 5.67802412e+000, 5.54738677e+000, 5.41968454e+000,
       5.29485256e+000, 5.17282738e+000, 5.05354694e+000, 4.93695055e+000,
       4.82297883e+000, 4.71157371e+000, 4.60267839e+000, 4.49623730e+000,
       4.39219612e+000, 4.29050168e+000, 4.19110201e+000, 4.09394625e+000,
       3.99898466e+000, 3.90616861e+000, 3.81545051e+000, 3.72678383e+000,
       3.64012305e+000, 3.55542366e+000, 3.47264211e+000, 3.39173581e+000,
       3.31266312e+000, 3.23538328e+000, 3.15985646e+000, 3.08604369e+000,
       3.01390685e+000, 2.94340865e+000, 2.87451264e+000, 2.80718315e+000,
       2.74138532e+000, 2.67708502e+000, 2.61424890e+000, 2.55284432e+000,
       2.49283937e+000, 2.43420285e+000, 2.37690422e+000, 2.32091363e+000,
       2.26620189e+000, 2.21274044e+000, 2.16050136e+000, 2.10945733e+000,
       2.05958163e+000, 2.01084816e+000, 1.96323135e+000, 1.91670622e+000,
       1.87124834e+000, 1.82683381e+000, 1.78343926e+000, 1.74104184e+000,
       1.69961918e+000, 1.65914944e+000, 1.61961123e+000, 1.58098366e+000,
       1.54324627e+000, 1.50637908e+000, 1.47036252e+000, 1.43517749e+000,
       1.40080529e+000, 1.36722762e+000, 1.33442661e+000, 1.30238477e+000,
       1.27108501e+000, 1.24051059e+000, 1.21064518e+000, 1.18147278e+000,
       1.15297776e+000, 1.12514481e+000, 1.09795901e+000, 1.07140571e+000,
       1.04547064e+000, 1.02013980e+000, 9.95399530e-001, 9.71236460e-001,
       9.47637520e-001, 9.24589930e-001, 9.02081193e-001, 8.80099090e-001,
       8.58631671e-001, 8.37667254e-001, 8.17194415e-001, 7.97201985e-001,
       7.77679042e-001, 7.58614908e-001, 7.39999142e-001, 7.21821534e-001,
       7.04072104e-001, 6.86741092e-001, 6.69818955e-001, 6.53296365e-001,
       6.37164199e-001, 6.21413540e-001, 6.06035667e-001, 5.91022057e-001,
       5.76364375e-001, 5.62054471e-001, 5.48084379e-001, 5.34446311e-001,
       5.21132652e-001, 5.08135957e-001, 4.95448949e-001, 4.83064512e-001,
       4.70975690e-001, 4.59175684e-001, 4.47657845e-001, 4.36415675e-001,
       4.25442857e-001, 4.14733679e-001, 4.04282183e-001, 3.94082378e-001,
       3.84128409e-001, 3.74414554e-001, 3.64935221e-001, 3.55684947e-001,
       3.46658391e-001, 3.37850335e-001, 3.29255680e-001, 3.20869442e-001,
       3.12686750e-001, 3.04702847e-001, 2.96913082e-001, 2.89312910e-001,
       2.81897890e-001, 2.74663684e-001, 2.67606051e-001, 2.60720848e-001,
       2.54004026e-001, 2.47451628e-001, 2.41059788e-001, 2.34824731e-001,
       2.28742763e-001, 2.22810279e-001, 2.17023755e-001, 2.11379747e-001,
       2.05874891e-001, 2.00505901e-001, 1.95269563e-001, 1.90162740e-001,
       1.85182365e-001, 1.80325444e-001, 1.75589048e-001, 1.70970318e-001,
       1.66466460e-001, 1.62074744e-001, 1.57792504e-001, 1.53617133e-001,
       1.49546087e-001, 1.45576878e-001, 1.41707077e-001, 1.37934309e-001,
       1.34256257e-001, 1.30670656e-001, 1.27175291e-001, 1.23768001e-001,
       1.20446675e-001, 1.17209249e-001, 1.14053708e-001, 1.10978084e-001,
       1.07980453e-001, 1.05058937e-001, 1.02211701e-001, 9.94369522e-002,
       9.67329408e-002, 9.40979564e-002, 9.15303286e-002, 8.90284259e-002,
       8.65906549e-002, 8.42154592e-002, 8.19013185e-002, 7.96467482e-002,
       7.74502983e-002, 7.53105523e-002, 7.32261273e-002, 7.11956723e-002,
       6.92178680e-002, 6.72914261e-002, 6.54150884e-002, 6.35876260e-002,
       6.18078391e-002, 6.00745559e-002, 5.83866320e-002, 5.67429501e-002,
       5.51424191e-002, 5.35839734e-002, 5.20665728e-002, 5.05892013e-002,
       4.91508671e-002, 4.77506016e-002, 4.63874593e-002, 4.50605168e-002,
       4.37688727e-002, 4.25116469e-002, 4.12879801e-002, 4.00970335e-002,
       3.89379880e-002, 3.78100441e-002, 3.67124214e-002, 3.56443578e-002,
       3.46051094e-002, 3.35939503e-002, 3.26101716e-002, 3.16530815e-002,
       3.07220046e-002, 2.98162817e-002, 2.89352695e-002, 2.80783399e-002,
       2.72448801e-002, 2.64342917e-002, 2.56459911e-002, 2.48794082e-002,
       2.41339872e-002, 2.34091853e-002, 2.27044728e-002, 2.20193331e-002,
       2.13532618e-002, 2.07057668e-002, 2.00763680e-002, 1.94645967e-002,
       1.88699958e-002, 1.82921193e-002, 1.77305320e-002, 1.71848093e-002,
       1.66545370e-002, 1.61393108e-002, 1.56387367e-002, 1.51524299e-002,
       1.46800153e-002, 1.42211270e-002, 1.37754079e-002, 1.33425099e-002,
       1.29220933e-002, 1.25138269e-002, 1.21173877e-002, 1.17324604e-002,
       1.13587380e-002, 1.09959206e-002, 1.06437160e-002, 1.03018394e-002,
       9.97001275e-003, 9.64796518e-003, 9.33543251e-003, 9.03215714e-003,
       8.73788795e-003, 8.45238011e-003, 8.17539493e-003, 7.90669972e-003,
       7.64606766e-003, 7.39327765e-003, 7.14811417e-003, 6.91036716e-003,
       6.67983189e-003, 6.45630880e-003, 6.23960345e-003, 6.02952630e-003,
       5.82589269e-003, 5.62852266e-003, 5.43724086e-003, 5.25187644e-003,
       5.07226293e-003, 4.89823816e-003, 4.72964413e-003, 4.56632694e-003,
       4.40813664e-003, 4.25492719e-003, 4.10655636e-003, 3.96288559e-003,
       3.82377995e-003, 3.68910805e-003, 3.55874191e-003, 3.43255693e-003,
       3.31043178e-003, 3.19224833e-003, 3.07789156e-003, 2.96724951e-003,
       2.86021318e-003, 2.75667645e-003, 2.65653606e-003, 2.55969148e-003,
       2.46604489e-003, 2.37550106e-003, 2.28796736e-003, 2.20335363e-003,
       2.12157215e-003, 2.04253759e-003, 1.96616690e-003, 1.89237932e-003,
       1.82109629e-003, 1.75224139e-003, 1.68574029e-003, 1.62152071e-003,
       1.55951236e-003, 1.49964689e-003, 1.44185785e-003, 1.38608062e-003,
       1.33225240e-003, 1.28031213e-003, 1.23020046e-003, 1.18185972e-003,
       1.13523384e-003, 1.09026837e-003, 1.04691036e-003, 1.00510839e-003,
       9.64812505e-004, 9.25974173e-004, 8.88546253e-004, 8.52482962e-004,
       8.17740079e-004, 7.84275858e-004, 7.52048375e-004, 7.21016663e-004,
       6.91140967e-004, 6.62382716e-004, 6.34704485e-004, 6.08069967e-004,
       5.82443946e-004, 5.57792262e-004, 5.34081787e-004, 5.11280393e-004,
       4.89356931e-004, 4.68281196e-004, 4.48023911e-004, 4.28556693e-004,
       4.09852034e-004, 3.91883274e-004, 3.74624581e-004, 3.58050923e-004,
       3.42138053e-004, 3.26862480e-004, 3.12201453e-004, 2.98132939e-004,
       2.84635602e-004, 2.71688785e-004, 2.59272488e-004, 2.47367356e-004,
       2.35954652e-004, 2.25016247e-004, 2.14534599e-004, 2.04492736e-004,
       1.94874243e-004, 1.85663242e-004, 1.76844379e-004, 1.68402809e-004,
       1.60324179e-004, 1.52594618e-004, 1.45200717e-004, 1.38129520e-004,
       1.31368512e-004, 1.24905600e-004, 1.18729105e-004, 1.12827751e-004,
       1.07190648e-004, 1.01807284e-004, 9.66675137e-005, 9.17615464e-005,
       8.70799353e-005, 8.26135674e-005, 7.83536532e-005, 7.42917171e-005,
       7.04195872e-005, 6.67293864e-005, 6.32135230e-005, 5.98646819e-005,
       5.66758159e-005, 5.36401374e-005, 5.07511100e-005, 4.80024407e-005,
       4.53880721e-005, 4.29021747e-005, 4.05391397e-005, 3.82935719e-005,
       3.61602827e-005, 3.41342832e-005, 3.22107778e-005, 3.03851579e-005,
       2.86529953e-005, 2.70100367e-005, 2.54521973e-005, 2.39755554e-005,
       2.25763470e-005, 2.12509599e-005, 1.99959290e-005, 1.88079309e-005,
       1.76837792e-005, 1.66204193e-005, 1.56149244e-005, 1.46644904e-005,
       1.37664315e-005, 1.29181766e-005, 1.21172644e-005, 1.13613399e-005,
       1.06481502e-005, 9.97554101e-006, 9.34145277e-006, 8.74391722e-006,
       8.18105393e-006, 7.65106698e-006, 7.15224175e-006, 6.68294174e-006,
       6.24160563e-006, 5.82674427e-006, 5.43693791e-006, 5.07083338e-006,
       4.72714153e-006, 4.40463455e-006, 4.10214358e-006, 3.81855625e-006,
       3.55281437e-006, 3.30391171e-006, 3.07089179e-006, 2.85284580e-006,
       2.64891058e-006, 2.45826668e-006, 2.28013645e-006, 2.11378224e-006,
       1.95850462e-006, 1.81364072e-006, 1.67856258e-006, 1.55267559e-006,
       1.43541696e-006, 1.32625429e-006, 1.22468414e-006, 1.13023068e-006,
       1.04244444e-006, 9.60900981e-007, 8.85199776e-007, 8.14963002e-007,
       7.49834457e-007, 6.89478491e-007, 6.33578988e-007, 5.81838388e-007,
       5.33976748e-007, 4.89730843e-007, 4.48853305e-007, 4.11111801e-007,
       3.76288239e-007, 3.44178019e-007, 3.14589307e-007, 2.87342346e-007,
       2.62268798e-007, 2.39211115e-007, 2.18021940e-007, 1.98563529e-007,
       1.80707213e-007, 1.64332873e-007, 1.49328447e-007, 1.35589457e-007,
       1.23018564e-007, 1.11525141e-007, 1.01024866e-007, 9.14393417e-008,
       8.26957298e-008, 7.47264043e-008, 6.74686258e-008, 6.08642305e-008,
       5.48593373e-008, 4.94040702e-008, 4.44522960e-008, 3.99613771e-008,
       3.58919372e-008, 3.22076417e-008, 2.88749890e-008, 2.58631161e-008,
       2.31436135e-008, 2.06903531e-008, 1.84793250e-008, 1.64884851e-008,
       1.46976121e-008, 1.30881730e-008, 1.16431979e-008, 1.03471620e-008,
       9.18587613e-009, 8.14638354e-009, 7.21686455e-009, 6.38654702e-009,
       5.64562311e-009, 4.98517185e-009, 4.39708707e-009, 3.87401081e-009,
       3.40927964e-009, 2.99684896e-009, 2.63124433e-009, 2.30751830e-009,
       2.02120451e-009, 1.76827527e-009, 1.54510245e-009, 1.34842152e-009,
       1.17529839e-009, 1.02309904e-009, 8.89461538e-010, 7.72270449e-010,
       6.69633382e-010, 5.79859514e-010, 5.01439989e-010, 4.33030007e-010,
       3.73432506e-010, 3.21583300e-010, 2.76537557e-010, 2.37457522e-010,
       2.03601374e-010, 1.74313135e-010, 1.49013532e-010, 1.27191741e-010,
       1.08397938e-010, 9.22365842e-011, 7.83603772e-011, 6.64648229e-011,
       5.62833560e-011, 4.75829711e-011, 4.01603106e-011, 3.38381696e-011,
       2.84623771e-011, 2.38990175e-011, 2.00319590e-011, 1.67606578e-011,
       1.39982123e-011, 1.16696393e-011, 9.71035100e-012, 8.06481127e-012,
       6.68535154e-012, 5.53112994e-012, 4.56721744e-012, 3.76379708e-012,
       3.09546354e-012, 2.54061166e-012, 2.08090338e-012, 1.70080427e-012,
       1.38718095e-012, 1.12895241e-012, 9.16788321e-013, 7.42848789e-013,
       6.00560086e-013, 4.84421929e-013, 3.89842145e-013, 3.12995154e-013,
       2.50701094e-013, 2.00322795e-013, 1.59678174e-013, 1.26965897e-013,
       1.00702445e-013, 7.96689666e-014, 6.28664859e-014, 4.94782551e-014,
       3.88381796e-014, 3.04044058e-014, 2.37372798e-014, 1.84810015e-014,
       1.43483934e-014, 1.11082869e-014, 8.57510593e-015, 6.60028629e-015,
       5.06522712e-015, 3.87551708e-015, 2.95621755e-015, 2.24802044e-015,
       1.70412747e-015, 1.28772277e-015, 9.69932158e-016, 7.28180289e-016,
       5.44872171e-016, 4.06338268e-016, 3.01993170e-016, 2.23666728e-016,
       1.65074024e-016, 1.21396749e-016, 8.89536658e-017, 6.49420914e-017,
       4.72357806e-017, 3.42274646e-017, 2.47066116e-017, 1.77648726e-017,
       1.27232097e-017, 9.07594333e-018, 6.44795178e-018, 4.56205685e-018,
       3.21426792e-018, 2.25506494e-018, 1.57530379e-018, 1.09564561e-018,
       7.58661739e-019, 5.22961681e-019, 3.58844250e-019, 2.45090739e-019,
       1.66610532e-019, 1.12720264e-019, 7.58917167e-020, 5.08449603e-020,
       3.38945906e-020, 2.24806606e-020, 1.48337392e-020, 9.73691192e-021,
       6.35750114e-021, 4.12868018e-021, 2.66661320e-021, 1.71276029e-021,
       1.09391633e-021, 6.94680542e-022, 4.38592897e-022, 2.75280058e-022,
       1.71745438e-022, 1.06500809e-022, 6.56352421e-023, 4.01972469e-023,
       2.44617994e-023, 1.47900783e-023, 8.88380270e-024, 5.30065226e-024,
       3.14135165e-024, 1.84890543e-024, 1.08063001e-024, 6.27127708e-025,
       3.61329348e-025, 2.06666252e-025, 1.17328874e-025, 6.61086540e-026,
       3.69639159e-026, 2.05074254e-026, 1.12876659e-026, 6.16314507e-027,
       3.33772305e-027, 1.79263271e-027, 9.54702153e-028, 5.04105552e-028,
       2.63871477e-028, 1.36905261e-028, 7.03951543e-029, 3.58671664e-029,
       1.81058722e-029, 9.05410286e-030, 4.48445189e-030, 2.19960401e-030,
       1.06827451e-030, 5.13635812e-031, 2.44450765e-031, 1.15138228e-031,
       5.36619939e-032, 2.47433775e-032, 1.12854929e-032, 5.09066569e-033,
       2.27061162e-033, 1.00125733e-033, 4.36417386e-034, 1.87987650e-034,
       8.00098578e-035, 3.36402365e-035, 1.39697571e-035, 5.72854436e-036,
       2.31918315e-036, 9.26764213e-037, 3.65471345e-037, 1.42197514e-037,
       5.45743114e-038, 2.06558628e-038, 7.70826527e-039, 2.83547473e-039,
       1.02788952e-039, 3.67123689e-040, 1.29156285e-040, 4.47451217e-041,
       1.52612703e-041, 5.12314055e-042, 1.69225614e-042, 5.49872065e-043,
       1.75712332e-043, 5.52032837e-044, 1.70460766e-044, 5.17193731e-045,
       1.54142154e-045, 4.51124681e-046, 1.29611610e-046, 3.65448355e-047,
       1.01088783e-047, 2.74240891e-048, 7.29404588e-049, 1.90135768e-049,
       4.85587427e-050, 1.21457881e-050, 2.97428163e-051, 7.12815458e-052,
       1.67127624e-052, 3.83203851e-053, 8.58921017e-054, 1.88124931e-054,
       4.02470428e-055, 8.40693103e-056, 1.71385806e-056, 3.40847847e-057,
       6.61006169e-058, 1.24944461e-058, 2.30090459e-059, 4.12619836e-060,
       7.20223683e-061, 1.22304508e-061, 2.01959014e-062, 3.24125761e-063,
       5.05327592e-064, 7.64921668e-065, 1.12361198e-065, 1.60080226e-066,
       2.21076648e-067, 2.95793869e-068, 3.83203163e-069, 4.80408040e-070,
       5.82472459e-071, 6.82593405e-072, 7.72685543e-073, 8.44354162e-074,
       8.90121797e-075, 9.04676690e-076, 8.85864223e-077, 8.35171365e-078,
       7.57561161e-079, 6.60672884e-080, 5.53565246e-081, 4.45292441e-082,
       3.43629334e-083, 2.54197477e-084, 1.80114786e-085, 1.22145884e-086,
       7.92149033e-088, 4.90878130e-089, 2.90410336e-090, 1.63888131e-091,
       8.81450330e-093, 4.51412109e-094, 2.19925594e-095, 1.01835606e-096,
       4.47744914e-098, 1.86743797e-099, 7.38099590e-101, 2.76182981e-102,
       9.77333824e-104, 3.26734272e-105, 1.03082385e-106, 3.06573673e-108,
       8.58536330e-110, 2.26130241e-111, 5.59534933e-113, 1.29911110e-114,
       2.82674804e-116, 5.75718028e-118, 1.09613353e-119, 1.94843310e-121,
       3.22925025e-123, 4.98340107e-125, 7.15087877e-127, 9.52777260e-129,
       1.17705805e-130, 1.34630026e-132, 1.42355137e-134, 1.38940043e-136,
       1.24976003e-138, 1.03438045e-140, 7.86480352e-143, 5.48446967e-145,
       3.50179714e-147, 2.04367625e-149, 1.08827240e-151, 5.27826605e-154,
       2.32745115e-156, 9.31314567e-159, 3.37530208e-161, 1.10582368e-163,
       3.26854838e-166, 8.69842100e-169, 2.07990996e-171, 4.45913301e-174,
       8.55306744e-177, 1.46454568e-179, 2.23366082e-182, 3.02738612e-185,
       3.63778067e-188, 3.86619260e-191, 3.62532343e-194, 2.99186305e-197,
       2.16750726e-200, 1.37490235e-203, 7.61587690e-207, 3.67387442e-210,
       1.53914404e-213, 5.58409913e-217, 1.74939434e-220, 4.71843312e-224,
       1.09237165e-227, 2.16403488e-231, 3.65686579e-235, 5.25417776e-239,
       6.39766057e-243, 6.57956239e-247, 5.69559574e-251, 4.13544372e-255,
       2.50949972e-259, 1.26806510e-263, 5.31566781e-268, 1.84150523e-272,
       5.25154980e-277, 1.22790501e-281, 2.34439106e-286, 3.63973379e-291,
       4.57540838e-296, 4.63677885e-301, 3.77131686e-306, 2.45064782e-311,
       1.26636070e-316, 5.18768928e-322, 0.00000000e+000, 0.00000000e+000,
       0.00000000e+000, 0.00000000e+000, 0.00000000e+000, 0.00000000e+000,
       0.00000000e+000, 0.00000000e+000, 0.00000000e+000, 0.00000000e+000,
       0.00000000e+000, 0.00000000e+000, 0.00000000e+000, 0.00000000e+000,
       0.00000000e+000, 0.00000000e+000, 0.00000000e+000, 0.00000000e+000,
       0.00000000e+000, 0.00000000e+000, 0.00000000e+000, 0.00000000e+000,
       0.00000000e+000, 0.00000000e+000, 0.00000000e+000, 0.00000000e+000,
       0.00000000e+000, 0.00000000e+000, 0.00000000e+000, 0.00000000e+000,
       0.00000000e+000, 0.00000000e+000, 0.00000000e+000, 0.00000000e+000,
       0.00000000e+000, 0.00000000e+000, 0.00000000e+000, 0.00000000e+000,
       0.00000000e+000, 0.00000000e+000, 0.00000000e+000, 0.00000000e+000,
       0.00000000e+000, 0.00000000e+000, 0.00000000e+000, 0.00000000e+000,
       0.00000000e+000, 0.00000000e+000, 0.00000000e+000, 0.00000000e+000,
       0.00000000e+000, 0.00000000e+000, 0.00000000e+000, 0.00000000e+000,
       0.00000000e+000, 0.00000000e+000, 0.00000000e+000, 0.00000000e+000,
       0.00000000e+000, 0.00000000e+000, 0.00000000e+000, 0.00000000e+000,
       0.00000000e+000, 0.00000000e+000, 0.00000000e+000, 0.00000000e+000,
       0.00000000e+000, 0.00000000e+000, 0.00000000e+000, 0.00000000e+000,
       0.00000000e+000, 0.00000000e+000, 0.00000000e+000, 0.00000000e+000,
       0.00000000e+000, 0.00000000e+000, 0.00000000e+000, 0.00000000e+000,
       0.00000000e+000, 0.00000000e+000, 0.00000000e+000, 0.00000000e+000,
       0.00000000e+000, 0.00000000e+000, 0.00000000e+000, 0.00000000e+000,
       0.00000000e+000, 0.00000000e+000, 0.00000000e+000, 0.00000000e+000,
       0.00000000e+000, 0.00000000e+000, 0.00000000e+000, 0.00000000e+000,
       0.00000000e+000, 0.00000000e+000, 0.00000000e+000, 0.00000000e+000,
       0.00000000e+000, 0.00000000e+000, 0.00000000e+000, 0.00000000e+000,
       0.00000000e+000, 0.00000000e+000, 0.00000000e+000, 0.00000000e+000,
       0.00000000e+000, 0.00000000e+000, 0.00000000e+000, 0.00000000e+000,
       0.00000000e+000, 0.00000000e+000, 0.00000000e+000, 0.00000000e+000,
       0.00000000e+000, 0.00000000e+000, 0.00000000e+000, 0.00000000e+000,
       0.00000000e+000, 0.00000000e+000, 0.00000000e+000, 0.00000000e+000,
       0.00000000e+000, 0.00000000e+000, 0.00000000e+000, 0.00000000e+000,
       0.00000000e+000, 0.00000000e+000, 0.00000000e+000, 0.00000000e+000,
       0.00000000e+000, 0.00000000e+000, 0.00000000e+000, 0.00000000e+000,
       0.00000000e+000, 0.00000000e+000, 0.00000000e+000, 0.00000000e+000,
       0.00000000e+000, 0.00000000e+000, 0.00000000e+000, 0.00000000e+000,
       0.00000000e+000, 0.00000000e+000, 0.00000000e+000, 0.00000000e+000])

In [85]:
#plt.loglog(hmfCalcCrocce.m, hmfCalcCrocce.dndlog10m)
plt.loglog(hmfCalcCrocce.m, hmfCalcCrocce.dndlnm* (h.cosmo_model.h)**3)
plt.loglog(hmfCalcCrocce.m, hmfCalcCrocce.dndlog10m* (h.cosmo_model.h)**3/ np.log(10))
plt.loglog(M, colossusCrocce * (h.cosmo_model.h)**3, '--')


Out[85]:
[<matplotlib.lines.Line2D at 0x10d5c0518>]

In [48]:
plt.plot(M, colossusCrocce / hmfCalcCrocce.dndlnm -1)
plt.plot(M, colossusCrocce / hmfCalcCrocce.dndlog10m *np.log(10) -1, '--')


Out[48]:
[<matplotlib.lines.Line2D at 0x10bb22a20>]

In [27]:
hmfCalcCrocce.dndlnm


Out[27]:
array([], dtype=float64)

In [76]:
hmf=[]        
print('Use Depsali+16 HMF in Planck15 cosmo from Colossus module')
mdef = '200m'
print('Use '+mdef+' for the SO defintion.')
cosmo = cosmology.setCosmology('planck15')
redshift_haloes = redshiftsbin
M = 10**np.arange(8.0, 15.5, 0.01) # Mass in Msun / h
for i in range(numzbin):
    hmf.append(
        np.transpose(
            np.array(
                [np.log10(M / cosmo.h), 
                 np.log10(mass_function.massFunction(
                        M, redshift_haloes[i], mdef = mdef, model ='tinker08', q_out = 'dndlnM'
                    ) * np.log(10) * cosmo.h**3  
                    ## Mass functions are in h^3 Mpc^-3, and need to multiply by ln(10) to have dndlog10m
                    )]
                )
            )
        )


Use Depsali+16 HMF in Planck15 cosmo from Colossus module
Use 200m for the SO defintion.

In [77]:
plt.plot(hmf[0][:,0], hmf[0][:,1])
plt.plot(hmft[0][:,0], hmft[0][:,1])


Out[77]:
[<matplotlib.lines.Line2D at 0x10cebb2b0>]

In [79]:
plt.plot(hmf[0][:,0], hmf[0][:,1] - hmft[0][:,1])


Out[79]:
[<matplotlib.lines.Line2D at 0x10d0b07b8>]

In [75]:
hmf[0][:,0].shape


Out[75]:
(750,)

In [ ]: