dale2014.py 3.52 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

    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',
34
            "AGN fraction.",
35
            0.1
36
37
38
        )),
        ('alpha', (
            'float',
39
40
41
42
43
44
45
46
47
            "Alpha slope. Possible values are: 0.0625, 0.1250, 0.1875, "
            "0.2500, 0.3125, 0.3750, 0.4375, 0.5000, 0.5625, 0.6250, 0.6875, "
            "0.7500, 0.8125, 0.8750, 0.9375, 1.0000, 1.0625, 1.1250, 1.1875, "
            "1.2500, 1.3125, 1.3750, 1.4375, 1.5000, 1.5625, 1.6250, 1.6875, "
            "1.7500, 1.8125, 1.8750, 1.9375, 2.0000, 2.0625, 2.1250, 2.1875, "
            "2.2500, 2.3125, 2.3750, 2.4375, 2.5000, 2.5625, 2.6250, 2.6875, "
            "2.7500, 2.8125, 2.8750, 2.9375, 3.0000, 3.0625, 3.1250, 3.1875, "
            "3.2500, 3.3125, 3.3750, 3.4375, 3.5000, 3.5625, 3.6250, 3.6875, "
            "3.7500, 3.8125, 3.8750, 3.9375, 4.0000",
48
            2.
49
50
51
52
53
54
55
56
57
58
59
60
        ))
    ])

    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
        with Database() as database:
            self.model_sb = database.get_dale2014(0.00, alpha)
71
            self.model_quasar = database.get_dale2014(1.00, 0.0)
72
73
74
75
76
77

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

        Parameters
        ----------
78
79
        sed: pcigale.sed.SED object
        parameters: dictionary containing the parameters
80
81

        """
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
89
90
91
92
        if frac_agn < 1.:
            L_AGN = luminosity * (1./(1.-frac_agn) - 1.)
        else:
            raise Exception("AGN fraction is exactly 1. Behaviour "
                            "undefined.")
93

94
        sed.add_module(self.name, self.parameters)
95
96
97
98
99
100
        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,
101
                             L_AGN * self.model_quasar.lumin)
Yannick Roehlly's avatar
Yannick Roehlly committed
102
103
104

# CreationModule to be returned by get_module
Module = Dale2014