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
88b0874b
Commit
88b0874b
authored
Nov 03, 2015
by
Médéric Boquien
Browse files
Add the light-weight nebular module that absorbs the nebular continuum but does not emit anything.
parent
3ce03f73
Changes
2
Hide whitespace changes
Inline
Side-by-side
pcigale/creation_modules/nebular_noemission.py
0 → 100644
View file @
88b0874b
# -*- coding: utf-8 -*-
# Copyright (C) 2014 University of Cambridge
# Licensed under the CeCILL-v2 licence - see Licence_CeCILL_V2-en.txt
# Author: Médéric Boquien <mboquien@ast.cam.ac.uk>
from
collections
import
OrderedDict
import
numpy
as
np
import
scipy.constants
as
cst
from
pcigale.data
import
Database
from
.
import
CreationModule
class
NebularEmission
(
CreationModule
):
"""
Module computing the nebular emission from the ultraviolet to the
near-infrared. It includes both the nebular lines and the nubular
continuum. It takes into account the escape fraction and the absorption by
dust.
Given the number of Lyman continuum photons, we compute the Hβ line
luminosity. We then compute the other lines using the
metallicity-dependent templates that provide the ratio between individual
lines and Hβ. The nebular continuum is scaled directly from the number of
ionizing photons.
"""
parameter_list
=
OrderedDict
([
(
'f_esc'
,
(
'float'
,
"Fraction of Lyman continuum photons escaping the galaxy"
,
0.
)),
(
'f_dust'
,
(
'float'
,
"Fraction of Lyman continuum photons absorbed by dust"
,
0.
))
])
def
_init_code
(
self
):
"""Get the nebular emission lines out of the database and resample
them to see the line profile. Compute scaling coefficients.
"""
fesc
=
self
.
parameters
[
'f_esc'
]
fdust
=
self
.
parameters
[
'f_dust'
]
if
fesc
<
0.
or
fesc
>
1
:
raise
Exception
(
"Escape fraction must be between 0 and 1"
)
if
fdust
<
0
or
fdust
>
1
:
raise
Exception
(
"Fraction of lyman photons absorbed by dust must "
"be between 0 and 1"
)
if
fesc
+
fdust
>
1
:
raise
Exception
(
"Escape fraction+f_dust>1"
)
self
.
idx_Ly_break
=
None
self
.
absorbed_old
=
None
self
.
absorbed_young
=
None
def
process
(
self
,
sed
):
"""Add the nebular emission lines
Parameters
----------
sed: pcigale.sed.SED object
parameters: dictionary containing the parameters
"""
if
self
.
idx_Ly_break
is
None
:
self
.
idx_Ly_break
=
np
.
searchsorted
(
sed
.
wavelength_grid
,
91.
)
self
.
absorbed_old
=
np
.
zeros
(
sed
.
wavelength_grid
.
size
)
self
.
absorbed_young
=
np
.
zeros
(
sed
.
wavelength_grid
.
size
)
self
.
absorbed_old
[:
self
.
idx_Ly_break
]
-=
sed
.
get_lumin_contribution
(
'stellar.old'
)[:
self
.
idx_Ly_break
]
*
(
1.
-
self
.
parameters
[
'f_esc'
])
self
.
absorbed_young
[:
self
.
idx_Ly_break
]
-=
sed
.
get_lumin_contribution
(
'stellar.young'
)[:
self
.
idx_Ly_break
]
*
(
1.
-
self
.
parameters
[
'f_esc'
])
sed
.
add_module
(
self
.
name
,
self
.
parameters
)
sed
.
add_info
(
'nebular.f_esc'
,
self
.
parameters
[
'f_esc'
])
sed
.
add_info
(
'nebular.f_dust'
,
self
.
parameters
[
'f_dust'
])
sed
.
add_info
(
'dust.luminosity'
,
(
sed
.
info
[
'stellar.lum_ly_young'
]
+
sed
.
info
[
'stellar.lum_ly_old'
])
*
self
.
parameters
[
'f_dust'
],
True
)
sed
.
add_contribution
(
'nebular.absorption_old'
,
sed
.
wavelength_grid
,
self
.
absorbed_old
)
sed
.
add_contribution
(
'nebular.absorption_young'
,
sed
.
wavelength_grid
,
self
.
absorbed_young
)
# CreationModule to be returned by get_module
Module
=
NebularEmission
pcigale/session/configuration.py
View file @
88b0874b
...
@@ -132,7 +132,7 @@ class Configuration(object):
...
@@ -132,7 +132,7 @@ class Configuration(object):
[
"Order of the modules use for SED creation. Available modules:"
]
+
[
"Order of the modules use for SED creation. Available modules:"
]
+
[
"SFH: sfh2exp, sfhdelayed, sfhfromfile, sfhperiodic"
]
+
[
"SFH: sfh2exp, sfhdelayed, sfhfromfile, sfhperiodic"
]
+
[
"SSP: bc03, m2005"
]
+
[
"SSP: bc03, m2005"
]
+
[
"Nebular emission: nebular"
]
+
[
"Nebular emission: nebular
, nebular_noemission
"
]
+
[
"Dust attenuation: dustatt_calzleit, dustatt_powerlaw"
]
+
[
"Dust attenuation: dustatt_calzleit, dustatt_powerlaw"
]
+
[
"Dust emission: casey2012, dale2014, dl2007, dl2014"
]
+
[
"Dust emission: casey2012, dale2014, dl2007, dl2014"
]
+
[
"AGN: dale2014, fritz2006"
]
+
[
"AGN: dale2014, fritz2006"
]
+
...
@@ -219,7 +219,8 @@ class Configuration(object):
...
@@ -219,7 +219,8 @@ class Configuration(object):
self
.
config
[
'sed_creation_modules'
].
comments
[
module_name
]
=
[
self
.
config
[
'sed_creation_modules'
].
comments
[
module_name
]
=
[
creation_modules
.
get_module
(
module_name
,
blank
=
True
).
comments
]
creation_modules
.
get_module
(
module_name
,
blank
=
True
).
comments
]
if
'nebular'
not
in
self
.
config
[
'creation_modules'
]:
if
(
'nebular'
not
in
self
.
config
[
'creation_modules'
]
and
'nebular_noemission'
not
in
self
.
config
[
'creation_modules'
]):
print
(
"WARNING: no nebular module selected. The Lyman continuum "
print
(
"WARNING: no nebular module selected. The Lyman continuum "
"is left untouched."
)
"is left untouched."
)
...
...
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