Commit 604a16d9 authored by Médéric Boquien's avatar Médéric Boquien
Browse files

Prefix the redshift.

parent 35a2c015
......@@ -182,7 +182,7 @@ def sed(idx):
model_variables = np.array([sed.info[name]
for name in gbl_analysed_variables])
gbl_model_redshifts[idx] = sed.info['redshift']
gbl_model_redshifts[idx] = sed.info['universe.redshift']
gbl_model_fluxes[idx, :] = model_fluxes
gbl_model_variables[idx, :] = model_variables
......
......@@ -50,7 +50,7 @@ class Param(CreationModule):
# this module must be the last one. Note that it does require
# an SFH and an SSP module but nothing else (except redshifting)
redshift = sed.info['redshift']
redshift = sed.info['universe.redshift']
# Wavelengths are in nanometers.
wavelength = sed.wavelength_grid
# Luminosity is is W/nm.
......
......@@ -177,9 +177,10 @@ class Redshifting(CreationModule):
redshift = self.redshift
# If the SED is already redshifted, raise an error.
if 'redshift' in sed.info and sed.info['redshift'] > 0.:
if ('universe.redshift' in sed.info and
sed.info['universe.redshift'] > 0.):
raise Exception("The SED is already redshifted <z={}>."
.format(sed.info['redshift']))
.format(sed.info['universe.redshift']))
# Raise an error when applying a negative redshift. This module is
# not for blue-shifting.
......@@ -195,7 +196,7 @@ class Redshifting(CreationModule):
sed.luminosities /= 1. + redshift
sed.luminosity /= 1. + redshift
sed.add_info("redshift", redshift)
sed.add_info("universe.redshift", redshift)
sed.add_info("universe.luminosity_distance", self.luminosity_distance)
sed.add_info("universe.age", self.universe_age)
......
......@@ -280,8 +280,9 @@ class SED(object):
# avoid having the resample the filter every time on the optimal grid
# (spectrum+filter), we store the resampled filter. That way we only
# have to resample to spectrum.
if 'redshift' in self.info:
key = (wavelength.size, filter_name, self.info['redshift'])
if 'universe.redshift' in self.info:
key = (wavelength.size, filter_name,
self.info['universe.redshift'])
dist = self.info['universe.luminosity_distance']
else:
key = (wavelength.size, filter_name, 0.)
......
......@@ -77,7 +77,8 @@ def save_sed_to_vo(sed, filename, norm=1.):
# If there is a stellar population then the norm factor is the stellar
# mass.
votable.infos.append(Info(name="Galaxy mass in Msun", value=norm))
votable.infos.append(Info(name="Redshift", value=sed.info['redshift']))
votable.infos.append(Info(name="Redshift",
value=sed.info['universe.redshift']))
for name, value in sed.info.items():
if name in sed.mass_proportional_info:
votable.infos.append(Info(name=name, value=norm * value))
......
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