Commit 3ef16837 authored by Médéric Boquien's avatar Médéric Boquien

Various small improvements to handle the Schreiber models.

parent 34be8f78
......@@ -665,40 +665,34 @@ def build_nebular(base):
base.add_nebular_continuum(models_cont)
base.add_nebular_lines(models_lines)
def build_schreiber2016(base):
models = []
schreiber2016_dir = os.path.join(os.path.dirname(__file__), 'schreiber2016/')
schreiber2016_dir = os.path.join(os.path.dirname(__file__),
'schreiber2016/')
print("Importing {}...".format(schreiber2016_dir + 'g15_pah.fits'))
pah = Table.read(schreiber2016_dir + 'g15_pah.fits')
print("Importing {}...".format(schreiber2016_dir + 'g15_dust.fits'))
dust = Table.read(schreiber2016_dir + 'g15_dust.fits')
# Getting the lambda grid for the templates and convert from microns to nm.
wave = dust[0][0][0] * 1E3
for td in range(15, 100, 1):
# Getting the lambda grid for the templates and convert from μm to nm.
wave = dust['LAM'][0, 0, :] * 1e3
for td in np.arange(15., 100.):
# Find the closest temperature in the model list of tdust
tsed = np.where(np.absolute(np.array(dust[0][6])-td) == np.min(np.absolute(np.array(dust[0][6])-td)))[0]
# The models are in nuFnu.
# We convert this to W/nm.
lumin_dust = dust[0][1][tsed] / wave
lumin_dust = lumin_dust[0]
#norm = np.trapz(lumin_dust, x=wave)
#lumin_dust /= norm
models.append(Schreiber2016(0, np.float(td), wave, lumin_dust))
# The models are in nuFnu.
# We convert this to W/nm.
lumin_pah = pah[0][1][tsed] / wave
lumin_pah = lumin_pah[0]
#norm = np.trapz(lumin_pah, x=wave)
#lumin_pah /= norm
models.append(Schreiber2016(1, np.float(td), wave, lumin_pah))
tsed = np.argmin(np.absolute(np.array(dust['TDUST'][0])-td))
# The models are in νFν. We convert this to W/nm.
lumin_dust = dust['SED'][0, tsed, :] / wave
lumin_pah = pah['SED'][0, tsed, :] / wave
models.append(Schreiber2016(0, td, wave, lumin_dust))
models.append(Schreiber2016(1, td, wave, lumin_pah))
base.add_schreiber2016(models)
def build_base():
base = Database(writable=True)
base.upgrade_base()
......
......@@ -39,7 +39,7 @@ class Schreiber2016(CreationModule):
'float',
"Mass fraction of PAH. "
"Between 0 and 1.",
0.1
0.05
))
])
......@@ -54,8 +54,8 @@ class Schreiber2016(CreationModule):
tdust = self.parameters["tdust"]
fpah = self.parameters["fpah"]
with Database() as database:
self.model_dust = database.get_schreiber2016(0,tdust)
self.model_pah = database.get_schreiber2016(1,tdust)
self.model_dust = database.get_schreiber2016(0, tdust)
self.model_pah = database.get_schreiber2016(1, tdust)
# The models in memory are in W/nm/kg. At the same time we
# need to normalize them to 1 W here to easily scale them from the
......@@ -67,7 +67,7 @@ class Schreiber2016(CreationModule):
self.emissivity = np.trapz((1. - fpah) * self.model_dust.lumin +
fpah * self.model_pah.lumin,
x=self.model_dust.wave)
# We want to be able to display the respective contributions of both
# components, therefore we keep they separately.
self.model_dust.lumin *= (1. - fpah) / self.emissivity
......
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