Commit c9bcd4b5 authored by Guang's avatar Guang
Browse files

add intrinsic (de-reddend) central AGN luminosity for Fritz+06 model

parent ce2cbd84
......@@ -662,6 +662,19 @@ def build_fritz2006(base):
data = datafile.readlines()
datafile.close()
# Get intrinsic (de-reddened) AGN luminosity, i.e.,
# central AGN luminosity at psy=89.990
n = len(psy)-1
block = data[nskip + blocksize * n + 4 * (n + 1) - 1:
nskip + blocksize * (n+1) + 4 * (n + 1) - 1]
foo1, foo2, lumin_intrin_agn_unnormed = np.genfromtxt(
io.BytesIO("".join(block).encode()), usecols=(2, 3, 4),
unpack=True)
# Remove NaN for AGN luminosity
lumin_intrin_agn_unnormed = np.nan_to_num(lumin_intrin_agn_unnormed)
# Conversion from erg/s/microns to W/nm
lumin_intrin_agn_unnormed *= 1e-4
for n in range(len(psy)):
block = data[nskip + blocksize * n + 4 * (n + 1) - 1:
nskip + blocksize * (n+1) + 4 * (n + 1) - 1]
......@@ -681,10 +694,13 @@ def build_fritz2006(base):
lumin_therm /= norm
lumin_scatt /= norm
lumin_agn /= norm
# The intrinsic (de-reddened) AGN luminosity
lumin_intrin_agn = lumin_intrin_agn_unnormed/norm
models.append(Fritz2006(params[4], params[3], params[2],
params[1], params[0], psy[n], wave,
lumin_therm, lumin_scatt, lumin_agn))
lumin_therm, lumin_scatt, lumin_agn,
lumin_intrin_agn))
base.add_fritz2006(models)
......
......@@ -188,6 +188,7 @@ class _Fritz2006(BASE):
lumin_therm = Column(PickleType)
lumin_scatt = Column(PickleType)
lumin_agn = Column(PickleType)
lumin_intrin_agn = Column(PickleType)
def __init__(self, agn):
self.r_ratio = agn.r_ratio
......@@ -200,6 +201,7 @@ class _Fritz2006(BASE):
self.lumin_therm = agn.lumin_therm
self.lumin_scatt = agn.lumin_scatt
self.lumin_agn = agn.lumin_agn
self.lumin_intrin_agn = agn.lumin_intrin_agn
class _NebularLines(BASE):
......@@ -697,6 +699,9 @@ class Database(object):
in W/nm.
lumin_agn: array of float
Luminosity density of the central AGN at each wavelength in W/nm.
lumin_inrin_agn: array of float
Luminosity density of the intrinsic (de-reddened) central AGN
at each wavelength in W/nm.
Returns
......@@ -721,7 +726,8 @@ class Database(object):
return Fritz2006(result.r_ratio, result.tau, result.beta,
result.gamma, result.opening_angle, result.psy,
result.wave, result.lumin_therm,
result.lumin_scatt, result.lumin_agn)
result.lumin_scatt, result.lumin_agn,
result.lumin_intrin_agn)
else:
raise DatabaseLookupError(
"The Fritz2006 model is not in the database.")
......
......@@ -13,7 +13,7 @@ class Fritz2006(object):
"""
def __init__(self, r_ratio, tau, beta, gamma, opening_angle, psy, wave,
lumin_therm, lumin_scatt, lumin_agn):
lumin_therm, lumin_scatt, lumin_agn, lumin_intrin_agn):
"""Create a new AGN model
Parameters
......@@ -42,3 +42,4 @@ class Fritz2006(object):
self.lumin_therm = lumin_therm
self.lumin_scatt = lumin_scatt
self.lumin_agn = lumin_agn
self.lumin_intrin_agn = lumin_intrin_agn
......@@ -133,6 +133,9 @@ class Fritz2006(SedModule):
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
# 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)
else:
raise Exception("AGN fraction is exactly 1. Behaviour "
......@@ -142,6 +145,7 @@ class Fritz2006(SedModule):
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_info('agn.agn_intrin_luminosity', l_agn_intrin_agn, True)
sed.add_contribution('agn.fritz2006_therm', self.fritz2006.wave,
agn_power * self.fritz2006.lumin_therm)
......
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