Commit 0e229b7c authored by Laure Ciesla's avatar Laure Ciesla Committed by Yannick Roehlly

Compute the AGN luminosities

parent f96170f1
......@@ -547,10 +547,13 @@ def build_fritz2006(base):
lumin_therm = lumin_therm / norm
lumin_scatt = lumin_scatt / norm
lumin_agn = lumin_agn / norm
norm_scatt = np.trapz(lumin_scatt, x=wave)
norm_agn = np.trapz(lumin_agn, x=wave)
base.add_fritz2006(Fritz2006(params[4], params[3], params[2],
params[1], params[0], psy[n], wave,
lumin_therm, lumin_scatt, lumin_agn))
params[1], params[0], psy[n], norm_scatt,
norm_agn, wave, lumin_therm, lumin_scatt,
lumin_agn))
def build_nebular(base):
......
......@@ -84,7 +84,10 @@ class Fritz2006(CreationModule):
out_parameter_list = OrderedDict([
('fracAGN', 'Contribution of the AGN'),
('L_AGN', 'Luminosity of the AGN contribution')
('L_AGN_therm', 'Luminosity of the AGN contribution due to the dust torus'),
('L_AGN_scatt', 'Luminosity of the AGN contribution due to the photon scattering'),
('L_AGN_agn', 'Luminosity of the AGN contribution due to the central source'),
('L_AGN_tot', 'Total luminosity of the AGN contribution')
])
def _init_code(self):
......@@ -127,17 +130,25 @@ class Fritz2006(CreationModule):
# Compute the AGN luminosity
if fracAGN < 1.:
L_AGN = luminosity * (1./(1.-fracAGN) - 1.)
L_AGN_therm = luminosity * (1./(1.-fracAGN) - 1.)
L_AGN_scatt = self.fritz2006.norm_scatt * L_AGN_therm
L_AGN_agn = self.fritz2006.norm_agn * L_AGN_therm
L_AGN_total = L_AGN_therm + L_AGN_scatt + L_AGN_agn
else:
raise Exception("AGN fraction is exactly 1. Behaviour "
"undefined.")
sed.add_info('L_AGN_therm', L_AGN_therm)
sed.add_info('L_AGN_scatt', L_AGN_scatt)
sed.add_info('L_AGN_agn', L_AGN_agn)
sed.add_info('L_AGN_total', L_AGN_total)
sed.add_contribution('agn_fritz2006_therm', self.fritz2006.wave,
L_AGN * self.fritz2006.lumin_therm)
L_AGN_therm * self.fritz2006.lumin_therm)
sed.add_contribution('agn_fritz2006_scatt', self.fritz2006.wave,
L_AGN * self.fritz2006.lumin_scatt)
L_AGN_therm * self.fritz2006.lumin_scatt)
sed.add_contribution('agn_fritz2006_agn', self.fritz2006.wave,
L_AGN * self.fritz2006.lumin_agn)
L_AGN_therm * self.fritz2006.lumin_agn)
# CreationModule to be returned by get_module
Module = Fritz2006
......@@ -185,6 +185,8 @@ class _Fritz2006(BASE):
gamma = Column(Float, primary_key=True)
opening_angle = Column(Float, primary_key=True)
psy = Column(Float, primary_key=True)
norm_scatt = Column(PickleType)
norm_agn = Column(PickleType)
wave = Column(PickleType)
lumin_therm = Column(PickleType)
lumin_scatt = Column(PickleType)
......@@ -197,6 +199,8 @@ class _Fritz2006(BASE):
self.gamma = agn.gamma
self.opening_angle = agn.opening_angle
self.psy = agn.psy
self.norm_scatt = agn.norm_scatt
self.norm_agn = agn.norm_agn
self.wave = agn.wave
self.lumin_therm = agn.lumin_therm
self.lumin_scatt = agn.lumin_scatt
......@@ -680,6 +684,7 @@ class Database(object):
if result:
return Fritz2006(result.r_ratio, result.tau, result.beta,
result.gamma, result.opening_angle, result.psy,
result.norm_scatt, result.norm_agn,
result.wave, result.lumin_therm,
result.lumin_scatt, result.lumin_agn)
else:
......
......@@ -12,8 +12,8 @@ class Fritz2006(object):
"""
def __init__(self, r_ratio, tau, beta, gamma, opening_angle, psy, wave,
lumin_therm, lumin_scatt, lumin_agn):
def __init__(self, r_ratio, tau, beta, gamma, opening_angle, psy, norm_scatt,
norm_agn, wave, lumin_therm, lumin_scatt, lumin_agn):
"""Create a new AGN model
Parameters
......@@ -38,6 +38,8 @@ class Fritz2006(object):
self.gamma = gamma
self.opening_angle = opening_angle
self.psy = psy
self.norm_scatt
self.norm_agn
self.wave = wave
self.lumin_therm = lumin_therm
self.lumin_scatt = lumin_scatt
......
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