Commit 31c10684 authored by Guang's avatar Guang
Browse files

avoid inf in polar-dust reemission

parent 34b32cfc
......@@ -220,9 +220,15 @@ class Fritz2006(SedModule):
(1 - np.cos( np.deg2rad(self.opening_angle) ))
# Casey (2012) modified black body model
conv = self.c / (self.fritz2006.wave * self.fritz2006.wave)
lumin_blackbody = conv * (1. - np.exp(-(lambda_0 / self.fritz2006.wave)
** self.emissivity)) * (self.c / self.fritz2006.wave) ** 3. / (np.exp(
cst.h * self.c / (self.fritz2006.wave * cst.k * self.temperature)) - 1.)
# To avoid inf occurance in exponential, set blackbody=0 when h*c/lam*k*T is large
hc_lkt = cst.h * self.c / (self.fritz2006.wave * cst.k * self.temperature)
non_0_idxs = hc_lkt<100
# Generate the blackbody
lumin_blackbody = np.zeros(len(self.fritz2006.wave))
lumin_blackbody[non_0_idxs] = conv[non_0_idxs] * \
(1. - np.exp(-(lambda_0 / self.fritz2006.wave[non_0_idxs])** self.emissivity)) * \
(self.c / self.fritz2006.wave[non_0_idxs]) ** 3. / \
(np.exp(hc_lkt[non_0_idxs]) - 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
......
......@@ -87,7 +87,7 @@ class SKIRTOR2016(SedModule):
"Average edge-on optical depth at 9.7 micron; the actual one along"
"the line of sight may vary depending on the clumps distribution. "
"Possible values are: 3, 5, 7, 9, and 11.",
3
7
)),
('pl', (
"cigale_list(options=0. & .5 & 1. & 1.5)",
......@@ -201,9 +201,15 @@ class SKIRTOR2016(SedModule):
(0.4931 - 0.2113*sin_oa**2 - 0.2818*sin_oa**3)
# Casey (2012) modified black body model
conv = self.c / (self.SKIRTOR2016.wave * self.SKIRTOR2016.wave)
blackbody = conv * (1. - np.exp(-(lambda_0 / self.SKIRTOR2016.wave)
** self.emissivity)) * (self.c / self.SKIRTOR2016.wave) ** 3. / (np.exp(
cst.h * self.c / (self.SKIRTOR2016.wave * cst.k * self.temperature)) - 1.)
# To avoid inf occurance in exponential, set blackbody=0 when h*c/lam*k*T is large
hc_lkt = cst.h * self.c / (self.SKIRTOR2016.wave * cst.k * self.temperature)
non_0_idxs = hc_lkt<100
# Generate the blackbody
blackbody = np.zeros(len(self.SKIRTOR2016.wave))
blackbody[non_0_idxs] = conv[non_0_idxs] * \
(1. - np.exp(-(lambda_0 / self.SKIRTOR2016.wave[non_0_idxs])** self.emissivity)) * \
(self.c / self.SKIRTOR2016.wave[non_0_idxs]) ** 3. / \
(np.exp(hc_lkt[non_0_idxs]) - 1.)
blackbody *= l_ext / np.trapz(blackbody, x=self.SKIRTOR2016.wave)
# Add the black body to dust thermal emission
dust_new = self.SKIRTOR2016.dust + blackbody
......
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