Commit 2c1eaa56 authored by Fang Yuedong's avatar Fang Yuedong
Browse files

minor change in config files

parent ae6b8921
...@@ -30,13 +30,13 @@ class C3Catalog(CatalogBase): ...@@ -30,13 +30,13 @@ class C3Catalog(CatalogBase):
self.chip = chip self.chip = chip
self.pointing = pointing self.pointing = pointing
if "star_cat" in config["input_path"] and config["input_path"]["star_cat"] and not config["galaxy_only"]: if "star_cat" in config["input_path"] and config["input_path"]["star_cat"] and not config["run_option"]["galaxy_only"]:
star_file = config["input_path"]["star_cat"] star_file = config["input_path"]["star_cat"]
star_SED_file = config["SED_templates_path"]["star_SED"] star_SED_file = config["SED_templates_path"]["star_SED"]
self.star_path = os.path.join(self.cat_dir, star_file) 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.star_SED_path = os.path.join(config["data_dir"], star_SED_file)
self._load_SED_lib_star() self._load_SED_lib_star()
if "galaxy_cat" in config["input_path"] and config["input_path"]["galaxy_cat"] and not config["star_only"]: if "galaxy_cat" in config["input_path"] and config["input_path"]["galaxy_cat"] and not config["run_option"]["star_only"]:
galaxy_file = config["input_path"]["galaxy_cat"] galaxy_file = config["input_path"]["galaxy_cat"]
self.galaxy_path = os.path.join(self.cat_dir, galaxy_file) 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"]) self.galaxy_SED_path = os.path.join(config["data_dir"], config["SED_templates_path"]["galaxy_SED"])
...@@ -192,13 +192,13 @@ class C3Catalog(CatalogBase): ...@@ -192,13 +192,13 @@ class C3Catalog(CatalogBase):
self.avGal = extAv(self.nav, seed=self.seed_Av) self.avGal = extAv(self.nav, seed=self.seed_Av)
self.objs = [] self.objs = []
self.ids = 0 self.ids = 0
if "star_cat" in self.config["input_path"] and self.config["input_path"]["star_cat"] and not self.config["galaxy_only"]: if "star_cat" in self.config["input_path"] and self.config["input_path"]["star_cat"] and not self.config["run_option"]["galaxy_only"]:
star_cat = h5.File(self.star_path, 'r')['catalog'] star_cat = h5.File(self.star_path, 'r')['catalog']
for pix in self.pix_list: for pix in self.pix_list:
stars = star_cat[str(pix)] stars = star_cat[str(pix)]
self._load_stars(stars, pix_id=pix) self._load_stars(stars, pix_id=pix)
del stars del stars
if "galaxy_cat" in self.config["input_path"] and self.config["input_path"]["galaxy_cat"] and not self.config["star_only"]: if "galaxy_cat" in self.config["input_path"] and self.config["input_path"]["galaxy_cat"] and not self.config["run_option"]["star_only"]:
gals_cat = h5.File(self.galaxy_path, 'r')['galaxies'] gals_cat = h5.File(self.galaxy_path, 'r')['galaxies']
for pix in self.pix_list: for pix in self.pix_list:
gals = gals_cat[str(pix)] gals = gals_cat[str(pix)]
......
...@@ -123,11 +123,11 @@ class Observation(object): ...@@ -123,11 +123,11 @@ class Observation(object):
# if j >= 100: # if j >= 100:
# break # break
obj = self.cat.objs[j] obj = self.cat.objs[j]
if obj.type == 'star' and self.config["galaxy_only"]: if obj.type == 'star' and self.config["run_option"]["galaxy_only"]:
continue continue
elif obj.type == 'galaxy' and self.config["star_only"]: elif obj.type == 'galaxy' and self.config["run_option"]["star_only"]:
continue continue
elif obj.type == 'quasar' and self.config["star_only"]: elif obj.type == 'quasar' and self.config["run_option"]["star_only"]:
continue continue
# load SED # load SED
...@@ -185,9 +185,9 @@ class Observation(object): ...@@ -185,9 +185,9 @@ class Observation(object):
# Draw object & update output catalog # Draw object & update output catalog
try: try:
if self.config["out_cat_only"]: if self.config["run_option"]["out_cat_only"]:
isUpdated = True isUpdated = True
if chip.survey_type == "photometric" and not self.config["out_cat_only"]: if chip.survey_type == "photometric" and not self.config["run_option"]["out_cat_only"]:
isUpdated, pos_shear = obj.drawObj_multiband( isUpdated, pos_shear = obj.drawObj_multiband(
tel=self.tel, tel=self.tel,
pos_img=pos_img, pos_img=pos_img,
...@@ -199,7 +199,7 @@ class Observation(object): ...@@ -199,7 +199,7 @@ class Observation(object):
g2=obj.param["g2"], g2=obj.param["g2"],
exptime=pointing.exp_time exptime=pointing.exp_time
) )
elif chip.survey_type == "spectroscopic" and not self.config["out_cat_only"]: elif chip.survey_type == "spectroscopic" and not self.config["run_option"]["out_cat_only"]:
isUpdated, pos_shear = obj.drawObj_slitless( isUpdated, pos_shear = obj.drawObj_slitless(
tel=self.tel, tel=self.tel,
pos_img=pos_img, pos_img=pos_img,
......
...@@ -30,15 +30,15 @@ run_option: ...@@ -30,15 +30,15 @@ run_option:
# in order to config the number of threads to request from NAOC cluster # in order to config the number of threads to request from NAOC cluster
n_threads: 80 n_threads: 80
# Output catalog only? # Output catalog only?
# If yes, no imaging simulation will run # If yes, no imaging simulation will run
out_cat_only: NO out_cat_only: NO
# Only simulate stars? # Only simulate stars?
star_only: YES star_only: YES
# Only simulate galaxies? # Only simulate galaxies?
galaxy_only: NO galaxy_only: NO
############################################### ###############################################
# Observation setting # Observation setting
......
...@@ -28,16 +28,15 @@ run_option: ...@@ -28,16 +28,15 @@ run_option:
# simulation codes. It should be implemented later in the web frontend # simulation codes. It should be implemented later in the web frontend
# in order to config the number of threads to request from NAOC cluster # in order to config the number of threads to request from NAOC cluster
n_threads: 40 n_threads: 40
# Output catalog only?
# If yes, no imaging simulation will run
out_cat_only: NO
# Output catalog only? # Only simulate stars?
# If yes, no imaging simulation will run star_only: NO
out_cat_only: NO
# Only simulate stars? # Only simulate galaxies?
star_only: NO galaxy_only: NO
# Only simulate galaxies?
galaxy_only: NO
############################################### ###############################################
# Observation setting # Observation setting
......
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