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

bug fix C9_Catalog.py and ExtinctionMW.py

parent b8d16247
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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"]:
            MW_Av_arr = self.mw_ext.Av_from_Planck(ra=ra_arr, dec=dec_arr)
        else:
            MW_Av_arr = np.ones(len(ra_arr))
            MW_Av_arr = np.zeros(len(ra_arr))

        for igals in range(ngals):
            # # (TEST)
+3 −3
Original line number Diff line number Diff line
@@ -13,7 +13,7 @@ class ExtinctionMW(object):

    @staticmethod
    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):
        self.model_name = model_name
@@ -80,7 +80,7 @@ class ExtinctionMW(object):
        l, b = c.l.radian, c.b.radian
        NSIDE = hp.pixelfunc.get_nside(self.ebv_planck)
        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

    def apply_extinction(self, spec, Av=1.0):
@@ -91,6 +91,6 @@ class ExtinctionMW(object):
            raise ValueError(
                "Need to initialize the extinction model (init_ext_model) first")
        scale = 10**(-.4 * self.ext * Av)
        print("scale = ", scale)
        # print("scale = ", scale)
        spec *= scale
        return spec