Commit 7b73f41d authored by Médéric Boquien's avatar Médéric Boquien

Normalise the SFH appropriately in the same if then else statement. Bonus is...

Normalise the SFH appropriately in the same if then else statement. Bonus is that is saves an array multiplication if a specific scaling factor is not given.
parent 1e8e641e
......@@ -89,7 +89,7 @@ class Sfh2Exp(CreationModule):
age = np.max(time_grid)
# Main exponential
sfr = sfr_0 * np.exp(-time_grid / tau_main)
sfr = np.exp(-time_grid / tau_main)
# Height of the late burst to have the desired produced mass fraction
# (assuming that the main burst as a height of 1).
......@@ -109,6 +109,9 @@ class Sfh2Exp(CreationModule):
if normalise:
sfr = sfr / galaxy_mass
galaxy_mass = 1.
else:
sfr *= sfr_0
galaxy_mass *= sfr_0
sed.add_module(self.name, self.parameters)
......
......@@ -81,7 +81,7 @@ class SfhQuench(CreationModule):
galaxy_mass = np.trapz(sfr, time) * 1e6
if normalise:
sfr = sfr / galaxy_mass
galaxy_mass = 1
galaxy_mass = 1.
sed.sfh = (time, sfr)
sed.add_info("galaxy_mass", galaxy_mass, True, force=True)
......
......@@ -70,7 +70,7 @@ class SFHDelayed(CreationModule):
time_grid = np.arange(AGE_LAPSE, age + AGE_LAPSE, AGE_LAPSE)
# Main SFR
sfr = sfr_A * time_grid / tau_main**2 * np.exp(-time_grid / tau_main)
sfr = time_grid / tau_main**2 * np.exp(-time_grid / tau_main)
# Compute the galaxy mass and normalise the SFH to 1 solar mass
# produced if asked to.
......@@ -78,6 +78,9 @@ class SFHDelayed(CreationModule):
if normalise:
sfr = sfr / galaxy_mass
galaxy_mass = 1.
else:
sfr *= sfr_A
galaxy_mass *= sfr_A
sed.add_module(self.name, self.parameters)
......
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