Commit e48a3853 authored by Médéric Boquien's avatar Médéric Boquien

With the previous commit a relatively large fraction of the time is spent...

With the previous commit a relatively large fraction of the time is spent integrating the attenuated spectrum. Let's use a faster way to compute the integral
parent 2e96a710
......@@ -284,7 +284,9 @@ class CalzLeit(SedModule):
attenuation_spectrum = luminosity * (self.curve[age] - 1.)
# We integrate the amount of luminosity attenuated (-1 because the
# spectrum is negative).
attenuation = -1. * np.trapz(attenuation_spectrum, wavelength)
attenuation = -.5 * np.dot(np.diff(wavelength),
attenuation_spectrum[1:] +
attenuation_spectrum[:-1])
attenuation_total += attenuation
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