diff --git a/galaxy.py b/galaxy.py index c36b9a1..52d2c56 100644 --- a/galaxy.py +++ b/galaxy.py @@ -80,7 +80,11 @@ def get_sfr(pp, stars): epoch *= pp.info["unit_time"].express(U.year) mass = stars["mass"].copy() mass *= pp.info["unit_mass"].express(U.Msun) - masstot, time = np.histogram(epoch, weights=mass, bins=100) + 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) + ) dtime = np.diff(time) sfr = masstot[-1] / dtime[-1] except KeyError: @@ -95,7 +99,6 @@ def get_coldens(pp): pp.coldens("z") pp.coldens_map = pp.get_value("/maps/coldens_z", unit=U.coldens) - im_extent = np.array(pp.get_attribute("/maps", "im_extent")) im_extent *= pp.info["unit_length"].express(U.kpc) map_size = pp.pp_params.pymses.map_size @@ -179,7 +182,6 @@ def ring_analysis(pp, r=4, dr=0.5, dphi=0.125, z=0, dz=0.5): return res - def get_time_from_relax(pp): try: epoch = pp.parts["epoch"].copy()