Skip to content

Commit

Permalink
fix: behroozi bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
steven-murray committed Apr 15, 2024
1 parent f1fd037 commit 64d2485
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ Releases
dev-version
----------------------

**Fixes**

* The Behroozi mass function model has been corrected to modify the Tinker08 mass
function, rather than Tinker10, and also fixes a small normalization bug where the
masses were assumed to be Msun/h instead of Msun (which is what the Behroozi paper
assumes).

v3.4.4 [16 Jan 2023]
----------------------

Expand Down
7 changes: 6 additions & 1 deletion src/hmf/mass_function/fitting_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1543,7 +1543,7 @@ def cutmask(self):
)


class Behroozi(Tinker10):
class Behroozi(Tinker08):
_ref = r"""Behroozi, P., Weschler, R. and Conroy, C., ApJ, 2013, http://arxiv.org/abs/1207.6105"""
__doc__ = r"""
Behroozi mass function fit [1]_.
Expand Down Expand Up @@ -1586,6 +1586,11 @@ class Behroozi(Tinker10):
)

def _modify_dndm(self, m, dndm, z, ngtm_tinker):
"""
Apply modifications to dndm in Appendix G of Behroozi+13.
Note that the mass here is assumed to be in Msun, NOT Msun/h.
"""
a = 1 / (1 + z)
theta = (
0.144
Expand Down
6 changes: 5 additions & 1 deletion src/hmf/mass_function/hmf.py
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,11 @@ def dndm(self):
dndm = self.fsigma * self.mean_density0 * np.abs(self._dlnsdlnm) / self.m**2
if isinstance(self.hmf, ff.Behroozi):
ngtm_tinker = self._gtm(dndm)
dndm = self.hmf._modify_dndm(self.m, dndm, self.z, ngtm_tinker)

# THe Behroozi paper corrections assume masses in Msun, not Msun/h
dndm = self.hmf._modify_dndm(

Check warning on line 468 in src/hmf/mass_function/hmf.py

View check run for this annotation

Codecov / codecov/patch

src/hmf/mass_function/hmf.py#L468

Added line #L468 was not covered by tests
self.m * self.cosmo.h, dndm, self.z, ngtm_tinker
)

# Alter the mass definition
if (
Expand Down

0 comments on commit 64d2485

Please sign in to comment.