Commit 712235c0 authored by Médéric Boquien's avatar Médéric Boquien
Browse files

Have the nebular module compute and store the intrinsic line luminosities....

Have the nebular module compute and store the intrinsic line luminosities. That way they can be fitted as any flux.
parent 90923e9d
......@@ -4,6 +4,7 @@
# Author: Médéric Boquien <>
from collections import OrderedDict
from copy import deepcopy
import numpy as np
import scipy.constants as cst
......@@ -11,6 +12,34 @@ import scipy.constants as cst
from import Database
from . import SedModule
default_lines = ['Ly-alpha',
class NebularEmission(SedModule):
......@@ -80,14 +109,16 @@ class NebularEmission(SedModule):
if self.emission:
with Database() as db:
metallicities = db.get_nebular_continuum_parameters()['metallicity']
self.lines_template = {m: db.get_nebular_lines(m, self.logU)
for m in db.get_nebular_lines_parameters()
for m in metallicities}
self.cont_template = {m: db.get_nebular_continuum(m, self.logU)
for m in db.get_nebular_continuum_parameters()
for m in metallicities}
self.linesdict = {m: dict(zip(self.lines_template[m].name,
for m in metallicities}
for lines in self.lines_template.values():
new_wave = np.array([])
......@@ -155,12 +186,21 @@ class NebularEmission(SedModule):
if self.emission:
NLy_old =['stellar.n_ly_old']
NLy_young =['stellar.n_ly_young']
lines = self.lines_template[['stellar.metallicity']]
cont = self.cont_template[['stellar.metallicity']]
NLy_tot = NLy_old + NLy_young
metallicity =['stellar.metallicity']
lines = self.lines_template[metallicity]
linesdict = self.linesdict[metallicity]
cont = self.cont_template[metallicity]
sed.add_info('nebular.lines_width', self.lines_width)
sed.add_info('nebular.logU', self.logU)
for line in default_lines:
wave, ratio = linesdict[line]
sed.lines[line] = (wave,
ratio * NLy_old * self.corr,
ratio * NLy_young * self.corr)
sed.add_contribution('nebular.lines_old', lines.wave,
lines.ratio * NLy_old * self.corr)
sed.add_contribution('nebular.lines_young', lines.wave,
Supports Markdown
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