From 64d24855c88dd8cf99bfd034d77a9068c8621821 Mon Sep 17 00:00:00 2001 From: Steven Murray Date: Mon, 15 Apr 2024 11:20:14 +0200 Subject: [PATCH] fix: behroozi bugs --- CHANGELOG.rst | 7 +++++++ src/hmf/mass_function/fitting_functions.py | 7 ++++++- src/hmf/mass_function/hmf.py | 6 +++++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 5819662..055e0f5 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -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] ---------------------- diff --git a/src/hmf/mass_function/fitting_functions.py b/src/hmf/mass_function/fitting_functions.py index 5542815..6b260f8 100644 --- a/src/hmf/mass_function/fitting_functions.py +++ b/src/hmf/mass_function/fitting_functions.py @@ -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]_. @@ -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 diff --git a/src/hmf/mass_function/hmf.py b/src/hmf/mass_function/hmf.py index 4342f22..3184b08 100755 --- a/src/hmf/mass_function/hmf.py +++ b/src/hmf/mass_function/hmf.py @@ -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( + self.m * self.cosmo.h, dndm, self.z, ngtm_tinker + ) # Alter the mass definition if (