Commit 50c19642 authored by Yannick Roehlly's avatar Yannick Roehlly

Correct galaxy_mass computation.

The "galaxy_mass" parameter must not be set to 1.0 in the stellar
emission modules because when using CIGALE to generate SED without
normalising the 1.0 is wrong and misleading.

Instead, we compute the real galaxy mass (the integration of the SFH) in
the star formation history modules.
parent cd2ead65
......@@ -132,8 +132,6 @@ class BC03(CreationModule):
young_info["m_gas"] + old_info["m_gas"],
True)
sed.add_info("galaxy_mass", 1., True)
sed.add_contribution("stellar.old", old_wave, old_lumin)
sed.add_contribution("stellar.young", young_wave, young_lumin)
......
......@@ -163,8 +163,6 @@ class M2005(CreationModule):
sed.add_info('stellar.mass_black_hole',
old_masses[4] + young_masses[4], True)
sed.add_info("galaxy_mass", 1., True)
sed.add_contribution("ssp_old",
ssp.wavelength_grid,
old_spectrum)
......
......@@ -113,14 +113,18 @@ class Sfh2Exp(CreationModule):
sfr[mask] = sfr[mask] + burst_height * np.exp(
(-time_grid[mask] + age - burst_age) / tau_burst)
# Normalise the SFH to 1 solar mass produced if asked to.
# Compute the galaxy mass and normalise the SFH to 1 solar mass
# produced if asked to.
galaxy_mass = np.trapz(sfr * 1e6, time_grid)
if normalise:
sfr = sfr / np.trapz(sfr * 1e6, time_grid)
sfr = sfr / galaxy_mass
galaxy_mass = 1.
sed.add_module(self.name, self.parameters)
# Add the sfh and the output parameters to the SED.
sed.sfh = (time_grid, sfr)
sed.add_info("galaxy_mass", galaxy_mass, True)
sed.add_info("sfh.tau_main", tau_main)
sed.add_info("sfh.tau_burst", tau_burst)
sed.add_info("sfh.f_burst", f_burst)
......
......@@ -79,14 +79,18 @@ class SFHDelayed(CreationModule):
# Main SFR
sfr = sfr_A * time_grid / tau_main**2 * np.exp(-time_grid / tau_main)
# Normalise the SFH to 1 solar mass produced if asked to.
# Compute the galaxy mass and normalise the SFH to 1 solar mass
# produced if asked to.
galaxy_mass = np.trapz(sfr * 1e6, time_grid)
if normalise:
sfr = sfr / np.trapz(sfr * 1e6, time_grid)
sfr = sfr / galaxy_mass
galaxy_mass = 1.
sed.add_module(self.name, self.parameters)
# Add the sfh and the output parameters to the SED.
sed.sfh = (time_grid, sfr)
sed.add_info("galaxy_mass", galaxy_mass, True)
sed.add_info("sfh.tau_main", tau_main)
# CreationModule to be returned by get_module
......
......@@ -80,12 +80,16 @@ class SfhFromFile(CreationModule):
sfr = sfr[time_grid <= age]
time_grid = time_grid[time_grid <= age]
# Normalise the SFH to 1 solar mass produced if asked to.
# Compute the galaxy mass and normalise the SFH to 1 solar mass
# produced if asked to.
galaxy_mass = np.trapz(sfr * 1e6, time_grid)
if normalise:
sfr = sfr / np.trapz(sfr * 1e6, time_grid)
sfr = sfr / galaxy_mass
galaxy_mass = 1.
sed.add_module(self.name, self.parameters)
sed.sfh = (time_grid, sfr)
sed.add_info("galaxy_mass", galaxy_mass, True)
sed.add_info("sfh.id", sfr_column_number+1)
# CreationModule to be returned by get_module
......
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