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

add "obs_config_file" in the overall config to overrite the obs_config from pointing list

parent f50e86f3
...@@ -6,7 +6,7 @@ from astropy.time import Time ...@@ -6,7 +6,7 @@ from astropy.time import Time
import ObservationSim.Instrument._util as _util import ObservationSim.Instrument._util as _util
class Pointing(object): class Pointing(object):
def __init__(self, id=0, ra=0., dec=0., img_pa=0., timestamp=1621915200, sat_x=0., sat_y=0., sat_z=0., sun_x=0., sun_y=0., sun_z=0., sat_vx=0., sat_vy=0., sat_vz=0., exp_time=150., pointing_type='SCI'): def __init__(self, id=0, ra=0., dec=0., img_pa=0., timestamp=1621915200, sat_x=0., sat_y=0., sat_z=0., sun_x=0., sun_y=0., sun_z=0., sat_vx=0., sat_vy=0., sat_vz=0., exp_time=150., pointing_type='SCI', obs_config_file=None):
self.id = id self.id = id
self.ra = ra self.ra = ra
self.dec = dec self.dec = dec
...@@ -19,6 +19,7 @@ class Pointing(object): ...@@ -19,6 +19,7 @@ class Pointing(object):
self.pointing_type = pointing_type self.pointing_type = pointing_type
self.survey_field_type = 'WIDE' self.survey_field_type = 'WIDE'
self.jdt = 0. self.jdt = 0.
self.obs_config_file = obs_config_file
def get_full_depth_exptime(self, filter_type): def get_full_depth_exptime(self, filter_type):
if self.survey_field_type == 'WIDE': if self.survey_field_type == 'WIDE':
...@@ -70,9 +71,10 @@ class Pointing(object): ...@@ -70,9 +71,10 @@ class Pointing(object):
if is_deep != -1.0: if is_deep != -1.0:
self.survey_field_type = "DEEP" self.survey_field_type = "DEEP"
if not self.obs_config_file:
self.obs_config_file = str(columns[20])
# Load the configuration file for this particular pointing # Load the configuration file for this particular pointing
# [TODO]
self.obs_config_file = "/public/home/fangyuedong/project/csst-simulation/config/obs_config_SCI_WIDE_phot.yaml"
with open(self.obs_config_file, "r") as stream: with open(self.obs_config_file, "r") as stream:
try: try:
self.obs_param = yaml.safe_load(stream) self.obs_param = yaml.safe_load(stream)
......
...@@ -32,6 +32,10 @@ def generate_pointing_list(config, pointing_filename=None, data_dir=None): ...@@ -32,6 +32,10 @@ def generate_pointing_list(config, pointing_filename=None, data_dir=None):
ipoint = 0 ipoint = 0
run_pointings = config['obs_setting']['run_pointings'] run_pointings = config['obs_setting']['run_pointings']
if "obs_config_file" in config['obs_setting']:
obs_config_file = config['obs_setting']["obs_config_file"]
else:
obs_config_file = None
if pointing_filename and data_dir: if pointing_filename and data_dir:
pointing_file = os.path.join(data_dir, pointing_filename) pointing_file = os.path.join(data_dir, pointing_filename)
...@@ -48,7 +52,7 @@ def generate_pointing_list(config, pointing_filename=None, data_dir=None): ...@@ -48,7 +52,7 @@ def generate_pointing_list(config, pointing_filename=None, data_dir=None):
continue continue
line = line.strip() line = line.strip()
columns = line.split() columns = line.split()
pointing = Pointing() pointing = Pointing(obs_config_file=obs_config_file)
pointing.read_pointing_columns(columns=columns, id=ipoint) pointing.read_pointing_columns(columns=columns, id=ipoint)
t += delta_t * 60. t += delta_t * 60.
pointing_list.append(pointing) pointing_list.append(pointing)
...@@ -67,7 +71,8 @@ def generate_pointing_list(config, pointing_filename=None, data_dir=None): ...@@ -67,7 +71,8 @@ def generate_pointing_list(config, pointing_filename=None, data_dir=None):
img_pa=config["obs_setting"]["image_rot"], img_pa=config["obs_setting"]["image_rot"],
timestamp=t, timestamp=t,
exp_time=exp_time, exp_time=exp_time,
pointing_type='SCI' pointing_type='SCI',
obs_config_file=obs_config_file
) )
t += delta_t * 60. t += delta_t * 60.
pointing_list.append(pointing) pointing_list.append(pointing)
......
...@@ -28,7 +28,7 @@ run_option: ...@@ -28,7 +28,7 @@ run_option:
# 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: YES
############################################### ###############################################
# Catalog setting # Catalog setting
...@@ -71,6 +71,8 @@ obs_setting: ...@@ -71,6 +71,8 @@ obs_setting:
pointing_dir: "/public/share/yangxuliu/CSSOSDataProductsSims/data_50sqDeg" pointing_dir: "/public/share/yangxuliu/CSSOSDataProductsSims/data_50sqDeg"
pointing_file: "pointing_50_combined.dat" pointing_file: "pointing_50_combined.dat"
obs_config_file: "/public/home/fangyuedong/project/csst-simulation/config/obs_config_SCI_WIDE_phot.yaml"
# Run specific pointing(s): # Run specific pointing(s):
# - give a list of indexes of pointings: [ip_1, ip_2...] # - give a list of indexes of pointings: [ip_1, ip_2...]
# - run all pointings: null # - run all pointings: null
......
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