Commit 1e8e641e authored by Médéric Boquien's avatar Médéric Boquien
Browse files

When computing the galaxy mass, convert from yr to Myr outside of the...

When computing the galaxy mass, convert from yr to Myr outside of the integral. That way we only multiply a scalar by 1e6 rather than a large array. Good for speed and memory bandwidth.
parent 1bd19598
......@@ -105,7 +105,7 @@ class Sfh2Exp(CreationModule):
# Compute the galaxy mass and normalise the SFH to 1 solar mass
# produced if asked to.
galaxy_mass = np.trapz(sfr * 1e6, time_grid)
galaxy_mass = np.trapz(sfr, time_grid) * 1e6
if normalise:
sfr = sfr / galaxy_mass
galaxy_mass = 1.
......
......@@ -91,7 +91,7 @@ class SfhBuat08(CreationModule):
# Compute the galaxy mass and normalise the SFH to 1 solar mass
# produced if asked to.
galaxy_mass = np.trapz(sfr * 1e6, time_grid)
galaxy_mass = np.trapz(sfr, time_grid) * 1e6
if normalise:
sfr = sfr / galaxy_mass
galaxy_mass = 1.
......
......@@ -78,7 +78,7 @@ class SfhQuench(CreationModule):
# Compute the galaxy mass and normalise the SFH to 1 solar mass
# produced if asked to.
galaxy_mass = np.trapz(sfr * 1e6, time)
galaxy_mass = np.trapz(sfr, time) * 1e6
if normalise:
sfr = sfr / galaxy_mass
galaxy_mass = 1
......
......@@ -96,7 +96,7 @@ class SfhComb(CreationModule):
# Compute the galaxy mass and normalise the SFH to 1 solar mass
# produced if asked to.
galaxy_mass = np.trapz(sfr * 1e6, time_grid)
galaxy_mass = np.trapz(sfr, time_grid) * 1e6
if normalise:
sfr = sfr / galaxy_mass
galaxy_mass = 1.
......
......@@ -99,7 +99,7 @@ class SfhComb(CreationModule):
# Compute the galaxy mass and normalise the SFH to 1 solar mass
# produced if asked to.
galaxy_mass = np.trapz(sfr * 1e6, time_grid)
galaxy_mass = np.trapz(sfr, time_grid) * 1e6
if normalise:
sfr = sfr / galaxy_mass
galaxy_mass = 1.
......
......@@ -74,7 +74,7 @@ class SFHDelayed(CreationModule):
# Compute the galaxy mass and normalise the SFH to 1 solar mass
# produced if asked to.
galaxy_mass = np.trapz(sfr * 1e6, time_grid)
galaxy_mass = np.trapz(sfr, time_grid) * 1e6
if normalise:
sfr = sfr / galaxy_mass
galaxy_mass = 1.
......
......@@ -82,7 +82,7 @@ class SfhFromFile(CreationModule):
# Compute the galaxy mass and normalise the SFH to 1 solar mass
# produced if asked to.
galaxy_mass = np.trapz(sfr * 1e6, time_grid)
galaxy_mass = np.trapz(sfr, time_grid) * 1e6
if normalise:
sfr = sfr / galaxy_mass
galaxy_mass = 1.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment