Commit 17f0a820 authored by Guang's avatar Guang Committed by Guang
Browse files

fritz2006 optimized

parent d77db93d
......@@ -124,36 +124,11 @@ class Fritz2006(SedModule):
self.l_agn_agn = np.trapz(self.fritz2006.lumin_agn,
x=self.fritz2006.wave)
def process(self, sed):
"""Add the IR re-emission contributions
Parameters
----------
sed: pcigale.sed.SED object
parameters: dictionary containing the parameters
"""
if 'dust.luminosity' not in sed.info:
sed.add_info('dust.luminosity', 1., True)
luminosity = sed.info['dust.luminosity']
sed.add_module(self.name, self.parameters)
sed.add_info('agn.r_ratio', self.r_ratio)
sed.add_info('agn.tau', self.tau)
sed.add_info('agn.beta', self.beta)
sed.add_info('agn.gamma', self.gamma)
sed.add_info('agn.opening_angle', self.parameters["opening_angle"])
sed.add_info('agn.psy', self.psy)
sed.add_info('agn.fracAGN', self.fracAGN)
sed.add_info('agn.EBV', self.EBV)
sed.add_info('agn.temperature', self.temperature)
sed.add_info('agn.emissivity', self.emissivity)
# Apply polar-dust obscuration
# We define various constants necessary to compute the model. For
# consistency, we define the speed of light in nm s¯¹ rather than in
# m s¯¹.
c = cst.c * 1e9
self.c = cst.c * 1e9
lambda_0 = 200e3
# Calculate the extinction (SMC)
k_lam = 1.39*(self.fritz2006.wave/1e3)**-1.2-0.38
......@@ -171,10 +146,10 @@ class Fritz2006(SedModule):
x=self.fritz2006.wave) * \
(1 - np.sin( np.deg2rad(self.opening_angle/2.) ))
# Casey (2012) modified black body model
conv = c / (self.fritz2006.wave * self.fritz2006.wave)
conv = self.c / (self.fritz2006.wave * self.fritz2006.wave)
lumin_blackbody = (conv * (1. - np.exp(-(lambda_0 / self.fritz2006.wave)
** self.emissivity)) * (c / self.fritz2006.wave) ** 3. / (np.exp(
cst.h * c / (self.fritz2006.wave * cst.k * self.temperature)) - 1.))
** self.emissivity)) * (self.c / self.fritz2006.wave) ** 3. / (np.exp(
cst.h * self.c / (self.fritz2006.wave * cst.k * self.temperature)) - 1.))
lumin_blackbody *= l_ext / np.trapz(lumin_blackbody, x=self.fritz2006.wave)
# Add the black body to dust thermal emission
lumin_therm_new = self.fritz2006.lumin_therm + lumin_blackbody
......@@ -183,6 +158,46 @@ class Fritz2006(SedModule):
lumin_therm_new /= norm
lumin_scatt_new /= norm
lumin_agn_new /= norm
# Update fritz2006 lumin
self.fritz2006.lumin_therm = lumin_therm_new
self.fritz2006.lumin_scatt = lumin_scatt_new
self.fritz2006.lumin_agn = lumin_agn_new
# Integrate AGN luminosity for different components
self.l_agn_scatt = np.trapz(self.fritz2006.lumin_scatt, x=self.fritz2006.wave)
self.l_agn_agn = np.trapz(self.fritz2006.lumin_agn, x=self.fritz2006.wave)
# Intrinsic (de-reddened) AGN luminosity from the central source
self.l_agn_intrin_agn = np.trapz(self.fritz2006.lumin_intrin_agn, x=self.fritz2006.wave)
# Calculate L_lam(2500A)
self.l_agn_2500A = np.interp(250, self.fritz2006.wave, self.fritz2006.lumin_intrin_agn)
# Convert L_lam to L_nu
self.l_agn_2500A *= 250**2/self.c
def process(self, sed):
"""Add the IR re-emission contributions
Parameters
----------
sed: pcigale.sed.SED object
parameters: dictionary containing the parameters
"""
if 'dust.luminosity' not in sed.info:
sed.add_info('dust.luminosity', 1., True)
luminosity = sed.info['dust.luminosity']
sed.add_module(self.name, self.parameters)
sed.add_info('agn.r_ratio', self.r_ratio)
sed.add_info('agn.tau', self.tau)
sed.add_info('agn.beta', self.beta)
sed.add_info('agn.gamma', self.gamma)
sed.add_info('agn.opening_angle', self.parameters["opening_angle"])
sed.add_info('agn.psy', self.psy)
sed.add_info('agn.fracAGN', self.fracAGN)
sed.add_info('agn.EBV', self.EBV)
sed.add_info('agn.temperature', self.temperature)
sed.add_info('agn.emissivity', self.emissivity)
# Compute the AGN luminosity
if self.fracAGN < 1.:
......@@ -191,16 +206,8 @@ class Fritz2006(SedModule):
l_agn_scatt = agn_power * self.l_agn_scatt
l_agn_agn = agn_power * self.l_agn_agn
l_agn_total = l_agn_therm + l_agn_scatt + l_agn_agn
# Intrinsic (de-reddened) AGN luminosity from the central source
l_agn_intrin_agn = np.trapz(agn_power * self.fritz2006.lumin_intrin_agn,
x=self.fritz2006.wave)
# Intrinsic L_nu at rest-frame 2500A
# Calculate L_lam(2500A)
l_agn_2500A = np.interp(250, self.fritz2006.wave,
agn_power * self.fritz2006.lumin_intrin_agn)
# Convert L_lam to L_nu
l_agn_2500A *= 250**2/c
l_agn_intrin_agn = agn_power * self.l_agn_intrin_agn
l_agn_2500A = agn_power * self.l_agn_2500A
else:
raise Exception("AGN fraction is exactly 1. Behaviour "
"undefined.")
......@@ -213,11 +220,11 @@ class Fritz2006(SedModule):
sed.add_info('agn.agn_intrin_Lnu_2500A', l_agn_2500A, True)
sed.add_contribution('agn.fritz2006_therm', self.fritz2006.wave,
agn_power * lumin_therm_new)
agn_power * self.fritz2006.lumin_therm)
sed.add_contribution('agn.fritz2006_scatt', self.fritz2006.wave,
agn_power * lumin_scatt_new)
agn_power * self.fritz2006.lumin_scatt)
sed.add_contribution('agn.fritz2006_agn', self.fritz2006.wave,
agn_power * lumin_agn_new)
agn_power * self.fritz2006.lumin_agn)
# SedModule to be returned by get_module
......
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