dale2014.py 3.46 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
from collections import OrderedDict
15

16
from pcigale.data import Database
17
from . import CreationModule
18
19


Yannick Roehlly's avatar
Yannick Roehlly committed
20
class Dale2014(CreationModule):
Yannick Roehlly's avatar
Yannick Roehlly committed
21
    """Dale et al. (2014) templates IR re-emission
22
23
24
25
26
27

    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.

28
    Information added to the SED: agn.fracAGN_dale2014, dust.alpha.
29
30
31

    """

32
    parameter_list = OrderedDict([
33
34
        ('fracAGN', (
            'float',
Médéric Boquien's avatar
Médéric Boquien committed
35
36
            "AGN fraction. It is not recommended to combine this AGN emission "
            "with the of Fritz et al. (2006) models.",
37
            0.0
38
39
40
        )),
        ('alpha', (
            'float',
41
42
43
44
45
46
47
48
49
            "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",
50
            2.
51
52
53
54
55
56
        ))
    ])

    def _init_code(self):
        """
        Get the models out of the database
57
58
59
60
        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
61
62
63
64
        The energy attenuated is re-injected in model_sb only.
        """
        alpha = self.parameters["alpha"]

65
66
        with Database() as database:
            self.model_sb = database.get_dale2014(0.00, alpha)
67
            self.model_quasar = database.get_dale2014(1.00, 0.0)
68
69
70
71
72
73

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

        Parameters
        ----------
74
75
        sed: pcigale.sed.SED object
        parameters: dictionary containing the parameters
76
77

        """
78
        if 'dust.luminosity' not in sed.info:
79
            sed.add_info('dust.luminosity', 1., True)
80
        luminosity = sed.info['dust.luminosity']
81

82
        frac_agn = self.parameters["fracAGN"]
Médéric Boquien's avatar
Médéric Boquien committed
83

84
85
86
87
88
        if frac_agn < 1.:
            L_AGN = luminosity * (1./(1.-frac_agn) - 1.)
        else:
            raise Exception("AGN fraction is exactly 1. Behaviour "
                            "undefined.")
89

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

        sed.add_contribution('dust', self.model_sb.wave,
                             luminosity * self.model_sb.lumin)
96
97
        if frac_agn != 0.:
            sed.add_contribution('agn', self.model_quasar.wave,
Médéric Boquien's avatar
Médéric Boquien committed
98
                                 L_AGN * self.model_quasar.lumin)
Yannick Roehlly's avatar
Yannick Roehlly committed
99
100
101

# CreationModule to be returned by get_module
Module = Dale2014