Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
cigale
CIGALE
Commits
bcd8c258
Commit
bcd8c258
authored
Apr 23, 2014
by
Médéric Boquien
Browse files
Add a delayed SFH modules made by Véronique.
parent
4f4edf78
Changes
2
Hide whitespace changes
Inline
Side-by-side
pcigale/creation_modules/sfhdelayed.py
0 → 100644
View file @
bcd8c258
# 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
pcigale/session/configuration.py
View file @
bcd8c258
...
...
@@ -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 ; "
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment