halomod / hmf

Python halo mass function calculator
Other
69 stars 34 forks source link

[BUG] growth_factor is mixed up between g(a) and D(a) #196

Open MinhMPA opened 1 year ago

MinhMPA commented 1 year ago

Hi,

I have noticed that the method growth_rate() in the class GrowthFactor, which claims to compute the linear growth rate $f$ following Eq. (4) of Hamilton (2001), is actually confusing $g(z)$ and $D(z)$.

In particular, in Eq. (4) of Hamilton (2001), the last term on the r.h.s. is divided by the $g(z)$. In growth_rate(), the return is

return (
            -1
            - self.cosmo.Om(z) / 2
            + self.cosmo.Ode(z)
            + 5 * self.cosmo.Om(z) / (2 * self.growth_factor(z))
        )

with the growth_factor(z) actually returns $D(z)=g(z)/(1.0+z)$ by definition

return self._d_plus(z) / self._d_plus0

I do have further suggestions for these growth_rate() and growth_factor() methods, but I think this could be a quick fix.

steven-murray commented 1 year ago

Thank you @MinhMPA. I'm sorry I don't have a lot of time to look into this right now, but I would certainly be interested in reviewing a PR!

Is this simply a nomenclature problem? That is, the resulting HMF is correct, right? But maybe the naming of the growth factor/rate is incorrect?

MinhMPA commented 1 year ago

@steven-murray Right. I think it only affects the growth rate $f(z)$ not being properly normalized to 1 during early matter-domination era. The halo mass functions should still be fine as they are only concerned about the growth factor $D(z)$, which is correctly computed from integral and then properly normalized to unity at $z=0$.

I can certainly make a PR for this one.