Skip to content

Commit ebe52d3

Browse files
authored
Update BHMF in components.py
The mbh_mass_func did not handle scatter appropriately and is now depricated. This function is replaced with mbh_mass_func_conv, which performs a convolution between the GSMF and MMBulge relation and is far more accurate. It still underestimates number density for the highest masses, but this is negligible for scatter_dex > 0.2
1 parent 8a044b6 commit ebe52d3

File tree

1 file changed

+50
-1
lines changed

1 file changed

+50
-1
lines changed

holodeck/sams/components.py

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,11 @@ def __call__(self, mstar, redz):
6565
return
6666

6767
def mbh_mass_func(self, mbh, redz, mmbulge, scatter=None):
68-
"""Convert from the GSMF to a MBH mass function (number density), using a given Mbh-Mbulge relation.
68+
"""
69+
!!!!! DEPRICATED: use mbh_mass_func_conv instead !!!!!
70+
This function is faster, but less accurate than mbh_mass_func_conv, scatter is not handled effectively.
71+
72+
Convert from the GSMF to a MBH mass function (number density), using a given Mbh-Mbulge relation.
6973
7074
Parameters
7175
----------
@@ -87,6 +91,7 @@ def mbh_mass_func(self, mbh, redz, mmbulge, scatter=None):
8791
Number density of MBHs, in units of [Mpc^-3]
8892
8993
"""
94+
print('WARNING: mbh_mass_func is deprecated. Use mbh_mass_func_conv instead.')
9095
if scatter in [None, True]:
9196
scatter = mmbulge._scatter_dex
9297

@@ -106,6 +111,50 @@ def mbh_mass_func(self, mbh, redz, mmbulge, scatter=None):
106111

107112
return ndens
108113

114+
def mbh_mass_func_conv(self, mbh, redz, mmbulge, scatter=None):
115+
"""Convert from the GSMF to a MBH mass function (number density), using a given Mbh-Mbulge relation.
116+
This version convolves the GSMF with the Mbh-Mbulge relation including scatter.
117+
This will very minorly underestimate the number density at the high-mass end, but this is negligible for scatter_dex > 0.2
118+
119+
Parameters
120+
----------
121+
mbh : array_like
122+
Blackhole masses at which to evaluate the mass function.
123+
redz : array_like
124+
Redshift(s) at which to evaluate the mass function.
125+
mmbulge : `relations._MMBulge_Relation` subclass instance
126+
Scaling relation between galaxy and MBH masses.
127+
scatter : None, bool, or float
128+
Introduce scatter in masses.
129+
* `None` or `True` : use the value from `mmbulge._scatter_dex`
130+
* `False` : do not introduce scatter
131+
* float : introduce scatter with this amplitude (in dex)
132+
133+
Returns
134+
-------
135+
ndens : array_like
136+
Number density of MBHs, in units of [Mpc^-3]
137+
138+
"""
139+
if scatter in [None, True]:
140+
scatter = np.log10(10**mmbulge._scatter_dex * (1.0 + redz)**mmbulge._zplaw_scatter)
141+
142+
mstar = mmbulge.mstar_from_mbh(mbh, redz=redz, scatter=False)
143+
# This is `dn_star / dlog10(M_star)`
144+
ndens = self(mstar, redz) # units of [1/Mpc^3]
145+
146+
mstar_log10 = np.log10(mstar/MSOL)
147+
mbh_log10 = np.log10(mbh/MSOL)
148+
149+
bhmf_conv = np.zeros_like(mbh_log10)
150+
151+
for i, logMbh in enumerate(mbh_log10):
152+
logMbh_mean = mmbulge._mamp_log10 + mmbulge._mplaw * (mstar_log10 - 11.0)
153+
pdf = stnorm.pdf(logMbh, loc=logMbh_mean, scale=scatter)
154+
bhmf_conv[i] = np.trapz(ndens * pdf, mstar_log10)
155+
156+
return bhmf_conv
157+
109158

110159
class GSMF_Schechter(_Galaxy_Stellar_Mass_Function):
111160
r"""Single Schechter Function - Galaxy Stellar Mass Function.

0 commit comments

Comments
 (0)