Commit 077253d2 authored by Médéric Boquien's avatar Médéric Boquien
Browse files

If there is no redshift information, we assumed that the redshift is 0. Also...

If there is no redshift information, we assumed that the redshift is 0. Also correct a bogus test in the redshifting module.
parent 3a44b65a
......@@ -54,7 +54,7 @@ class Redshifting(CreationModule):
"""
# If the SED is already redshifted, raise an error.
if 'redshift' in sed.info.keys() > 0:
if 'redshift' in sed.info.keys() and sed.info['redshift'] > 0.:
raise Exception("The SED is already redshifted <z={}>."
.format(sed.info['redshift']))
......
......@@ -382,12 +382,17 @@ class SED(object):
transmission_r = np.interp(wavelength_r, transmission[0],
transmission[1])
if 'redshift' in self.info.keys():
redshift = self.info['redshift']
else:
redshift = 0.
# TODO: Can we avoid to normalise as the filter transmission is
# already normalised?
f_lambda = utils.luminosity_to_flux(
(np.trapz(transmission_r * l_lambda_r, wavelength_r) /
np.trapz(transmission_r, wavelength_r)),
self.info['redshift']
redshift
)
# Add the Fλ fluxes from the spectral lines.
......
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