dale2014.py 3.07 KB
Newer Older
1
# -*- coding: utf-8 -*-
Yannick Roehlly's avatar
Yannick Roehlly committed
2
# Copyright (C) 2013 Department of Physics, University of Crete
3
# Licensed under the CeCILL-v2 licence - see Licence_CeCILL_V2-en.txt
Yannick Roehlly's avatar
Yannick Roehlly committed
4
# Author: Laure Ciesla
5

Yannick Roehlly's avatar
Yannick Roehlly committed
6
7
8
9
10
11
12
13
"""
Dale et al. (2014) IR models module
===================================

This module implements the Dale (2014) infra-red models.

"""

14
15
from collections import OrderedDict
from pcigale.data import Database
16
from . import CreationModule
17
18


Yannick Roehlly's avatar
Yannick Roehlly committed
19
class Dale2014(CreationModule):
Yannick Roehlly's avatar
Yannick Roehlly committed
20
    """Dale et al. (2014) templates IR re-emission
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60

    Given an amount of attenuation (e.g. resulting from the action of a dust
    attenuation module) this module normalises the Dale et al (2014)
    template corresponding to a given α to this amount of energy and add it
    to the SED.

    Information added to the SED: NAME_fracAGN, NAME_alpha.

    """

    parameter_list = OrderedDict([
        ('fracAGN', (
            'float',
            "Contribution of the AGN",
            None
        )),
        ('alpha', (
            'float',
            "Alpha slope",
            None
        )),
        ('attenuation_value_keys', (
            'string',
            "Keys of the SED information dictionary where the module will "
            "look for the attenuation (in W) to re-emit. You can give several "
            "keys separated with a & (don't use commas), a re-emission "
            "contribution will be added for each key.",
            "attenuation"
        ))
    ])

    out_parameter_list = OrderedDict([
        ('fracAGN', 'Contribution of the AGN'),
        ('alpha', 'Alpha slope'),
        ('lir', 'Total IR luminosity between 8 and 1000 microns (AGN + SB)')
    ])

    def _init_code(self):
        """
        Get the models out of the database
61
62
63
64
        model_sb corresponds to an AGN fraction of 0%: only the dust heated by
        star formation
        model_quasar corresponds to an AGN fraction of 100%: only the SED of
        the quasar
65
66
67
68
        The energy attenuated is re-injected in model_sb only.
        """
        alpha = self.parameters["alpha"]

69
70
71
        with Database() as database:
            self.model_sb = database.get_dale2014(0.00, alpha)
            self.model_quasar = database.get_dale2014(1.00, alpha)
72
73
74
75
76
77
78
79
80
81

    def process(self, sed):
        """Add the IR re-emission contributions

        Parameters
        ----------
        sed  : pcigale.sed.SED object
        parameters : dictionary containing the parameters

        """
82
83
        if 'dust.luminosity' not in sed.info.keys():
            sed.add_info('dust.luminosity', 1., True)
84
        luminosity = sed.info['dust.luminosity']
85

86
        frac_agn = self.parameters["fracAGN"]
87

88
        sed.add_module(self.name, self.parameters)
89
90
91
92
93
94
95
        sed.add_info("agn.fracAGN", self.parameters["fracAGN"])
        sed.add_info("dust.alpha", self.parameters["alpha"])

        sed.add_contribution('dust', self.model_sb.wave,
                             luminosity * self.model_sb.lumin)
        sed.add_contribution('agn', self.model_quasar.wave,
                             frac_agn * luminosity * self.model_quasar.lumin)
Yannick Roehlly's avatar
Yannick Roehlly committed
96
97
98

# CreationModule to be returned by get_module
Module = Dale2014