-
Notifications
You must be signed in to change notification settings - Fork 36
Open
Labels
type: bugSomething isn't workingSomething isn't working
Description
Describe the bug
Currently, growth_rate() in the growth model GrowthFactor implements the linear growth rate CAMB and the growth model CambGrowth.
My suggestion, if I may, and I can make a PR for this, is to either a/ use Hamilton (2001) eq. 5 instead, or b/ simply
To Reproduce
Code snippet reproduce the behavior:
import matplotlib.pyplot as plt
%matplotlib inline
from hmf import MassFunction,Transfer
transfer_CambGrowth=Transfer(z=0.0, lnk_min=-18.420680743952367, lnk_max=9.903487552536127, dlnk=0.05, transfer_model='CAMB', transfer_params=None, takahashi=True, growth_model='CambGrowth', growth_params=None, use_splined_growth=True)
transfer_GrowthFactor=Transfer(z=0.0, lnk_min=-18.420680743952367, lnk_max=9.903487552536127, dlnk=0.05, transfer_model='CAMB', transfer_params=None, takahashi=True, growth_model='GrowthFactor', growth_params=None, use_splined_growth=True)
z=np.linspace(0.,100.,256)
a=1./(1.+z)
D_CambGrowth=transfer_CambGrowth.growth.growth_factor(z)
f_CambGrowth=np.gradient(np.log(D_CambGrowth),np.log(a))
f_GrowthFactor=transfer_GrowthFactor.growth.growth_rate(z)
fig, ax = plt.subplots(2, sharex=True, sharey=False, gridspec_kw={'hspace': 0., 'wspace':0., 'height_ratios':[8, 2]}, figsize=(6.4, 4.8))
ax[0].semilogx(a,f_GrowthFactor,c='b',ls='-',label=r'GrowthFactor, Hamilton Eq. (4)')
ax[0].semilogx(a,f_CambGrowth,c='r',ls='--',label=r'CambGrowth')
ax[0].legend(frameon=False)
ax[0].set_ylabel(r'$f(a)$')
#ax[0].set_ylim(0.65,1.)
ax[1].semilogx(a,f_GrowthFactor/f_CambGrowth)
ax[1].set_ylabel(r'$f_{\mathrm{GF}}/f_{\mathrm{CG}}$')
ax[1].set_xlabel(r'$a$')
Expected behavior
This is the comparison between either Hamilton eq. 4 or eq. 5, against the CAMB numerical derivative
Additional context
This is related to, but not the same issue, #196.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
type: bugSomething isn't workingSomething isn't working

