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
eccc08b7
Commit
eccc08b7
authored
Oct 09, 2014
by
BURGARELLA Denis
Browse files
Add multiplicative constants to SFH
parent
2dafd027
Changes
2
Show whitespace changes
Inline
Side-by-side
pcigale/creation_modules/sfh2exp.py
View file @
eccc08b7
...
...
@@ -47,15 +47,24 @@ class Sfh2Exp(CreationModule):
)),
(
"age"
,
(
"integer"
,
"Age of the
oldest stars
in the galaxy in Myr.
The precision
"
"is 1 Myr."
,
13
000.
"Age of the
main stellar population
in the galaxy in Myr."
"
The precision
is 1 Myr."
,
5
000.
)),
(
"burst_age"
,
(
"integer"
,
"Age of the late burst in Myr. Precision is 1 Myr."
,
20.
))
(
"SFR_0"
,
(
"float"
,
"Value of SFR[M_sun/yr] at t = 0"
,
1.
)),
(
"normalise"
,
(
"boolean"
,
"Normalise the SFH to produce one solar mass."
,
"False"
])
out_parameter_list
=
OrderedDict
([
...
...
@@ -64,8 +73,9 @@ class Sfh2Exp(CreationModule):
(
"tau_burst"
,
"e-folding time of the late starburst population model "
"in Myr."
),
(
"f_burst"
,
"Produced mass fraction of the late burst population."
),
(
"age"
,
"Age of the
oldest stars
in the galaxy in Myr."
),
(
"age"
,
"Age of the
main stellar population
in the galaxy in Myr."
),
(
"burst_age"
,
"Age of the late burst in Myr."
)
(
"sfr_0"
,
"SFR at t = 0 in M_sun/yr."
)
])
def
process
(
self
,
sed
):
...
...
@@ -81,13 +91,15 @@ class Sfh2Exp(CreationModule):
f_burst
=
float
(
self
.
parameters
[
"f_burst"
])
age
=
int
(
self
.
parameters
[
"age"
])
burst_age
=
int
(
self
.
parameters
[
"burst_age"
])
sfr_0
=
int
(
self
.
parameters
[
"sfr_0"
])
normalise
=
(
self
.
parameters
[
"normalise"
].
lower
()
==
"true"
)
# 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
)
age
=
np
.
max
(
time_grid
)
# Main exponential
sfr
=
np
.
exp
(
-
time_grid
/
tau_main
)
sfr
=
sfr_0
*
np
.
exp
(
-
time_grid
/
tau_main
)
# Height of the late burst to have the desired produced mass fraction
# (assuming that the main burst as a height of 1).
...
...
@@ -100,7 +112,8 @@ class Sfh2Exp(CreationModule):
sfr
[
mask
]
=
sfr
[
mask
]
+
burst_height
*
np
.
exp
(
(
-
time_grid
[
mask
]
+
age
-
burst_age
)
/
tau_burst
)
# We normalise the SFH to have one solar mass produced.
# Normalise the SFH to 1 solar mass produced if asked to.
if
normalise
:
sfr
=
sfr
/
np
.
trapz
(
sfr
*
1e6
,
time_grid
)
sed
.
add_module
(
self
.
name
,
self
.
parameters
)
...
...
pcigale/creation_modules/sfhdelayed.py
View file @
eccc08b7
...
...
@@ -42,12 +42,23 @@ class SFHDelayed(CreationModule):
"is 1 Myr."
,
None
))
(
"SFR_A"
,
(
"float"
,
"Multiplicative factor controlling the amplitude of SFR."
,
1.
)),
(
"normalise"
,
(
"boolean"
,
"Normalise the SFH to produce one solar mass."
,
"False"
))
])
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."
)
(
"sfr_A"
,
"Multiplicative factor controlling the amplitude of SFR."
)
])
def
process
(
self
,
sed
):
...
...
@@ -59,15 +70,18 @@ class SFHDelayed(CreationModule):
"""
tau_main
=
float
(
self
.
parameters
[
"tau_main"
])
age
=
int
(
self
.
parameters
[
"age"
])
sfr_A
=
int
(
self
.
parameters
[
"sfr_A"
])
normalise
=
(
self
.
parameters
[
"normalise"
].
lower
()
==
"true"
)
# 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
)
sfr
=
sfr_A
*
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
)
# Normalise the SFH to 1 solar mass produced if asked to.
if
normalise
:
sfr
=
sfr
/
np
.
trapz
(
sfr
*
1e6
,
time_grid
)
sed
.
add_module
(
self
.
name
,
self
.
parameters
)
...
...
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