From 9cc1396ca5db5276a5548f12a8db5accfae6f011 Mon Sep 17 00:00:00 2001 From: Noe Brucy Date: Wed, 9 Jun 2021 15:03:09 +0200 Subject: [PATCH] [galaxy] sfr averaged only after star formation starts --- galaxy.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/galaxy.py b/galaxy.py index 52d2c56..40202fb 100644 --- a/galaxy.py +++ b/galaxy.py @@ -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]