Commit e66531a3 authored by Fang Yuedong's avatar Fang Yuedong
Browse files

bug fix C9_Catalog.py and ExtinctionMW.py

parent b8d16247
...@@ -262,7 +262,7 @@ class Catalog(CatalogBase): ...@@ -262,7 +262,7 @@ class Catalog(CatalogBase):
if "enable_mw_ext_gal" in self.config["catalog_options"] and self.config["catalog_options"]["enable_mw_ext_gal"]: if "enable_mw_ext_gal" in self.config["catalog_options"] and self.config["catalog_options"]["enable_mw_ext_gal"]:
MW_Av_arr = self.mw_ext.Av_from_Planck(ra=ra_arr, dec=dec_arr) MW_Av_arr = self.mw_ext.Av_from_Planck(ra=ra_arr, dec=dec_arr)
else: else:
MW_Av_arr = np.ones(len(ra_arr)) MW_Av_arr = np.zeros(len(ra_arr))
for igals in range(ngals): for igals in range(ngals):
# # (TEST) # # (TEST)
......
...@@ -13,7 +13,7 @@ class ExtinctionMW(object): ...@@ -13,7 +13,7 @@ class ExtinctionMW(object):
@staticmethod @staticmethod
def radec2pix(ra, dec, NSIDE=2048): def radec2pix(ra, dec, NSIDE=2048):
return hp.pixelfunc.ang2pix(nside=NSIDE, theta=ra, phi=dec, nested=True, lonlat=True) return hp.pixelfunc.ang2pix(nside=NSIDE, theta=ra, phi=dec, nest=True, lonlat=True)
def init_ext_model(self, model_name="odonnell", Av=1.0, Rv=3.1, lamb=None): def init_ext_model(self, model_name="odonnell", Av=1.0, Rv=3.1, lamb=None):
self.model_name = model_name self.model_name = model_name
...@@ -80,7 +80,7 @@ class ExtinctionMW(object): ...@@ -80,7 +80,7 @@ class ExtinctionMW(object):
l, b = c.l.radian, c.b.radian l, b = c.l.radian, c.b.radian
NSIDE = hp.pixelfunc.get_nside(self.ebv_planck) NSIDE = hp.pixelfunc.get_nside(self.ebv_planck)
pix = hp.pixelfunc.ang2pix( pix = hp.pixelfunc.ang2pix(
nside=NSIDE, theta=np.pi/2. - b, phi=l, nested=True) nside=NSIDE, theta=np.pi/2. - b, phi=l, nest=True)
return self.ebv_planck[pix] * self.Rv return self.ebv_planck[pix] * self.Rv
def apply_extinction(self, spec, Av=1.0): def apply_extinction(self, spec, Av=1.0):
...@@ -91,6 +91,6 @@ class ExtinctionMW(object): ...@@ -91,6 +91,6 @@ class ExtinctionMW(object):
raise ValueError( raise ValueError(
"Need to initialize the extinction model (init_ext_model) first") "Need to initialize the extinction model (init_ext_model) first")
scale = 10**(-.4 * self.ext * Av) scale = 10**(-.4 * self.ext * Av)
print("scale = ", scale) # print("scale = ", scale)
spec *= scale spec *= scale
return spec return spec
Supports Markdown
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