Commit 30b11265 authored by Yannick Roehlly's avatar Yannick Roehlly
Browse files

Prepare the possibility to compute continuum only fluxes

Prepare to make it possible to get the flux in a filter without taking
into account the contribution from the spectral lines.
parent 272c8703
...@@ -39,7 +39,6 @@ Such SED is characterised by: ...@@ -39,7 +39,6 @@ Such SED is characterised by:
import numpy as np import numpy as np
from . import utils from . import utils
from itertools import chain
from scipy.constants import c from scipy.constants import c
from scipy.interpolate import interp1d from scipy.interpolate import interp1d
...@@ -309,7 +308,8 @@ class SED(object): ...@@ -309,7 +308,8 @@ class SED(object):
return self.luminosities[idx] return self.luminosities[idx]
def compute_fnu(self, transmission, lambda_eff, def compute_fnu(self, transmission, lambda_eff,
redshift=0, apply_redshift=False): redshift=0, apply_redshift=False,
add_line_fluxes=True):
""" """
Compute the Fν flux density corresponding the filter which Compute the Fν flux density corresponding the filter which
transmission is given. transmission is given.
...@@ -349,6 +349,10 @@ class SED(object): ...@@ -349,6 +349,10 @@ class SED(object):
flux. The default is False because we generally use a specific flux. The default is False because we generally use a specific
module to apply the redshift. module to apply the redshift.
add_line_flux : boolean
If true (default), the flux coming from the spectral lines will be
taken into account.
Return Return
------ ------
fnu : float fnu : float
......
...@@ -275,12 +275,13 @@ class Module(common.SEDCreationModule): ...@@ -275,12 +275,13 @@ class Module(common.SEDCreationModule):
powerlaw_slope = float(self.parameters["powerlaw_slope"]) powerlaw_slope = float(self.parameters["powerlaw_slope"])
filters = self.filters filters = self.filters
# Fλ fluxes in each filter before attenuation. # Fλ fluxes (only from continuum) in each filter before attenuation.
flux_noatt = {} flux_noatt = {}
for filter_name, filter_ in filters.items(): for filter_name, filter_ in filters.items():
flux_noatt[filter_name] = sed.compute_fnu( flux_noatt[filter_name] = sed.compute_fnu(
filter_.trans_table, filter_.trans_table,
filter_.effective_wavelength) filter_.effective_wavelength,
add_line_fluxes=False)
# Compute attenuation curve # Compute attenuation curve
sel_attenuation = a_vs_ebv(wavelength, uv_bump_wavelength, sel_attenuation = a_vs_ebv(wavelength, uv_bump_wavelength,
...@@ -340,12 +341,13 @@ class Module(common.SEDCreationModule): ...@@ -340,12 +341,13 @@ class Module(common.SEDCreationModule):
sed.add_info(name + "_attenuation", sed.add_info(name + "_attenuation",
attenuation_young + attenuation_old) attenuation_young + attenuation_old)
# Fλ fluxes in each filter after attenuation. # Fλ fluxes (only from continuum) in each filter after attenuation.
flux_att = {} flux_att = {}
for filter_name, filter_ in filters.items(): for filter_name, filter_ in filters.items():
flux_att[filter_name] = sed.compute_fnu( flux_att[filter_name] = sed.compute_fnu(
filter_.trans_table, filter_.trans_table,
filter_.effective_wavelength) filter_.effective_wavelength,
add_line_fluxes=False)
# Attenuation in each filter # Attenuation in each filter
for filter_name in filters: for filter_name in filters:
......
...@@ -196,12 +196,13 @@ class Module(common.SEDCreationModule): ...@@ -196,12 +196,13 @@ class Module(common.SEDCreationModule):
powerlaw_slope = float(self.parameters["powerlaw_slope"]) powerlaw_slope = float(self.parameters["powerlaw_slope"])
filters = self.filters filters = self.filters
# Fλ fluxes in each filter before attenuation. # Fλ fluxes (only from continuum)) in each filter before attenuation.
flux_noatt = {} flux_noatt = {}
for filter_name, filter_ in filters.items(): for filter_name, filter_ in filters.items():
flux_noatt[filter_name] = sed.compute_fnu( flux_noatt[filter_name] = sed.compute_fnu(
filter_.trans_table, filter_.trans_table,
filter_.effective_wavelength) filter_.effective_wavelength,
add_line_fluxes=False)
# Compute attenuation curve # Compute attenuation curve
sel_attenuation = alambda_av(wavelength, powerlaw_slope, sel_attenuation = alambda_av(wavelength, powerlaw_slope,
...@@ -259,12 +260,13 @@ class Module(common.SEDCreationModule): ...@@ -259,12 +260,13 @@ class Module(common.SEDCreationModule):
sed.add_info(name + "_attenuation", sed.add_info(name + "_attenuation",
attenuation_young + attenuation_old) attenuation_young + attenuation_old)
# Fλ fluxes in each filter after attenuation. # Fλ fluxes (only in continuum) in each filter after attenuation.
flux_att = {} flux_att = {}
for filter_name, filter_ in filters.items(): for filter_name, filter_ in filters.items():
flux_att[filter_name] = sed.compute_fnu( flux_att[filter_name] = sed.compute_fnu(
filter_.trans_table, filter_.trans_table,
filter_.effective_wavelength) filter_.effective_wavelength,
add_line_fluxes=False)
# Attenuation in each filter # Attenuation in each filter
for filter_name in filters: for filter_name in filters:
......
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