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

Add the units alongside the physical properties in the output FITS tables.

parent 1415d6f7
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
- Saving the χ² is now a bit more fine-grained. It is possible to save none, all, only the properties, or only the fluxes. (Médéric Boquien) - Saving the χ² is now a bit more fine-grained. It is possible to save none, all, only the properties, or only the fluxes. (Médéric Boquien)
- The database now includes the JWST MIRI and NIRCam filters. (Médéric Boquien) - The database now includes the JWST MIRI and NIRCam filters. (Médéric Boquien)
- The SKIRTOR AGN models (Stalevski et al. 2016) have been implemented as the `skirtor2016` module. (Médéric Boquien, with the support of Marko Stalevski) - The SKIRTOR AGN models (Stalevski et al. 2016) have been implemented as the `skirtor2016` module. (Médéric Boquien, with the support of Marko Stalevski)
- The units are now given alongside the physical properties in the output FITS tables. (Médéric Boquien)
### Changed ### Changed
- Python 3.6 is now the minimum required version. (Médéric Boquien) - Python 3.6 is now the minimum required version. (Médéric Boquien)
- The `pcigale-plots` executable has been largely rewritten for better modularity and to enable the various improvements indicated below. (Rodrigo González Castillo & Médéric Boquien) - The `pcigale-plots` executable has been largely rewritten for better modularity and to enable the various improvements indicated below. (Rodrigo González Castillo & Médéric Boquien)
......
...@@ -12,6 +12,7 @@ of the models. ...@@ -12,6 +12,7 @@ of the models.
import ctypes import ctypes
from astropy.table import Table, Column from astropy.table import Table, Column
from astropy.units import Unit
from .utils import SharedArray, get_info from .utils import SharedArray, get_info
...@@ -30,7 +31,7 @@ class ModelsManager(object): ...@@ -30,7 +31,7 @@ class ModelsManager(object):
self.params = params self.params = params
self.block = params.blocks[iblock] self.block = params.blocks[iblock]
self.iblock = iblock self.iblock = iblock
self.allpropnames, self.allextpropnames = get_info(self) self.allpropnames, self.unit, self.allextpropnames = get_info(self)
self.allintpropnames = set(self.allpropnames) - self.allextpropnames self.allintpropnames = set(self.allpropnames) - self.allextpropnames
props_nolog = set([prop[:-4] if prop.endswith('log') else prop props_nolog = set([prop[:-4] if prop.endswith('log') else prop
...@@ -71,11 +72,13 @@ class ModelsManager(object): ...@@ -71,11 +72,13 @@ class ModelsManager(object):
else: else:
unit = 'mJy' unit = 'mJy'
table.add_column(Column(self.flux[band], name=band, table.add_column(Column(self.flux[band], name=band,
unit=unit)) unit=Unit(unit)))
for prop in sorted(self.extprop.keys()): for prop in sorted(self.extprop.keys()):
table.add_column(Column(self.extprop[prop], name=prop)) table.add_column(Column(self.extprop[prop], name=prop,
unit=Unit(self.unit[prop])))
for prop in sorted(self.intprop.keys()): for prop in sorted(self.intprop.keys()):
table.add_column(Column(self.intprop[prop], name=prop)) table.add_column(Column(self.intprop[prop], name=prop,
unit=Unit(self.unit[prop])))
table.write(f"out/{filename}.fits") table.write(f"out/{filename}.fits")
table.write(f"out/{filename}.txt", format='ascii.fixed_width', table.write(f"out/{filename}.txt", format='ascii.fixed_width',
......
...@@ -40,7 +40,7 @@ class ObservationsManagerPassbands(object): ...@@ -40,7 +40,7 @@ class ObservationsManagerPassbands(object):
self.conf = config self.conf = config
self.params = params self.params = params
self.allpropertiesnames, self.massproportional = get_info(self) self.allpropertiesnames, _, self.massproportional = get_info(self)
self.table = read_table(config['data_file']) self.table = read_table(config['data_file'])
self.bands = [band for band in config['bands'] self.bands = [band for band in config['bands']
if not band.endswith('_err')] if not band.endswith('_err')]
......
...@@ -13,6 +13,7 @@ results of the analysis with different blocks of models. ...@@ -13,6 +13,7 @@ results of the analysis with different blocks of models.
import ctypes import ctypes
from astropy.table import Table, Column from astropy.table import Table, Column
from astropy.units import Unit
import numpy as np import numpy as np
from .utils import SharedArray from .utils import SharedArray
...@@ -339,6 +340,7 @@ class ResultsManager(object): ...@@ -339,6 +340,7 @@ class ResultsManager(object):
self.conf = models.conf self.conf = models.conf
self.obs = models.obs self.obs = models.obs
self.params = models.params self.params = models.params
self.unit = models.unit
self.bayes = BayesResultsManager(models) self.bayes = BayesResultsManager(models)
self.best = BestResultsManager(models) self.best = BestResultsManager(models)
...@@ -378,19 +380,24 @@ class ResultsManager(object): ...@@ -378,19 +380,24 @@ class ResultsManager(object):
for prop in sorted(self.bayes.intmean): for prop in sorted(self.bayes.intmean):
table.add_column(Column(self.bayes.intmean[prop], table.add_column(Column(self.bayes.intmean[prop],
name="bayes."+prop)) name="bayes."+prop,
unit=Unit(self.unit[prop])))
table.add_column(Column(self.bayes.interror[prop], table.add_column(Column(self.bayes.interror[prop],
name="bayes."+prop+"_err")) name="bayes."+prop+"_err",
unit=Unit(self.unit[prop])))
for prop in sorted(self.bayes.extmean): for prop in sorted(self.bayes.extmean):
table.add_column(Column(self.bayes.extmean[prop], table.add_column(Column(self.bayes.extmean[prop],
name="bayes."+prop)) name="bayes."+prop,
unit=Unit(self.unit[prop])))
table.add_column(Column(self.bayes.exterror[prop], table.add_column(Column(self.bayes.exterror[prop],
name="bayes."+prop+"_err")) name="bayes."+prop+"_err",
unit=Unit(self.unit[prop])))
for band in sorted(self.bayes.fluxmean): for band in sorted(self.bayes.fluxmean):
table.add_column(Column(self.bayes.fluxmean[band], table.add_column(Column(self.bayes.fluxmean[band],
name="bayes."+band)) name="bayes."+band, unit=Unit('mJy')))
table.add_column(Column(self.bayes.fluxerror[band], table.add_column(Column(self.bayes.fluxerror[band],
name="bayes."+band+"_err")) name="bayes."+band+"_err",
unit=Unit('mJy')))
table.add_column(Column(self.best.chi2, name="best.chi_square")) table.add_column(Column(self.best.chi2, name="best.chi_square"))
obs = [self.obs.table[obs].data for obs in self.obs.tofit] obs = [self.obs.table[obs].data for obs in self.obs.tofit]
...@@ -400,10 +407,12 @@ class ResultsManager(object): ...@@ -400,10 +407,12 @@ class ResultsManager(object):
for prop in sorted(self.best.intprop): for prop in sorted(self.best.intprop):
table.add_column(Column(self.best.intprop[prop], table.add_column(Column(self.best.intprop[prop],
name="best."+prop)) name="best."+prop,
unit=Unit(self.unit[prop])))
for prop in sorted(self.best.extprop): for prop in sorted(self.best.extprop):
table.add_column(Column(self.best.extprop[prop], table.add_column(Column(self.best.extprop[prop],
name="best."+prop)) name="best."+prop,
unit=Unit(self.unit[prop])))
for band in self.obs.bands: for band in self.obs.bands:
if band.startswith('line.') or band.startswith('linefilter.'): if band.startswith('line.') or band.startswith('linefilter.'):
......
...@@ -21,7 +21,7 @@ def get_info(cls): ...@@ -21,7 +21,7 @@ def get_info(cls):
info = list(sed.info.keys()) info = list(sed.info.keys())
info.sort() info.sort()
return (info, sed.mass_proportional_info) return (info, sed.unit, sed.mass_proportional_info)
class SharedArray(object): class SharedArray(object):
......
...@@ -67,6 +67,7 @@ class SED(object): ...@@ -67,6 +67,7 @@ class SED(object):
self.lines = dict() self.lines = dict()
self.info = dict() self.info = dict()
self.mass_proportional_info = set() self.mass_proportional_info = set()
self.unit = dict()
@property @property
def sfh(self): def sfh(self):
...@@ -88,12 +89,14 @@ class SED(object): ...@@ -88,12 +89,14 @@ class SED(object):
if value is not None: if value is not None:
sfh_sfr = value sfh_sfr = value
self._sfh = value self._sfh = value
self.add_info("sfh.sfr", sfh_sfr[-1], True, force=True) self.add_info("sfh.sfr", sfh_sfr[-1], True, force=True,
unit='solMass/yr')
self.add_info("sfh.sfr10Myrs", np.mean(sfh_sfr[-10:]), True, self.add_info("sfh.sfr10Myrs", np.mean(sfh_sfr[-10:]), True,
force=True) force=True, unit='solMass/yr')
self.add_info("sfh.sfr100Myrs", np.mean(sfh_sfr[-100:]), True, self.add_info("sfh.sfr100Myrs", np.mean(sfh_sfr[-100:]), True,
force=True) force=True, unit='solMass/yr')
self.add_info("sfh.age", sfh_sfr.size, False, force=True) self.add_info("sfh.age", sfh_sfr.size, False, force=True,
unit='Myr')
@property @property
def fnu(self): def fnu(self):
...@@ -116,7 +119,8 @@ class SED(object): ...@@ -116,7 +119,8 @@ class SED(object):
return f_nu return f_nu
def add_info(self, key, value, mass_proportional=False, force=False): def add_info(self, key, value, mass_proportional=False, force=False,
unit=''):
""" """
Add a key / value to the information dictionary Add a key / value to the information dictionary
...@@ -141,6 +145,7 @@ class SED(object): ...@@ -141,6 +145,7 @@ class SED(object):
""" """
if (key not in self.info) or force: if (key not in self.info) or force:
self.info[key] = value self.info[key] = value
self.unit[key] = unit
if mass_proportional: if mass_proportional:
self.mass_proportional_info.add(key) self.mass_proportional_info.add(key)
else: else:
...@@ -386,6 +391,7 @@ class SED(object): ...@@ -386,6 +391,7 @@ class SED(object):
sed.contribution_names = self.contribution_names[:] sed.contribution_names = self.contribution_names[:]
sed.lines = self.lines.copy() sed.lines = self.lines.copy()
sed.info = self.info.copy() sed.info = self.info.copy()
sed.unit = self.unit # No need to copy, the units will not change
sed.mass_proportional_info = self.mass_proportional_info.copy() sed.mass_proportional_info = self.mass_proportional_info.copy()
return sed return sed
...@@ -91,26 +91,32 @@ class BC03(SedModule): ...@@ -91,26 +91,32 @@ class BC03(SedModule):
sed.add_info("stellar.imf", self.imf) sed.add_info("stellar.imf", self.imf)
sed.add_info("stellar.metallicity", self.metallicity) sed.add_info("stellar.metallicity", self.metallicity)
sed.add_info("stellar.old_young_separation_age", self.separation_age) sed.add_info("stellar.old_young_separation_age", self.separation_age,
unit='Myr')
sed.add_info("stellar.m_star_young", info_young["m_star"], True)
sed.add_info("stellar.m_gas_young", info_young["m_gas"], True) sed.add_info("stellar.m_star_young", info_young["m_star"], True,
sed.add_info("stellar.n_ly_young", info_young["n_ly"], True) unit='solMass')
sed.add_info("stellar.lum_ly_young", lum_lyc_young, True) sed.add_info("stellar.m_gas_young", info_young["m_gas"], True,
sed.add_info("stellar.lum_young", lum_young, True) unit='solMass')
sed.add_info("stellar.n_ly_young", info_young["n_ly"], True,
sed.add_info("stellar.m_star_old", info_old["m_star"], True) unit='ph/s')
sed.add_info("stellar.m_gas_old", info_old["m_gas"], True) sed.add_info("stellar.lum_ly_young", lum_lyc_young, True, unit='W')
sed.add_info("stellar.n_ly_old", info_old["n_ly"], True) sed.add_info("stellar.lum_young", lum_young, True, unit='W')
sed.add_info("stellar.lum_ly_old", lum_lyc_old, True)
sed.add_info("stellar.lum_old", lum_old, True) sed.add_info("stellar.m_star_old", info_old["m_star"], True,
unit='solMass')
sed.add_info("stellar.m_star", info_all["m_star"], True) sed.add_info("stellar.m_gas_old", info_old["m_gas"], True,
sed.add_info("stellar.m_gas", info_all["m_gas"], True) unit='solMass')
sed.add_info("stellar.n_ly", info_all["n_ly"], True) sed.add_info("stellar.n_ly_old", info_old["n_ly"], True, unit='ph/s')
sed.add_info("stellar.lum_ly", lum_lyc_young + lum_lyc_old, True) sed.add_info("stellar.lum_ly_old", lum_lyc_old, True, unit='W')
sed.add_info("stellar.lum", lum_young + lum_old, True) sed.add_info("stellar.lum_old", lum_old, True, unit='W')
sed.add_info("stellar.age_m_star", info_all["age_mass"])
sed.add_info("stellar.m_star", info_all["m_star"], True, unit='solMass')
sed.add_info("stellar.m_gas", info_all["m_gas"], True, unit='solMass')
sed.add_info("stellar.n_ly", info_all["n_ly"], True, unit='ph/s')
sed.add_info("stellar.lum_ly", lum_lyc_young + lum_lyc_old, True, unit='W')
sed.add_info("stellar.lum", lum_young + lum_old, True, unit='W')
sed.add_info("stellar.age_m_star", info_all["age_mass"], unit='Myr')
sed.add_contribution("stellar.old", wave, spec_old) sed.add_contribution("stellar.old", wave, spec_old)
sed.add_contribution("stellar.young", wave, spec_young) sed.add_contribution("stellar.young", wave, spec_young)
......
...@@ -97,11 +97,11 @@ class Casey2012(SedModule): ...@@ -97,11 +97,11 @@ class Casey2012(SedModule):
""" """
if 'dust.luminosity' not in sed.info: if 'dust.luminosity' not in sed.info:
sed.add_info('dust.luminosity', 1., True) sed.add_info('dust.luminosity', 1., True, unit='W')
luminosity = sed.info['dust.luminosity'] luminosity = sed.info['dust.luminosity']
sed.add_module(self.name, self.parameters) sed.add_module(self.name, self.parameters)
sed.add_info("dust.temperature", self.temperature) sed.add_info("dust.temperature", self.temperature, unit='K')
sed.add_info("dust.beta", self.beta) sed.add_info("dust.beta", self.beta)
sed.add_info("dust.alpha", self.alpha) sed.add_info("dust.alpha", self.alpha)
......
...@@ -86,7 +86,7 @@ class Dale2014(SedModule): ...@@ -86,7 +86,7 @@ class Dale2014(SedModule):
""" """
if 'dust.luminosity' not in sed.info: if 'dust.luminosity' not in sed.info:
sed.add_info('dust.luminosity', 1., True) sed.add_info('dust.luminosity', 1., True, unit='W')
luminosity = sed.info['dust.luminosity'] luminosity = sed.info['dust.luminosity']
if self.fracAGN < 1.: if self.fracAGN < 1.:
......
...@@ -108,7 +108,7 @@ class DL2007(SedModule): ...@@ -108,7 +108,7 @@ class DL2007(SedModule):
""" """
if 'dust.luminosity' not in sed.info: if 'dust.luminosity' not in sed.info:
sed.add_info('dust.luminosity', 1., True) sed.add_info('dust.luminosity', 1., True, unit='W')
luminosity = sed.info['dust.luminosity'] luminosity = sed.info['dust.luminosity']
sed.add_module(self.name, self.parameters) sed.add_module(self.name, self.parameters)
...@@ -119,7 +119,8 @@ class DL2007(SedModule): ...@@ -119,7 +119,8 @@ class DL2007(SedModule):
sed.add_info('dust.gamma', self.gamma) sed.add_info('dust.gamma', self.gamma)
# To compute the dust mass we simply divide the luminosity in W by the # To compute the dust mass we simply divide the luminosity in W by the
# emissivity in W/kg of dust. # emissivity in W/kg of dust.
sed.add_info('dust.mass', luminosity / self.emissivity, True) sed.add_info('dust.mass', luminosity / self.emissivity, True,
unit='solMass')
sed.add_contribution('dust.Umin_Umin', self.model_minmin.wave, sed.add_contribution('dust.Umin_Umin', self.model_minmin.wave,
luminosity * self.model_minmin.lumin) luminosity * self.model_minmin.lumin)
......
...@@ -128,7 +128,7 @@ class DL2014(SedModule): ...@@ -128,7 +128,7 @@ class DL2014(SedModule):
""" """
if 'dust.luminosity' not in sed.info: if 'dust.luminosity' not in sed.info:
sed.add_info('dust.luminosity', 1., True) sed.add_info('dust.luminosity', 1., True, unit='W')
luminosity = sed.info['dust.luminosity'] luminosity = sed.info['dust.luminosity']
sed.add_module(self.name, self.parameters) sed.add_module(self.name, self.parameters)
...@@ -139,7 +139,8 @@ class DL2014(SedModule): ...@@ -139,7 +139,8 @@ class DL2014(SedModule):
sed.add_info('dust.gamma', self.gamma) sed.add_info('dust.gamma', self.gamma)
# To compute the dust mass we simply divide the luminosity in W by the # To compute the dust mass we simply divide the luminosity in W by the
# emissivity in W/kg of dust. # emissivity in W/kg of dust.
sed.add_info('dust.mass', luminosity / self.emissivity, True) sed.add_info('dust.mass', luminosity / self.emissivity, True,
unit='solMass')
sed.add_contribution('dust.Umin_Umin', self.model_minmin.wave, sed.add_contribution('dust.Umin_Umin', self.model_minmin.wave,
luminosity * self.model_minmin.lumin) luminosity * self.model_minmin.lumin)
......
...@@ -201,17 +201,18 @@ class TwoPowerLawAtt(SedModule): ...@@ -201,17 +201,18 @@ class TwoPowerLawAtt(SedModule):
sed.lines[name] = (linewl, old * self.lineatt[name][0], sed.lines[name] = (linewl, old * self.lineatt[name][0],
young * self.lineatt[name][1]) young * self.lineatt[name][1])
sed.add_info('attenuation.Av_BC', self.Av_BC) sed.add_info('attenuation.Av_BC', self.Av_BC, unit='mag')
sed.add_info('attenuation.slope_BC', self.slope_BC) sed.add_info('attenuation.slope_BC', self.slope_BC, unit='mag')
sed.add_info('attenuation.BC_to_ISM_factor', self.BC_to_ISM_factor) sed.add_info('attenuation.BC_to_ISM_factor', self.BC_to_ISM_factor)
sed.add_info('attenuation.slope_ISM', self.slope_ISM) sed.add_info('attenuation.slope_ISM', self.slope_ISM)
# Total attenuation # Total attenuation
if 'dust.luminosity' in sed.info: if 'dust.luminosity' in sed.info:
sed.add_info("dust.luminosity", sed.add_info("dust.luminosity",
sed.info["dust.luminosity"] + dust_lumin, True, True) sed.info["dust.luminosity"] + dust_lumin, True, True,
unit='W')
else: else:
sed.add_info("dust.luminosity", dust_lumin, True) sed.add_info("dust.luminosity", dust_lumin, True, unit='W')
# Fλ fluxes (only in continuum) in each filter after attenuation. # Fλ fluxes (only in continuum) in each filter after attenuation.
flux_att = {filt: sed.compute_fnu(filt) for filt in self.filter_list} flux_att = {filt: sed.compute_fnu(filt) for filt in self.filter_list}
...@@ -219,7 +220,8 @@ class TwoPowerLawAtt(SedModule): ...@@ -219,7 +220,8 @@ class TwoPowerLawAtt(SedModule):
# Attenuation in each filter # Attenuation in each filter
for filt in self.filter_list: for filt in self.filter_list:
sed.add_info("attenuation." + filt, sed.add_info("attenuation." + filt,
-2.5 * np.log10(flux_att[filt] / flux_noatt[filt])) -2.5 * np.log10(flux_att[filt] / flux_noatt[filt]),
unit='mag')
# CreationModule to be returned by get_module # CreationModule to be returned by get_module
......
...@@ -304,8 +304,10 @@ class CalzLeit(SedModule): ...@@ -304,8 +304,10 @@ class CalzLeit(SedModule):
attenuation_total += attenuation attenuation_total += attenuation
sed.add_module(self.name, self.parameters) sed.add_module(self.name, self.parameters)
sed.add_info("attenuation.E_BVs." + contrib, self.ebvs[age]) sed.add_info("attenuation.E_BVs." + contrib, self.ebvs[age],
sed.add_info("attenuation." + contrib, attenuation, True) unit='mag')
sed.add_info("attenuation." + contrib, attenuation, True,
unit='mag')
sed.add_contribution("attenuation." + contrib, wavelength, sed.add_contribution("attenuation." + contrib, wavelength,
attenuation_spectrum) attenuation_spectrum)
...@@ -317,9 +319,9 @@ class CalzLeit(SedModule): ...@@ -317,9 +319,9 @@ class CalzLeit(SedModule):
if 'dust.luminosity' in sed.info: if 'dust.luminosity' in sed.info:
sed.add_info("dust.luminosity", sed.add_info("dust.luminosity",
sed.info["dust.luminosity"]+attenuation_total, True, sed.info["dust.luminosity"]+attenuation_total, True,
True) True, unit=W)
else: else:
sed.add_info("dust.luminosity", attenuation_total, True) sed.add_info("dust.luminosity", attenuation_total, True, unit='W')
# Fλ fluxes (only from continuum) in each filter after attenuation. # Fλ fluxes (only from continuum) in each filter after attenuation.
flux_att = {filt: sed.compute_fnu(filt) for filt in self.filter_list} flux_att = {filt: sed.compute_fnu(filt) for filt in self.filter_list}
...@@ -327,11 +329,13 @@ class CalzLeit(SedModule): ...@@ -327,11 +329,13 @@ class CalzLeit(SedModule):
# Attenuation in each filter # Attenuation in each filter
for filt in self.filter_list: for filt in self.filter_list:
sed.add_info("attenuation." + filt, sed.add_info("attenuation." + filt,
-2.5 * np.log10(flux_att[filt] / flux_noatt[filt])) -2.5 * np.log10(flux_att[filt] / flux_noatt[filt]),
unit='mag')
sed.add_info('attenuation.ebvs_old_factor', self.ebvs_old_factor) sed.add_info('attenuation.ebvs_old_factor', self.ebvs_old_factor)
sed.add_info('attenuation.uv_bump_wavelength', self.uv_bump_wavelength) sed.add_info('attenuation.uv_bump_wavelength', self.uv_bump_wavelength,
sed.add_info('attenuation.uv_bump_width', self.uv_bump_width) unit='nm')
sed.add_info('attenuation.uv_bump_width', self.uv_bump_width, unit='nm')
sed.add_info('attenuation.uv_bump_amplitude', self.uv_bump_amplitude) sed.add_info('attenuation.uv_bump_amplitude', self.uv_bump_amplitude)
sed.add_info('attenuation.powerlaw_slope', self.powerlaw_slope) sed.add_info('attenuation.powerlaw_slope', self.powerlaw_slope)
......
...@@ -166,8 +166,8 @@ class ModCF00Att(SedModule): ...@@ -166,8 +166,8 @@ class ModCF00Att(SedModule):
sed.lines[name] = (linewl, old * self.lineatt[name][0], sed.lines[name] = (linewl, old * self.lineatt[name][0],
young * self.lineatt[name][1]) young * self.lineatt[name][1])
sed.add_info('attenuation.Av_ISM', self.Av_ISM) sed.add_info('attenuation.Av_ISM', self.Av_ISM, unit='mag')
sed.add_info('attenuation.Av_BC', self.Av_BC) sed.add_info('attenuation.Av_BC', self.Av_BC, unit='mag')
sed.add_info('attenuation.mu', self.mu) sed.add_info('attenuation.mu', self.mu)
sed.add_info('attenuation.slope_BC', self.slope_BC) sed.add_info('attenuation.slope_BC', self.slope_BC)
sed.add_info('attenuation.slope_ISM', self.slope_ISM) sed.add_info('attenuation.slope_ISM', self.slope_ISM)
...@@ -175,9 +175,10 @@ class ModCF00Att(SedModule): ...@@ -175,9 +175,10 @@ class ModCF00Att(SedModule):
# Total attenuation # Total attenuation
if 'dust.luminosity' in sed.info: if 'dust.luminosity' in sed.info:
sed.add_info("dust.luminosity", sed.add_info("dust.luminosity",
sed.info["dust.luminosity"] + dust_lumin, True, True) sed.info["dust.luminosity"] + dust_lumin, True, True,
unit='W')
else: else:
sed.add_info("dust.luminosity", dust_lumin, True) sed.add_info("dust.luminosity", dust_lumin, True, unit='W')
# Fλ fluxes (only in continuum) in each filter after attenuation. # Fλ fluxes (only in continuum) in each filter after attenuation.
flux_att = {filt: sed.compute_fnu(filt) for filt in self.filter_list} flux_att = {filt: sed.compute_fnu(filt) for filt in self.filter_list}
...@@ -185,7 +186,7 @@ class ModCF00Att(SedModule): ...@@ -185,7 +186,7 @@ class ModCF00Att(SedModule):
# Attenuation in each filter # Attenuation in each filter
for filt in self.filter_list: for filt in self.filter_list:
att = -2.5 * np.log10(flux_att[filt] / flux_noatt[filt]) att = -2.5 * np.log10(flux_att[filt] / flux_noatt[filt])
sed.add_info("attenuation." + filt, max(0., att)) sed.add_info("attenuation." + filt, max(0., att), unit='mag')
# CreationModule to be returned by get_module # CreationModule to be returned by get_module
......
...@@ -445,9 +445,10 @@ class ModStarburstAtt(SedModule): ...@@ -445,9 +445,10 @@ class ModStarburstAtt(SedModule):
# Total attenuation # Total attenuation
if 'dust.luminosity' in sed.info: if 'dust.luminosity' in sed.info:
sed.add_info("dust.luminosity", sed.add_info("dust.luminosity",
sed.info["dust.luminosity"] + dust_lumin, True, True) sed.info["dust.luminosity"] + dust_lumin, True, True,
unit='W')
else: else:
sed.add_info("dust.luminosity", dust_lumin, True) sed.add_info("dust.luminosity", dust_lumin, True, unit='W')
# Fλ fluxes (only from continuum) in each filter after attenuation. # Fλ fluxes (only from continuum) in each filter after attenuation.
flux_att = {filt: sed.compute_fnu(filt) for filt in self.filter_list}