Commit 1ab7051a authored by Médéric Boquien's avatar Médéric Boquien

Use in-place assignment to avoid an unnecessary copy of the array.

parent 1c774339
......@@ -162,10 +162,9 @@ def a_vs_ebv(wavelength, bump_wave, bump_width, bump_ampl, power_slope):
mask = (attenuation < 0)
attenuation[mask] = 0
# Power law
attenuation = attenuation * power_law(wavelength, power_slope)
attenuation *= power_law(wavelength, power_slope)
# UV bump
attenuation = attenuation + uv_bump(wavelength, bump_wave,
bump_width, bump_ampl)
attenuation += uv_bump(wavelength, bump_wave, bump_width, bump_ampl)
return attenuation
......
......@@ -90,8 +90,7 @@ def alambda_av(wavelength, delta, bump_wave, bump_width, bump_ampl):
wave = np.array(wavelength)
attenuation = power_law(wave, delta)
attenuation = attenuation + uv_bump(wavelength, bump_wave,
bump_width, bump_ampl)
attenuation += uv_bump(wavelength, bump_wave, bump_width, bump_ampl)
return attenuation
......
......@@ -110,7 +110,7 @@ class Sfh2Exp(CreationModule):
# produced if asked to.
galaxy_mass = np.trapz(sfr, time_grid) * 1e6
if normalise:
sfr = sfr / galaxy_mass
sfr /= galaxy_mass
galaxy_mass = 1.
else:
sfr *= sfr_0
......
......@@ -96,7 +96,7 @@ class SfhBuat08(CreationModule):
# produced if asked to.
galaxy_mass = np.trapz(sfr, time_grid) * 1e6
if normalise:
sfr = sfr / galaxy_mass
sfr /= galaxy_mass
galaxy_mass = 1.
sed.add_module(self.name, self.parameters)
......
......@@ -83,7 +83,7 @@ class SfhQuench(CreationModule):
# produced if asked to.
galaxy_mass = np.trapz(sfr, time) * 1e6
if normalise:
sfr = sfr / galaxy_mass
sfr /= galaxy_mass
galaxy_mass = 1.
sed.sfh = (time, sfr)
......
......@@ -79,7 +79,7 @@ class SFHDelayed(CreationModule):
# produced if asked to.
galaxy_mass = np.trapz(sfr, time_grid) * 1e6
if normalise:
sfr = sfr / galaxy_mass
sfr /= galaxy_mass
galaxy_mass = 1.
else:
sfr *= sfr_A
......
......@@ -85,7 +85,7 @@ class SfhFromFile(CreationModule):
# produced if asked to.
galaxy_mass = np.trapz(sfr, time_grid) * 1e6
if normalise:
sfr = sfr / galaxy_mass
sfr /= galaxy_mass
galaxy_mass = 1.
sed.add_module(self.name, self.parameters)
......
......@@ -98,7 +98,7 @@ class SfhPeriodic(CreationModule):
# produced if asked to.
self.galaxy_mass = np.trapz(self.sfr, self.time_grid) * 1e6
if normalise:
self.sfr = self.sfr / self.galaxy_mass
self.sfr /= self.galaxy_mass
self.galaxy_mass = 1.
else:
self.sfr *= sfr_A
......
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