Commit ede4b339 authored by Laure Ciesla's avatar Laure Ciesla Committed by Yannick Roehlly

Updates on Fritz-- compute the AGN luminosity

parent 323e37b4
......@@ -547,13 +547,10 @@ 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], norm_scatt,
norm_agn, wave, lumin_therm, lumin_scatt,
lumin_agn))
params[1], params[0], psy[n], wave,
lumin_therm, lumin_scatt,lumin_agn))
def build_nebular(base):
......
......@@ -10,11 +10,11 @@ Fritz et al. (2006) AGN dust torus emission module
This module implements the Fritz et al. (2006) models.
"""
import numpy as np
from collections import OrderedDict
from pcigale.data import Database
from . import CreationModule
from pcigale.sed.cosmology import cosmology
class Fritz2006(CreationModule):
"""Fritz et al. (2006) AGN dust torus emission
......@@ -84,10 +84,10 @@ class Fritz2006(CreationModule):
out_parameter_list = OrderedDict([
('fracAGN', 'Contribution of the AGN'),
('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')
('agn.therm_luminosity', 'Luminosity of the AGN contribution due to the dust torus'),
('agn.scatt_luminosity', 'Luminosity of the AGN contribution due to the photon scattering'),
('agn.agn_luminosity', 'Luminosity of the AGN contribution due to the central source'),
('agn.luminosity', 'Total luminosity of the AGN contribution')
])
def _init_code(self):
......@@ -130,25 +130,28 @@ class Fritz2006(CreationModule):
# Compute the AGN luminosity
if 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
agn_power = luminosity * (1./(1.-fracAGN) - 1.)
l_agn_therm = agn_power
l_agn_scatt = np.trapz(agn_power * self.fritz2006.lumin_scatt, x=self.fritz2006.wave)
l_agn_agn = np.trapz(agn_power * self.fritz2006.lumin_agn, x=self.fritz2006.wave)
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_info('agn.therm_luminosity', l_agn_therm, True)
sed.add_info('agn.scatt_luminosity', l_agn_scatt, True)
sed.add_info('agn.agn_luminosity', l_agn_agn, True)
sed.add_info('agn.luminosity', l_agn_total, True)
sed.add_contribution('agn.fritz2006_therm', self.fritz2006.wave,
l_agn_therm * self.fritz2006.lumin_therm)
agn_power * self.fritz2006.lumin_therm)
sed.add_contribution('agn.fritz2006_scatt', self.fritz2006.wave,
l_agn_therm * self.fritz2006.lumin_scatt)
agn_power * self.fritz2006.lumin_scatt)
sed.add_contribution('agn.fritz2006_agn', self.fritz2006.wave,
l_agn_therm * self.fritz2006.lumin_agn)
agn_power * self.fritz2006.lumin_agn)
# CreationModule to be returned by get_module
Module = Fritz2006
......@@ -185,8 +185,6 @@ 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)
......@@ -199,8 +197,6 @@ 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
......@@ -684,7 +680,6 @@ 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, norm_scatt,
norm_agn, wave, lumin_therm, lumin_scatt, lumin_agn):
def __init__(self, r_ratio, tau, beta, gamma, opening_angle, psy, wave,
lumin_therm, lumin_scatt, lumin_agn):
"""Create a new AGN model
Parameters
......@@ -38,8 +38,6 @@ 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