[galaxy] sfr averaged only after star formation starts

This commit is contained in:
Noe Brucy
2021-06-09 15:03:09 +02:00
parent b36ffd956a
commit 9cc1396ca5
+1 -2
View File
@@ -81,9 +81,8 @@ def get_sfr(pp, stars):
mass = stars["mass"].copy()
mass *= pp.info["unit_mass"].express(U.Msun)
mask = epoch > 0
t_tot = np.max(epoch[mask]) - np.min(epoch[mask])
masstot, time = np.histogram(
epoch[mask], weights=mass[mask], bins=int(t_tot / 100)
epoch[mask], weights=mass[mask], bins=200
)
dtime = np.diff(time)
sfr = masstot[-1] / dtime[-1]