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

Add a delayed SFH modules made by Véronique.

parent 4f4edf78
# Copyright (C) 2013 Centre de données Astrophysiques de Marseille
# Copyright (C) 2014 Laboratoire d'Astrophysique de Marseille
# Copyright (C) 2014 University of Cambridge
# Licensed under the CeCILL-v2 licence - see Licence_CeCILL_V2-en.txt
# Author: Yannick Roehlly, Véronique Buat & Médéric Boquien
"""
Delayed tau model for star formation history
============================================
This module implements a star formation history (SFH) described as a delayed
rise of the SFR up to a maximum, followed by an exponential decrease.
"""
import numpy as np
from collections import OrderedDict
from . import CreationModule
# Time lapse used in the age grid in Myr. If should be consistent with the
# time lapse in the SSP modules.
AGE_LAPSE = 1
class SFHDelayed(CreationModule):
"""Delayed tau model for Star Formation History
This module sets the SED star formation history (SFH) proportional to time,
with a declining exponential parametrised with a time-scale (tau_main).
"""
parameter_list = OrderedDict([
("tau_main", (
"float",
"e-folding time of the main stellar population model in Myr.",
None
)),
("age", (
"integer",
"Age of the oldest stars in the galaxy in Myr. The precision "
"is 1 Myr.",
None
))
])
out_parameter_list = OrderedDict([
("tau_main", "e-folding time of the main stellar population model "
"in Myr."),
("age", "Age of the oldest stars in the galaxy in Myr.")
])
def process(self, sed):
"""
Parameters
----------
sed : pcigale.sed.SED object
"""
tau_main = float(self.parameters["tau_main"])
age = int(self.parameters["age"])
# Time grid and age. If needed, the age is rounded to the inferior Myr
time_grid = np.arange(AGE_LAPSE, age + AGE_LAPSE, AGE_LAPSE)
# Main SFR
sfr = time_grid / tau_main**2 * np.exp(-time_grid / tau_main)
# We normalise the SFH to have one solar mass produced.
sfr = sfr / np.trapz(sfr * 1.e6, time_grid)
sed.add_module(self.name, self.parameters)
# Add the sfh and the output parameters to the SED.
sed.sfh = (time_grid, sfr)
sed.add_info("sfh.tau_main", tau_main)
# CreationModule to be returned by get_module
Module = SFHDelayed
......@@ -125,7 +125,7 @@ class Configuration(object):
self.config['creation_modules'] = []
self.config.comments['creation_modules'] = [""] + wrap(
"Order of the modules use for SED creation. Available modules:"
"SFH: sfh2exp, sfhfromfile ; "
"SFH: sfh2exp, sfhdelayed, sfhfromfile ; "
"SSP: bc03, m2005 ; "
"Nebular: nebular ; "
"Attenuation: dustatt_calzleit, dustatt_powerlaw ; "
......
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