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

The name creation_modules is a bit vague. For more clarity and consistency we...

The name creation_modules is a bit vague. For more clarity and consistency we rather use sed_modules now
parent a4e939be
...@@ -145,7 +145,7 @@ class PdfAnalysis(AnalysisModule): ...@@ -145,7 +145,7 @@ class PdfAnalysis(AnalysisModule):
# Retrieve an arbitrary SED to obtain the list of output parameters # Retrieve an arbitrary SED to obtain the list of output parameters
warehouse = SedWarehouse() warehouse = SedWarehouse()
sed = warehouse.get_sed(conf['creation_modules'], params.from_index(0)) sed = warehouse.get_sed(conf['sed_modules'], params.from_index(0))
info = list(sed.info.keys()) info = list(sed.info.keys())
info.sort() info.sort()
n_info = len(info) n_info = len(info)
......
...@@ -45,7 +45,7 @@ class ParametersHandlerGrid(object): ...@@ -45,7 +45,7 @@ class ParametersHandlerGrid(object):
Contains the modules in the order they are called Contains the modules in the order they are called
""" """
self.modules = configuration['creation_modules'] self.modules = configuration['sed_modules']
self.parameters = [self._param_dict_combine(configuration['sed_modules_params'][module]) self.parameters = [self._param_dict_combine(configuration['sed_modules_params'][module])
for module in self.modules] for module in self.modules]
self.shape = tuple(len(parameter) for parameter in self.parameters) self.shape = tuple(len(parameter) for parameter in self.parameters)
......
...@@ -67,7 +67,7 @@ def complete_parameters(given_parameters, parameter_list): ...@@ -67,7 +67,7 @@ def complete_parameters(given_parameters, parameter_list):
return result return result
class CreationModule(object): class SedModule(object):
"""Abstract class, the pCigale SED creation modules are based on. """Abstract class, the pCigale SED creation modules are based on.
""" """
...@@ -163,11 +163,11 @@ def get_module(name, **kwargs): ...@@ -163,11 +163,11 @@ def get_module(name, **kwargs):
Returns Returns
------- -------
a pcigale.creation_modules.Module instance a pcigale.sed_modules.Module instance
""" """
try: try:
module = import_module("." + name, 'pcigale.creation_modules') module = import_module("." + name, 'pcigale.sed_modules')
return module.Module(name=name, **kwargs) return module.Module(name=name, **kwargs)
except ImportError: except ImportError:
print('Module ' + name + ' does not exist!') print('Module ' + name + ' does not exist!')
......
...@@ -16,11 +16,11 @@ from collections import OrderedDict ...@@ -16,11 +16,11 @@ from collections import OrderedDict
import numpy as np import numpy as np
from . import CreationModule from . import SedModule
from ..data import Database from ..data import Database
class BC03(CreationModule): class BC03(SedModule):
"""Bruzual and Charlot (2003) stellar emission module """Bruzual and Charlot (2003) stellar emission module
This SED creation module convolves the SED star formation history with a This SED creation module convolves the SED star formation history with a
...@@ -131,5 +131,5 @@ class BC03(CreationModule): ...@@ -131,5 +131,5 @@ class BC03(CreationModule):
sed.add_contribution("stellar.old", old_wave, old_lumin) sed.add_contribution("stellar.old", old_wave, old_lumin)
sed.add_contribution("stellar.young", young_wave, young_lumin) sed.add_contribution("stellar.young", young_wave, young_lumin)
# CreationModule to be returned by get_module # SedModule to be returned by get_module
Module = BC03 Module = BC03
...@@ -17,10 +17,10 @@ from collections import OrderedDict ...@@ -17,10 +17,10 @@ from collections import OrderedDict
import numpy as np import numpy as np
import scipy.constants as cst import scipy.constants as cst
from . import CreationModule from . import SedModule
class Casey2012(CreationModule): class Casey2012(SedModule):
"""Casey (2012) templates IR re-emission """Casey (2012) templates IR re-emission
Given an amount of attenuation (e.g. resulting from the action of a dust Given an amount of attenuation (e.g. resulting from the action of a dust
...@@ -111,5 +111,5 @@ class Casey2012(CreationModule): ...@@ -111,5 +111,5 @@ class Casey2012(CreationModule):
sed.add_contribution('dust.blackbody', self.wave, sed.add_contribution('dust.blackbody', self.wave,
luminosity * self.lumin_blackbody) luminosity * self.lumin_blackbody)
# CreationModule to be returned by get_module # SedModule to be returned by get_module
Module = Casey2012 Module = Casey2012
...@@ -14,10 +14,10 @@ This module implements the Dale (2014) infra-red models. ...@@ -14,10 +14,10 @@ This module implements the Dale (2014) infra-red models.
from collections import OrderedDict from collections import OrderedDict
from pcigale.data import Database from pcigale.data import Database
from . import CreationModule from . import SedModule
class Dale2014(CreationModule): class Dale2014(SedModule):
"""Dale et al. (2014) templates IR re-emission """Dale et al. (2014) templates IR re-emission
Given an amount of attenuation (e.g. resulting from the action of a dust Given an amount of attenuation (e.g. resulting from the action of a dust
...@@ -104,5 +104,5 @@ class Dale2014(CreationModule): ...@@ -104,5 +104,5 @@ class Dale2014(CreationModule):
sed.add_contribution('agn', self.model_quasar.wave, sed.add_contribution('agn', self.model_quasar.wave,
L_AGN * self.model_quasar.lumin) L_AGN * self.model_quasar.lumin)
# CreationModule to be returned by get_module # SedModule to be returned by get_module
Module = Dale2014 Module = Dale2014
...@@ -17,10 +17,10 @@ from collections import OrderedDict ...@@ -17,10 +17,10 @@ from collections import OrderedDict
import numpy as np import numpy as np
from pcigale.data import Database from pcigale.data import Database
from . import CreationModule from . import SedModule
class DL2007(CreationModule): class DL2007(SedModule):
"""Draine and Li (2007) templates IR re-emission module """Draine and Li (2007) templates IR re-emission module
Given an amount of attenuation (e.g. resulting from the action of a dust Given an amount of attenuation (e.g. resulting from the action of a dust
...@@ -120,5 +120,5 @@ class DL2007(CreationModule): ...@@ -120,5 +120,5 @@ class DL2007(CreationModule):
sed.add_contribution('dust.Umin_Umax', self.model_minmax.wave, sed.add_contribution('dust.Umin_Umax', self.model_minmax.wave,
luminosity * self.model_minmax.lumin) luminosity * self.model_minmax.lumin)
# CreationModule to be returned by get_module # SedModule to be returned by get_module
Module = DL2007 Module = DL2007
...@@ -17,10 +17,10 @@ from collections import OrderedDict ...@@ -17,10 +17,10 @@ from collections import OrderedDict
import numpy as np import numpy as np
from pcigale.data import Database from pcigale.data import Database
from . import CreationModule from . import SedModule
class DL2014(CreationModule): class DL2014(SedModule):
"""Updated Draine and Li (2007) templates IR re-emission module """Updated Draine and Li (2007) templates IR re-emission module
Given an amount of attenuation (e.g. resulting from the action of a dust Given an amount of attenuation (e.g. resulting from the action of a dust
...@@ -128,5 +128,5 @@ class DL2014(CreationModule): ...@@ -128,5 +128,5 @@ class DL2014(CreationModule):
sed.add_contribution('dust.Umin_Umax', self.model_minmax.wave, sed.add_contribution('dust.Umin_Umax', self.model_minmax.wave,
luminosity * self.model_minmax.lumin) luminosity * self.model_minmax.lumin)
# CreationModule to be returned by get_module # SedModule to be returned by get_module
Module = DL2014 Module = DL2014
...@@ -17,7 +17,7 @@ from collections import OrderedDict ...@@ -17,7 +17,7 @@ from collections import OrderedDict
import numpy as np import numpy as np
from . import CreationModule from . import SedModule
def k_calzetti2000(wavelength): def k_calzetti2000(wavelength):
...@@ -179,7 +179,7 @@ def a_vs_ebv(wavelength, bump_wave, bump_width, bump_ampl, power_slope): ...@@ -179,7 +179,7 @@ def a_vs_ebv(wavelength, bump_wave, bump_width, bump_ampl, power_slope):
return attenuation return attenuation
class CalzLeit(CreationModule): class CalzLeit(SedModule):
"""Calzetti + Leitherer attenuation module """Calzetti + Leitherer attenuation module
This module computes the dust attenuation using the This module computes the dust attenuation using the
...@@ -314,5 +314,5 @@ class CalzLeit(CreationModule): ...@@ -314,5 +314,5 @@ class CalzLeit(CreationModule):
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)
# CreationModule to be returned by get_module # SedModule to be returned by get_module
Module = CalzLeit Module = CalzLeit
...@@ -17,7 +17,7 @@ from collections import OrderedDict ...@@ -17,7 +17,7 @@ from collections import OrderedDict
import numpy as np import numpy as np
from . import CreationModule from . import SedModule
def power_law(wavelength, delta): def power_law(wavelength, delta):
...@@ -99,7 +99,7 @@ def alambda_av(wavelength, delta, bump_wave, bump_width, bump_ampl): ...@@ -99,7 +99,7 @@ def alambda_av(wavelength, delta, bump_wave, bump_width, bump_ampl):
return attenuation return attenuation
class PowerLawAtt(CreationModule): class PowerLawAtt(SedModule):
"""Power law attenuation module """Power law attenuation module
This module computes the attenuation using a power law This module computes the attenuation using a power law
...@@ -229,5 +229,5 @@ class PowerLawAtt(CreationModule): ...@@ -229,5 +229,5 @@ class PowerLawAtt(CreationModule):
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]))
# CreationModule to be returned by get_module # SedModule to be returned by get_module
Module = PowerLawAtt Module = PowerLawAtt
...@@ -15,10 +15,10 @@ from collections import OrderedDict ...@@ -15,10 +15,10 @@ from collections import OrderedDict
import numpy as np import numpy as np
from pcigale.data import Database from pcigale.data import Database
from . import CreationModule from . import SedModule
class Fritz2006(CreationModule): class Fritz2006(SedModule):
"""Fritz et al. (2006) AGN dust torus emission """Fritz et al. (2006) AGN dust torus emission
The AGN emission is computed from the library of Fritz et al. (2006) from The AGN emission is computed from the library of Fritz et al. (2006) from
...@@ -152,5 +152,5 @@ class Fritz2006(CreationModule): ...@@ -152,5 +152,5 @@ class Fritz2006(CreationModule):
sed.add_contribution('agn.fritz2006_agn', self.fritz2006.wave, sed.add_contribution('agn.fritz2006_agn', self.fritz2006.wave,
agn_power * self.fritz2006.lumin_agn) agn_power * self.fritz2006.lumin_agn)
# CreationModule to be returned by get_module # SedModule to be returned by get_module
Module = Fritz2006 Module = Fritz2006
...@@ -14,10 +14,10 @@ This module reads a SED spectrum from a file. ...@@ -14,10 +14,10 @@ This module reads a SED spectrum from a file.
from collections import OrderedDict from collections import OrderedDict
from ..utils import read_table from ..utils import read_table
from . import CreationModule from . import SedModule
class LoadSpecFile(CreationModule): class LoadSpecFile(SedModule):
"""Module reading a spectrum from a file and adding it to the SED. """Module reading a spectrum from a file and adding it to the SED.
""" """
...@@ -60,5 +60,5 @@ class LoadSpecFile(CreationModule): ...@@ -60,5 +60,5 @@ class LoadSpecFile(CreationModule):
table[self.parameters['l_lambda_column']] table[self.parameters['l_lambda_column']]
) )
# CreationModule to be returned by get_module # SedModule to be returned by get_module
Module = LoadSpecFile Module = LoadSpecFile
...@@ -15,11 +15,11 @@ from collections import OrderedDict ...@@ -15,11 +15,11 @@ from collections import OrderedDict
import numpy as np import numpy as np
from . import CreationModule from . import SedModule
from ..data import Database from ..data import Database
class M2005(CreationModule): class M2005(SedModule):
"""Maraston (2005) stellar emission module """Maraston (2005) stellar emission module
This SED creation module convolves the SED star formation history with This SED creation module convolves the SED star formation history with
...@@ -139,5 +139,5 @@ class M2005(CreationModule): ...@@ -139,5 +139,5 @@ class M2005(CreationModule):
ssp.wavelength_grid, ssp.wavelength_grid,
young_spectrum) young_spectrum)
# CreationModule to be returned by get_module # SedModule to be returned by get_module
Module = M2005 Module = M2005
...@@ -21,10 +21,10 @@ from collections import OrderedDict ...@@ -21,10 +21,10 @@ from collections import OrderedDict
import numpy as np import numpy as np
import scipy.constants as cst import scipy.constants as cst
from . import CreationModule from . import SedModule
class MBB(CreationModule): class MBB(SedModule):
"""One modified black body IR re-emission """One modified black body IR re-emission
Given an amount of attenuation (e.g. resulting from the action of a dust Given an amount of attenuation (e.g. resulting from the action of a dust
...@@ -130,5 +130,5 @@ class MBB(CreationModule): ...@@ -130,5 +130,5 @@ class MBB(CreationModule):
sed.add_contribution('dust.mbb', self.wave, sed.add_contribution('dust.mbb', self.wave,
luminosity * self.epsilon * self.lumin_mbb) luminosity * self.epsilon * self.lumin_mbb)
# #
# CreationModule to be returned by get_module # SedModule to be returned by get_module
Module = MBB Module = MBB
...@@ -9,10 +9,10 @@ import numpy as np ...@@ -9,10 +9,10 @@ import numpy as np
import scipy.constants as cst import scipy.constants as cst
from pcigale.data import Database from pcigale.data import Database
from . import CreationModule from . import SedModule
class NebularEmission(CreationModule): class NebularEmission(SedModule):
""" """
Module computing the nebular emission from the ultraviolet to the Module computing the nebular emission from the ultraviolet to the
near-infrared. It includes both the nebular lines and the nubular near-infrared. It includes both the nebular lines and the nubular
...@@ -174,5 +174,5 @@ class NebularEmission(CreationModule): ...@@ -174,5 +174,5 @@ class NebularEmission(CreationModule):
sed.add_contribution('nebular.continuum_young', cont.wave, sed.add_contribution('nebular.continuum_young', cont.wave,
cont.lumin * NLy_young * self.conv_cont) cont.lumin * NLy_young * self.conv_cont)
# CreationModule to be returned by get_module # SedModule to be returned by get_module
Module = NebularEmission Module = NebularEmission
...@@ -25,10 +25,10 @@ from collections import OrderedDict ...@@ -25,10 +25,10 @@ from collections import OrderedDict
import numpy as np import numpy as np
from . import CreationModule from . import SedModule
class Param(CreationModule): class Param(SedModule):
"""Other parameters """Other parameters
This module does not need any input. This module does not need any input.
...@@ -133,5 +133,5 @@ class Param(CreationModule): ...@@ -133,5 +133,5 @@ class Param(CreationModule):
True True
) )
# CreationModule to be returned by get_module # SedModule to be returned by get_module
Module = Param Module = Param
...@@ -22,10 +22,10 @@ from collections import OrderedDict ...@@ -22,10 +22,10 @@ from collections import OrderedDict
import numpy as np import numpy as np
import scipy.constants as cst import scipy.constants as cst
from . import CreationModule from . import SedModule
class Radio(CreationModule): class Radio(SedModule):
"""Radio emission """Radio emission
Given the number of Lyman photons, the module computes the free-free Given the number of Lyman photons, the module computes the free-free
...@@ -85,5 +85,5 @@ class Radio(CreationModule): ...@@ -85,5 +85,5 @@ class Radio(CreationModule):
sed.add_contribution('radio_nonthermal', self.wave, sed.add_contribution('radio_nonthermal', self.wave,
self.lumin_nonthermal * luminosity) self.lumin_nonthermal * luminosity)
# CreationModule to be returned by get_module # SedModule to be returned by get_module
Module = Radio Module = Radio
...@@ -25,7 +25,7 @@ from scipy.constants import parsec ...@@ -25,7 +25,7 @@ from scipy.constants import parsec
from scipy.misc import factorial from scipy.misc import factorial
from astropy.cosmology import WMAP7 as cosmology from astropy.cosmology import WMAP7 as cosmology
from . import CreationModule from . import SedModule
def igm_transmission(wavelength, redshift): def igm_transmission(wavelength, redshift):
...@@ -135,7 +135,7 @@ def igm_transmission(wavelength, redshift): ...@@ -135,7 +135,7 @@ def igm_transmission(wavelength, redshift):
return igm_transmission return igm_transmission
class Redshifting(CreationModule): class Redshifting(SedModule):
"""Redshift a SED """Redshift a SED
This module redshift a rest-frame SED. If the SED is already redshifted, an This module redshift a rest-frame SED. If the SED is already redshifted, an
...@@ -216,5 +216,5 @@ class Redshifting(CreationModule): ...@@ -216,5 +216,5 @@ class Redshifting(CreationModule):
self.igm_attenuation[key] * sed.luminosity) self.igm_attenuation[key] * sed.luminosity)
sed.add_module(self.name, self.parameters) sed.add_module(self.name, self.parameters)
# CreationModule to be returned by get_module # SedModule to be returned by get_module
Module = Redshifting Module = Redshifting
...@@ -15,10 +15,10 @@ This module implements the Schreiber et al. (2016) infra-red models. ...@@ -15,10 +15,10 @@ This module implements the Schreiber et al. (2016) infra-red models.
from collections import OrderedDict from collections import OrderedDict
import numpy as np import numpy as np
from pcigale.data import Database from pcigale.data import Database
from . import CreationModule from . import SedModule
class Schreiber2016(CreationModule): class Schreiber2016(SedModule):
"""Schreiber et al. (2016) templates IR re-emission module """Schreiber et al. (2016) templates IR re-emission module
Given an amount of attenuation (e.g. resulting from the action of a dust Given an amount of attenuation (e.g. resulting from the action of a dust
...@@ -104,5 +104,5 @@ class Schreiber2016(CreationModule): ...@@ -104,5 +104,5 @@ class Schreiber2016(CreationModule):
sed.add_contribution('dust.pah', self.model_pah.wave, sed.add_contribution('dust.pah', self.model_pah.wave,
luminosity * self.model_pah.lumin) luminosity * self.model_pah.lumin)
# CreationModule to be returned by get_module # SedModule to be returned by get_module
Module = Schreiber2016 Module = Schreiber2016
...@@ -16,10 +16,10 @@ from collections import OrderedDict ...@@ -16,10 +16,10 @@ from collections import OrderedDict
import numpy as np import numpy as np
from . import CreationModule from . import SedModule
class Sfh2Exp(CreationModule): class Sfh2Exp(SedModule):
"""Double decreasing exponential Star Formation History """Double decreasing exponential Star Formation History
This module sets the SED star formation history (SFH) as a combination of This module sets the SED star formation history (SFH) as a combination of
...@@ -119,5 +119,5 @@ class Sfh2Exp(CreationModule): ...@@ -119,5 +119,5 @@ class Sfh2Exp(CreationModule):
sed.add_info("sfh.f_burst", self.f_burst) sed.add_info("sfh.f_burst", self.f_burst)
sed.add_info("sfh.burst_age", self.burst_age) sed.add_info("sfh.burst_age", self.burst_age)
# CreationModule to be returned by get_module # SedModule to be returned by get_module
Module = Sfh2Exp Module = Sfh2Exp
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