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

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):
# Retrieve an arbitrary SED to obtain the list of output parameters
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.sort()
n_info = len(info)
......
......@@ -45,7 +45,7 @@ class ParametersHandlerGrid(object):
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])
for module in self.modules]
self.shape = tuple(len(parameter) for parameter in self.parameters)
......
......@@ -67,7 +67,7 @@ def complete_parameters(given_parameters, parameter_list):
return result
class CreationModule(object):
class SedModule(object):
"""Abstract class, the pCigale SED creation modules are based on.
"""
......@@ -163,11 +163,11 @@ def get_module(name, **kwargs):
Returns
-------
a pcigale.creation_modules.Module instance
a pcigale.sed_modules.Module instance
"""
try:
module = import_module("." + name, 'pcigale.creation_modules')
module = import_module("." + name, 'pcigale.sed_modules')
return module.Module(name=name, **kwargs)
except ImportError:
print('Module ' + name + ' does not exist!')
......
......@@ -16,11 +16,11 @@ from collections import OrderedDict
import numpy as np
from . import CreationModule
from . import SedModule
from ..data import Database
class BC03(CreationModule):
class BC03(SedModule):
"""Bruzual and Charlot (2003) stellar emission module
This SED creation module convolves the SED star formation history with a
......@@ -131,5 +131,5 @@ class BC03(CreationModule):
sed.add_contribution("stellar.old", old_wave, old_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
......@@ -17,10 +17,10 @@ from collections import OrderedDict
import numpy as np
import scipy.constants as cst
from . import CreationModule
from . import SedModule
class Casey2012(CreationModule):
class Casey2012(SedModule):
"""Casey (2012) templates IR re-emission
Given an amount of attenuation (e.g. resulting from the action of a dust
......@@ -111,5 +111,5 @@ class Casey2012(CreationModule):
sed.add_contribution('dust.blackbody', self.wave,
luminosity * self.lumin_blackbody)
# CreationModule to be returned by get_module
# SedModule to be returned by get_module
Module = Casey2012
......@@ -14,10 +14,10 @@ This module implements the Dale (2014) infra-red models.
from collections import OrderedDict
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
Given an amount of attenuation (e.g. resulting from the action of a dust
......@@ -104,5 +104,5 @@ class Dale2014(CreationModule):
sed.add_contribution('agn', self.model_quasar.wave,
L_AGN * self.model_quasar.lumin)
# CreationModule to be returned by get_module
# SedModule to be returned by get_module
Module = Dale2014
......@@ -17,10 +17,10 @@ from collections import OrderedDict
import numpy as np
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
Given an amount of attenuation (e.g. resulting from the action of a dust
......@@ -120,5 +120,5 @@ class DL2007(CreationModule):
sed.add_contribution('dust.Umin_Umax', self.model_minmax.wave,
luminosity * self.model_minmax.lumin)
# CreationModule to be returned by get_module
# SedModule to be returned by get_module
Module = DL2007
......@@ -17,10 +17,10 @@ from collections import OrderedDict
import numpy as np
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
Given an amount of attenuation (e.g. resulting from the action of a dust
......@@ -128,5 +128,5 @@ class DL2014(CreationModule):
sed.add_contribution('dust.Umin_Umax', self.model_minmax.wave,
luminosity * self.model_minmax.lumin)
# CreationModule to be returned by get_module
# SedModule to be returned by get_module
Module = DL2014
......@@ -17,7 +17,7 @@ from collections import OrderedDict
import numpy as np
from . import CreationModule
from . import SedModule
def k_calzetti2000(wavelength):
......@@ -179,7 +179,7 @@ def a_vs_ebv(wavelength, bump_wave, bump_width, bump_ampl, power_slope):
return attenuation
class CalzLeit(CreationModule):
class CalzLeit(SedModule):
"""Calzetti + Leitherer attenuation module
This module computes the dust attenuation using the
......@@ -314,5 +314,5 @@ class CalzLeit(CreationModule):
sed.add_info('attenuation.uv_bump_amplitude', self.uv_bump_amplitude)
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
......@@ -17,7 +17,7 @@ from collections import OrderedDict
import numpy as np
from . import CreationModule
from . import SedModule
def power_law(wavelength, delta):
......@@ -99,7 +99,7 @@ def alambda_av(wavelength, delta, bump_wave, bump_width, bump_ampl):
return attenuation
class PowerLawAtt(CreationModule):
class PowerLawAtt(SedModule):
"""Power law attenuation module
This module computes the attenuation using a power law
......@@ -229,5 +229,5 @@ class PowerLawAtt(CreationModule):
sed.add_info("attenuation." + 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
......@@ -15,10 +15,10 @@ from collections import OrderedDict
import numpy as np
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
The AGN emission is computed from the library of Fritz et al. (2006) from
......@@ -152,5 +152,5 @@ class Fritz2006(CreationModule):
sed.add_contribution('agn.fritz2006_agn', self.fritz2006.wave,
agn_power * self.fritz2006.lumin_agn)
# CreationModule to be returned by get_module
# SedModule to be returned by get_module
Module = Fritz2006
......@@ -14,10 +14,10 @@ This module reads a SED spectrum from a file.
from collections import OrderedDict
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.
"""
......@@ -60,5 +60,5 @@ class LoadSpecFile(CreationModule):
table[self.parameters['l_lambda_column']]
)
# CreationModule to be returned by get_module
# SedModule to be returned by get_module
Module = LoadSpecFile
......@@ -15,11 +15,11 @@ from collections import OrderedDict
import numpy as np
from . import CreationModule
from . import SedModule
from ..data import Database
class M2005(CreationModule):
class M2005(SedModule):
"""Maraston (2005) stellar emission module
This SED creation module convolves the SED star formation history with
......@@ -139,5 +139,5 @@ class M2005(CreationModule):
ssp.wavelength_grid,
young_spectrum)
# CreationModule to be returned by get_module
# SedModule to be returned by get_module
Module = M2005
......@@ -21,10 +21,10 @@ from collections import OrderedDict
import numpy as np
import scipy.constants as cst
from . import CreationModule
from . import SedModule
class MBB(CreationModule):
class MBB(SedModule):
"""One modified black body IR re-emission
Given an amount of attenuation (e.g. resulting from the action of a dust
......@@ -130,5 +130,5 @@ class MBB(CreationModule):
sed.add_contribution('dust.mbb', self.wave,
luminosity * self.epsilon * self.lumin_mbb)
#
# CreationModule to be returned by get_module
# SedModule to be returned by get_module
Module = MBB
......@@ -9,10 +9,10 @@ import numpy as np
import scipy.constants as cst
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
near-infrared. It includes both the nebular lines and the nubular
......@@ -174,5 +174,5 @@ class NebularEmission(CreationModule):
sed.add_contribution('nebular.continuum_young', cont.wave,
cont.lumin * NLy_young * self.conv_cont)
# CreationModule to be returned by get_module
# SedModule to be returned by get_module
Module = NebularEmission
......@@ -25,10 +25,10 @@ from collections import OrderedDict
import numpy as np
from . import CreationModule
from . import SedModule
class Param(CreationModule):
class Param(SedModule):
"""Other parameters
This module does not need any input.
......@@ -133,5 +133,5 @@ class Param(CreationModule):
True
)
# CreationModule to be returned by get_module
# SedModule to be returned by get_module
Module = Param
......@@ -22,10 +22,10 @@ from collections import OrderedDict
import numpy as np
import scipy.constants as cst
from . import CreationModule
from . import SedModule
class Radio(CreationModule):
class Radio(SedModule):
"""Radio emission
Given the number of Lyman photons, the module computes the free-free
......@@ -85,5 +85,5 @@ class Radio(CreationModule):
sed.add_contribution('radio_nonthermal', self.wave,
self.lumin_nonthermal * luminosity)
# CreationModule to be returned by get_module
# SedModule to be returned by get_module
Module = Radio
......@@ -25,7 +25,7 @@ from scipy.constants import parsec
from scipy.misc import factorial
from astropy.cosmology import WMAP7 as cosmology
from . import CreationModule
from . import SedModule
def igm_transmission(wavelength, redshift):
......@@ -135,7 +135,7 @@ def igm_transmission(wavelength, redshift):
return igm_transmission
class Redshifting(CreationModule):
class Redshifting(SedModule):
"""Redshift a SED
This module redshift a rest-frame SED. If the SED is already redshifted, an
......@@ -216,5 +216,5 @@ class Redshifting(CreationModule):
self.igm_attenuation[key] * sed.luminosity)
sed.add_module(self.name, self.parameters)
# CreationModule to be returned by get_module
# SedModule to be returned by get_module
Module = Redshifting
......@@ -15,10 +15,10 @@ This module implements the Schreiber et al. (2016) infra-red models.
from collections import OrderedDict
import numpy as np
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
Given an amount of attenuation (e.g. resulting from the action of a dust
......@@ -104,5 +104,5 @@ class Schreiber2016(CreationModule):
sed.add_contribution('dust.pah', self.model_pah.wave,
luminosity * self.model_pah.lumin)
# CreationModule to be returned by get_module
# SedModule to be returned by get_module
Module = Schreiber2016
......@@ -16,10 +16,10 @@ from collections import OrderedDict
import numpy as np
from . import CreationModule
from . import SedModule
class Sfh2Exp(CreationModule):
class Sfh2Exp(SedModule):
"""Double decreasing exponential Star Formation History
This module sets the SED star formation history (SFH) as a combination of
......@@ -119,5 +119,5 @@ class Sfh2Exp(CreationModule):
sed.add_info("sfh.f_burst", self.f_burst)
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
......@@ -25,10 +25,10 @@ from collections import OrderedDict
import numpy as np
from . import CreationModule
from . import SedModule
class SfhBuat08(CreationModule):
class SfhBuat08(SedModule):
"""Chemical evolution motivated Star Formation History
This module implements a chemical evolution motivated star formation
......@@ -101,5 +101,5 @@ class SfhBuat08(CreationModule):
sed.add_info("sfh.integrated", self.sfr_integrated, True)
sed.add_info("sfh.velocity", self.velocity)
# CreationModule to be returned by get_module
# SedModule to be returned by get_module
Module = SfhBuat08
......@@ -18,10 +18,10 @@ from collections import OrderedDict
import numpy as np
from . import CreationModule
from . import SedModule
class SfhQuench(CreationModule):
class SfhQuench(SedModule):
"""Star Formation History Quenching
This module implements a quenching of the Star Formation History.
......@@ -94,5 +94,5 @@ class SfhQuench(CreationModule):
sed.add_info("sfh.quenching_age", self.quenching_age)
sed.add_info("sfh.quenching_factor", self.quenching_factor)
# CreationModule to be returned by get_module
# SedModule to be returned by get_module
Module = SfhQuench
......@@ -17,10 +17,10 @@ from collections import OrderedDict
import numpy as np
from . import CreationModule
from . import SedModule
class SFHDelayed(CreationModule):
class SFHDelayed(SedModule):
"""Delayed tau model for Star Formation History
This module sets the SED star formation history (SFH) proportional to time,
......@@ -87,5 +87,5 @@ class SFHDelayed(CreationModule):
sed.add_info("sfh.integrated", self.sfr_integrated, True)
sed.add_info("sfh.tau_main", self.tau_main)
# CreationModule to be returned by get_module
# SedModule to be returned by get_module
Module = SFHDelayed
......@@ -16,10 +16,10 @@ from collections import OrderedDict
import numpy as np
from ..utils import read_table
from . import CreationModule
from . import SedModule
class SfhFromFile(CreationModule):
class SfhFromFile(SedModule):
"""Module reading the SFH from a file
This module is used to read the Star Formation Histories from a FITS or
......@@ -98,5 +98,5 @@ class SfhFromFile(CreationModule):
sed.add_info("sfh.integrated", self.sfr_integrated, True)
sed.add_info("sfh.index", self.sfr_column_number)
# CreationModule to be returned by get_module
# SedModule to be returned by get_module
Module = SfhFromFile
......@@ -18,10 +18,10 @@ from collections import OrderedDict
import numpy as np
from . import CreationModule
from . import SedModule
class SfhPeriodic(CreationModule):
class SfhPeriodic(SedModule):
"""Several regularly-spaced short delayed-SFH SF events
This module sets the SED star formation history (SFH) as a combination of
......@@ -122,5 +122,5 @@ class SfhPeriodic(CreationModule):
sed.add_info("sfh.delta_bursts", self.delta_bursts)
sed.add_info("sfh.tau_bursts", self.tau_bursts)
# CreationModule to be returned by get_module
# SedModule to be returned by get_module
Module = SfhPeriodic
......@@ -17,7 +17,7 @@ import validate
from ..handlers.parameters_handler import ParametersHandler
from ..data import Database
from ..utils import read_table
from .. import creation_modules
from .. import sed_modules
from .. import analysis_modules
from ..warehouse import SedWarehouse
from . import validation
......@@ -87,8 +87,8 @@ class Configuration(object):
"They will be given only for information.")
self.spec['parameters_file'] = "string()"
self.config['creation_modules'] = []
self.config.comments['creation_modules'] = ([""] +
self.config['sed_modules'] = []
self.config.comments['sed_modules'] = ([""] +
["Order of the modules use for SED creation. Available modules:"] +
["SFH: sfh2exp, sfhdelayed, sfhfromfile, sfhperiodic"] +
["SSP: bc03, m2005"] +
......@@ -98,7 +98,7 @@ class Configuration(object):
["AGN: dale2014, fritz2006"] +
["Radio: radio"] +
["Redshift: redshifting (mandatory!)"])
self.spec['creation_modules'] = "cigale_string_list()"
self.spec['sed_modules'] = "cigale_string_list()"
self.config['analysis_method'] = ""
self.config.comments['analysis_method'] = [""] + wrap(
......@@ -168,14 +168,14 @@ class Configuration(object):
"Configuration of the SED creation modules.")
self.spec['sed_modules_params'] = {}
for module_name in self.config['creation_modules']:
for module_name in self.config['sed_modules']:
self.config['sed_modules_params'][module_name] = {}
self.spec['sed_modules_params'][module_name] = {}
sub_config = self.config['sed_modules_params'][module_name]
sub_spec = self.spec['sed_modules_params'][module_name]
for name, (typ, description, default) in \
creation_modules.get_module(
sed_modules.get_module(
module_name,
blank=True).parameter_list.items():
if default is None:
......@@ -184,7 +184,7 @@ class Configuration(object):
sub_config.comments[name] = wrap(description)
sub_spec[name] = typ
self.config['sed_modules_params'].comments[module_name] = [
creation_modules.get_module(module_name, blank=True).comments]
sed_modules.get_module(module_name, blank=True).comments]
self.check_modules()
......@@ -271,7 +271,7 @@ class Configuration(object):
for module in modules:
if all([user_module not in modules[module] for user_module in
self.config['creation_modules']]):
self.config['sed_modules']]):
print("{} Options are: {}.".
format(comments[module], ', '.join(modules[module])))
......
......@@ -6,7 +6,7 @@
import marshal
from ..sed import SED
from .. import creation_modules
from .. import sed_modules
class SedWarehouse(object):
......@@ -52,7 +52,7 @@ class SedWarehouse(object):
Returns
-------
a pcigale.creation_modules.Module instance
a pcigale.sed_modules.Module instance
"""
# Marshal a tuple (name, parameters) to be used as a key for storing
......@@ -62,7 +62,7 @@ class SedWarehouse(object):
if module_key in self.module_cache:
module = self.module_cache[module_key]
else:
module = creation_modules.get_module(name, **kwargs)
module = sed_modules.get_module(name, **kwargs)
self.module_cache[module_key] = module
return module
......
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