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

enable output of run metadata file (run date, run time, and software version).

parent 255d9883
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
# work_dir: "/public/home/fangyuedong/sim_code_release/CSST/test/" # work_dir: "/public/home/fangyuedong/sim_code_release/CSST/test/"
work_dir: "/public/home/fangyuedong/test/CSST/workplace/" work_dir: "/public/home/fangyuedong/test/CSST/workplace/"
data_dir: "/data/simudata/CSSOSDataProductsSims/data/" data_dir: "/data/simudata/CSSOSDataProductsSims/data/"
run_name: "TEST_LIMITING_MAG" run_name: "TEST_Speed"
# (Optional) a file of point list # (Optional) a file of point list
# if you just want to run default pointing: # if you just want to run default pointing:
...@@ -79,7 +79,7 @@ obs_setting: ...@@ -79,7 +79,7 @@ obs_setting:
# - give a list of indexes of chips: [ip_1, ip_2...] # - give a list of indexes of chips: [ip_1, ip_2...]
# - run all chips: null # - run all chips: null
# Note: for all pointings # Note: for all pointings
run_chips: [24, 19, 14, 9] run_chips: [24]
# Whether to enable astrometric modeling # Whether to enable astrometric modeling
# astrometric_lib: "libshao.so" # astrometric_lib: "libshao.so"
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
############################################### ###############################################
# #
# Configuration file for CSST simulation # Configuration file for CSST simulation
# CSST-Sim Group, 2021/10/07, version 0.3 # CSST-Sim Group, 2021/10/07
# #
############################################### ###############################################
......
from ObservationSim.ObservationSim import Observation from ObservationSim.ObservationSim import Observation
from ObservationSim._util import parse_args, make_run_dirs, generate_pointing_list from ObservationSim._util import parse_args, make_run_dirs, generate_pointing_list
from pkg_resources import get_distribution
import os import os
import yaml import yaml
import shutil import shutil
import datetime
import gc import gc
gc.enable() gc.enable()
...@@ -20,6 +22,12 @@ def run_sim(Catalog): ...@@ -20,6 +22,12 @@ def run_sim(Catalog):
---------- ----------
None None
""" """
# Get version of CSSTSim Package
__version__ = get_distribution("CSSTSim").version
# Get run datetime
now = datetime.datetime.now()
args = parse_args() args = parse_args()
if args.config_dir is None: if args.config_dir is None:
args.config_dir = '' args.config_dir = ''
...@@ -55,7 +63,19 @@ def run_sim(Catalog): ...@@ -55,7 +63,19 @@ def run_sim(Catalog):
# Make the main output directories # Make the main output directories
run_dir = make_run_dirs(work_dir=config['work_dir'], run_name=config['run_name'], pointing_list=pointing_list) run_dir = make_run_dirs(work_dir=config['work_dir'], run_name=config['run_name'], pointing_list=pointing_list)
# Copy the config file to output directory & Write Run metadata
shutil.copy(args.config_file, run_dir) shutil.copy(args.config_file, run_dir)
run_meta = os.path.join(run_dir, "run_metadata.yaml")
with open(run_meta, "w") as config_out:
config_out.write("\n")
config_out.write("###############################################\n")
config_out.write("CSSTSim_version: \"%s\"\n"%__version__)
date_str = datetime.datetime.strftime(now, '%m/%d/%Y')
time_str = datetime.datetime.strftime(now, '%H:%M:%S')
config_out.write("Run_date: \"%s\"\n"%date_str)
config_out.write("Run_time: \"%s\"\n"%time_str)
config_out.write("###############################################\n")
# Initialize the simulation # Initialize the simulation
obs = Observation(config=config, Catalog=Catalog, work_dir=config['work_dir'], data_dir=config['data_dir']) obs = Observation(config=config, Catalog=Catalog, work_dir=config['work_dir'], data_dir=config['data_dir'])
......
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