def stellar_mass(self, mass_min=0.1, steps=10000):
"""
Compute the stellar mass (Msun; average per star). PDF comes
from IMF, but weight by actual stellar mass.
Parameters:
-----------
mass_min : Minimum mass to integrate the IMF
steps : Number of steps to sample the isochrone
Returns:
--------
mass : Stellar mass [Msun]
"""
mass_max = self.mass_init_upper_bound
d_log_mass = (np.log10(mass_max) - np.log10(mass_min)) / float(steps)
log_mass = np.linspace(np.log10(mass_min), np.log10(mass_max), steps)
mass = 10.**log_mass
if mass_min < np.min(self.mass_init):
mass_act_interpolation = scipy.interpolate.interp1d(np.insert(self.mass_init, 0, mass_min),
np.insert(self.mass_act, 0, mass_min))
else:
mass_act_interpolation = scipy.interpolate.interp1d(self.mass_init, self.mass_act)
mass_act = mass_act_interpolation(mass)
return np.sum(mass_act * d_log_mass * self.imf.pdf(mass, log_mode=True))
评论列表
文章目录