param.py 4.71 KB
Newer Older
BURGARELLA Denis's avatar
BURGARELLA Denis committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# -*- coding: utf-8 -*-
# Copyright (C) 2015 Laboratoire d'Astrophysique de Marseille
# Licensed under the CeCILL-v2 licence - see Licence_CeCILL_V2-en.txt
# Author: Denis Burgarella

"""
Module that estimates other parameters, e.g., UV slope, Lick indices, etc.
==========================================================================

This module estimates additional parameters of interest
close to the observation, e.g., the ultraviolet slope (beta), the rest-frame
far-ultraviolet luminosity, any type of indices (Lick), etc.
This module will be the last one (after redshifting) to account
for all the physical processes at play to build the received total emission.

"""

18
from collections import OrderedDict
19

BURGARELLA Denis's avatar
BURGARELLA Denis committed
20
import numpy as np
21

BURGARELLA Denis's avatar
BURGARELLA Denis committed
22
23
24
25
26
27
28
29
30
31
32
33
from . import CreationModule


class Param(CreationModule):
    """Other parameters

    This module does not need any input.
    It computes some parameters from the models:
    beta_UV, Lum_UV, etc.

    """

34
    parameter_list = OrderedDict([
35
36
37
38
39
40
        ("OK", (
            "boolean",
            "Are you here?.",
            "True"
        ))
    ])
BURGARELLA Denis's avatar
BURGARELLA Denis committed
41
42
43
44
45
46
47
48
49
50
51
52
53
54

    def process(self, sed):
        """Computes the parameters for each model.

        Parameters
        ----------
        sed: pcigale.sed.SED object

        """
        # Retrieve the final computed SED using all the previous modules
        # including the IGM and the redshifting. In other words,
        # this module must be the last one. Note that it does require
        # an SFH and an SSP module but nothing else (except redshifting)

Médéric Boquien's avatar
Médéric Boquien committed
55
        redshift = sed.info['universe.redshift']
BURGARELLA Denis's avatar
BURGARELLA Denis committed
56
57
58
59
60
        # Wavelengths are in nanometers.
        wavelength = sed.wavelength_grid
        # Luminosity is is W/nm.
        luminosity = sed.luminosity

Médéric Boquien's avatar
Médéric Boquien committed
61
62
63
        # Attenuated (observed) UV slopes beta as defined in Calzetti et al.
        # (1994, ApJ 429, 582, Tab. 2) that excludes the 217.5 nm bump
        # wavelength range and other spectral features
BURGARELLA Denis's avatar
BURGARELLA Denis committed
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89

        w_calz94 = np.where((wavelength >= 126.8 * (1. + redshift)) &
                            (wavelength <= 128.4 * (1. + redshift)) |
                            (wavelength >= 130.9 * (1. + redshift)) &
                            (wavelength <= 131.6 * (1. + redshift)) |
                            (wavelength >= 134.2 * (1. + redshift)) &
                            (wavelength <= 137.1 * (1. + redshift)) |
                            (wavelength >= 140.7 * (1. + redshift)) &
                            (wavelength <= 151.5 * (1. + redshift)) |
                            (wavelength >= 156.2 * (1. + redshift)) &
                            (wavelength <= 158.3 * (1. + redshift)) |
                            (wavelength >= 167.7 * (1. + redshift)) &
                            (wavelength <= 174.0 * (1. + redshift)) |
                            (wavelength >= 176.0 * (1. + redshift)) &
                            (wavelength <= 183.3 * (1. + redshift)) |
                            (wavelength >= 186.6 * (1. + redshift)) &
                            (wavelength <= 189.0 * (1. + redshift)) |
                            (wavelength >= 193.0 * (1. + redshift)) &
                            (wavelength <= 195.0 * (1. + redshift)) |
                            (wavelength >= 240.0 * (1. + redshift)) &
                            (wavelength <= 258.0 * (1. + redshift)))

        # Attenuated (observed) FUV luminosity L_FUV, in the GALEX FUV band,
        # i.e., lambda_eff = 152.8 nm and effective bandwidth = 11.4 nm

        w_FUV = np.where((wavelength >= (152.8 - 11.4) * (1. + redshift)) &
Médéric Boquien's avatar
Médéric Boquien committed
90
                         (wavelength <= (152.8 + 11.4) * (1. + redshift)))
BURGARELLA Denis's avatar
BURGARELLA Denis committed
91

Médéric Boquien's avatar
Médéric Boquien committed
92
93
94
95
        # Strength of the D_4000 break using Balogh et al. (1999, ApJ 527, 54),
        # i.e., ratio of the flux in the red continuum to that in the blue
        # continuum: Blue continuum: 385.0-395.0 nm & red continuum:
        # 410.0-410.0 nm.
BURGARELLA Denis's avatar
BURGARELLA Denis committed
96
97
98
99
100
101
102

        w_D4000blue = np.where((wavelength >= 385.0 * (1. + redshift)) &
                               (wavelength <= 395.0 * (1. + redshift)))
        w_D4000red  = np.where((wavelength >= 400.0 * (1. + redshift)) &
                               (wavelength <= 410.0 * (1. + redshift)))

        regression_calz94 = np.polyfit(np.log10(10.*wavelength[w_calz94]),
Médéric Boquien's avatar
Médéric Boquien committed
103
104
                                       np.log10(1e7/10.*luminosity[w_calz94]),
                                       1)
BURGARELLA Denis's avatar
BURGARELLA Denis committed
105
106
107
108
        beta_calz94 = regression_calz94[0]

        L_FUV = 152.8*(1. + redshift)*np.mean(luminosity[w_FUV])

Médéric Boquien's avatar
Médéric Boquien committed
109
110
        D_4000 = (np.mean(luminosity[w_D4000red]) /
                  np.mean(luminosity[w_D4000blue]))
BURGARELLA Denis's avatar
BURGARELLA Denis committed
111
112
113
114
115
116
117

        sed.add_info("param.beta_calz94", beta_calz94)
        sed.add_info("param.FUV_luminosity", L_FUV, True)
        sed.add_info("param.D_4000", D_4000)

# CreationModule to be returned by get_module
Module = Param