From c5298bda8c7dc17c5e59273373f8aa875640f1c2 Mon Sep 17 00:00:00 2001 From: yuedong Date: Fri, 17 Dec 2021 18:28:05 +0800 Subject: [PATCH] add chip parameter to Catalog classes --- Catalog/C3Catalog.py | 7 ++----- Catalog/Catalog_example.py | 3 ++- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Catalog/C3Catalog.py b/Catalog/C3Catalog.py index f12436c..f28a193 100644 --- a/Catalog/C3Catalog.py +++ b/Catalog/C3Catalog.py @@ -15,7 +15,7 @@ from ObservationSim.MockObject._util import seds, sed_assign, extAv, tag_sed, ge NSIDE = 128 class C3Catalog(CatalogBase): - def __init__(self, config, **kwargs): + def __init__(self, config, chip, **kwargs): super().__init__() self.cat_dir = os.path.join(config["data_dir"], config["input_path"]["cat_dir"]) self.seed_Av = config["random_seeds"]["seed_Av"] @@ -24,10 +24,7 @@ class C3Catalog(CatalogBase): self.normF_star = Table.read(os.path.join(self.normalize_dir, 'SLOAN_SDSS.g.fits')) self.normF_galaxy = Table.read(os.path.join(self.normalize_dir, 'lsst_throuput_g.fits')) - try: - self.chip = kwargs["chip"] - except: - raise ValueError('For Cycle-3 Catalog class, must give a "chip" object to initiate') + self.chip = chip if "star_cat" in config["input_path"] and config["input_path"]["star_cat"]: star_file = config["input_path"]["star_cat"] diff --git a/Catalog/Catalog_example.py b/Catalog/Catalog_example.py index c8af865..d884f35 100644 --- a/Catalog/Catalog_example.py +++ b/Catalog/Catalog_example.py @@ -33,7 +33,7 @@ class Catalog_example(CatalogBase): load the filter throughput for the input catalog's photometric system. """ - def __init__(self, config, **kwargs): + def __init__(self, config, chip, **kwargs): """Constructor method. Parameters @@ -51,6 +51,7 @@ class Catalog_example(CatalogBase): super().__init__() self.cat_dir = os.path.join(config["data_dir"], config["input_path"]["cat_dir"]) + self.chip = chip if "star_cat" in config["input_path"] and config["input_path"]["star_cat"]: star_file = config["input_path"]["star_cat"] star_SED_file = config["SED_templates_path"]["star_SED"] -- GitLab