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

minor fix in C3Catalog.py

parent 0fa8ebe9
Loading
Loading
Loading
Loading
+14 −11
Original line number Diff line number Diff line
@@ -30,13 +30,13 @@ class C3Catalog(CatalogBase):
        self.chip = chip
        self.pointing = pointing

        if "star_cat" in config["input_path"] and config["input_path"]["star_cat"]:
        if "star_cat" in config["input_path"] and config["input_path"]["star_cat"] and not config["galaxy_only"]:
            star_file = config["input_path"]["star_cat"]
            star_SED_file = config["SED_templates_path"]["star_SED"]
            self.star_path = os.path.join(self.cat_dir, star_file)
            self.star_SED_path = os.path.join(config["data_dir"], star_SED_file)
            self._load_SED_lib_star()
        if "galaxy_cat" in config["input_path"] and config["input_path"]["galaxy_cat"]:
        if "galaxy_cat" in config["input_path"] and config["input_path"]["galaxy_cat"] and not config["star_only"]:
            galaxy_file = config["input_path"]["galaxy_cat"]
            self.galaxy_path = os.path.join(self.cat_dir, galaxy_file)
            self.galaxy_SED_path = os.path.join(config["data_dir"], config["SED_templates_path"]["galaxy_SED"])
@@ -190,17 +190,20 @@ class C3Catalog(CatalogBase):
    def _load(self, **kwargs):
        self.nav = 15005
        self.avGal = extAv(self.nav, seed=self.seed_Av)
        gals_cat = h5.File(self.galaxy_path, 'r')['galaxies']
        star_cat = h5.File(self.star_path, 'r')['catalog']
        self.objs = []
        self.ids = 0
        if "star_cat" in self.config["input_path"] and self.config["input_path"]["star_cat"] and not self.config["galaxy_only"]:
            star_cat = h5.File(self.star_path, 'r')['catalog']
            for pix in self.pix_list:
            gals = gals_cat[str(pix)]
                stars = star_cat[str(pix)]
            self._load_gals(gals, pix_id=pix)
                self._load_stars(stars, pix_id=pix)
            del gals
                del stars
        if "galaxy_cat" in self.config["input_path"] and self.config["input_path"]["galaxy_cat"] and not self.config["star_only"]:
            gals_cat = h5.File(self.galaxy_path, 'r')['galaxies']
            for pix in self.pix_list:
                gals = gals_cat[str(pix)]
                self._load_gals(gals, pix_id=pix)
                del gals
        print("number of objects in catalog: ", len(self.objs))
        del self.avGal