Commit 23ec8465 authored by Fang Yuedong's avatar Fang Yuedong
Browse files

package name keyword change

parent 38c68810
build/*
CSSTSim.egg-info/*
csst_msc_sim.egg-info/*
dist/*
*.pyc
*.so
......
......@@ -473,7 +473,7 @@ def generatePrimaryHeader(xlen = 9216, ylen = 9232, pointing_id = '00000001', po
# h_prim['SIM_VER'] = (get_distribution("CSSTSim").version, "Version of CSST MSC simulation software")
currentDateAndTime = datetime.now()
compute_name = platform.node()
h_prim['FITSSWV'] = get_distribution("CSSTSim").version +'_' + currentDateAndTime.strftime("%Y%m%d") + '_' +compute_name
h_prim['FITSSWV'] = get_distribution("csst_msc_sim").version +'_' + currentDateAndTime.strftime("%Y%m%d") + '_' +compute_name
h_prim['EPOCH'] = round((Time(h_prim['EXPSTART'], format='mjd', scale='tcb')).jyear, 1)
return h_prim
......
......@@ -10,6 +10,7 @@ import importlib
import gc
gc.enable()
def run_sim():
"""
Main method for simulation call.
......@@ -18,13 +19,13 @@ def run_sim():
----------
Catalog : Class
a catalog class which is inherited from ObservationSim.MockObject.CatalogBase
Returns
----------
None
"""
# Get version of CSSTSim Package
__version__ = version("CSSTSim")
# Get version of the Package
__version__ = version("csst_msc_sim")
# Get run datetime
now = datetime.datetime.now()
......@@ -38,7 +39,7 @@ def run_sim():
try:
config = yaml.safe_load(stream)
for key, value in config.items():
print (key + " : " + str(value))
print(key + " : " + str(value))
except yaml.YAMLError as exc:
print(exc)
......@@ -62,42 +63,48 @@ def run_sim():
if "run_counter" not in config:
config["run_counter"] = 0
# Generate lists pointings based on the input pointing list (or default
# Generate lists pointings based on the input pointing list (or default
# pointing RA, DEC) and "config["obs_setting"]["run_pointings"]".
# "config['obs_setting']['np_cal']"" is the number of CAL pointings which will be
# "config['obs_setting']['np_cal']"" is the number of CAL pointings which will be
# appended to the front.
# NOTE: the implementation of gerenating time_stamps is temporary.
pointing_dir = None
if "pointing_dir" in config['obs_setting']:
pointing_dir = config['obs_setting']["pointing_dir"]
pointing_list = generate_pointing_list(config=config, pointing_filename=config['obs_setting']['pointing_file'], data_dir=pointing_dir)
pointing_list = generate_pointing_list(
config=config, pointing_filename=config['obs_setting']['pointing_file'], data_dir=pointing_dir)
# 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)
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__)
config_out.write(
"csst_msc_sim package 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("Run_date: \"%s\"\n" % date_str)
config_out.write("Run_time: \"%s\"\n" % time_str)
config_out.write("###############################################\n")
# Initialize the simulation
if args.catalog is not None:
catalog_module = importlib.import_module('Catalog.'+args.catalog)
obs = Observation(config=config, Catalog=catalog_module.Catalog, work_dir=config['work_dir'], data_dir=config['data_dir'])
obs = Observation(config=config, Catalog=catalog_module.Catalog,
work_dir=config['work_dir'], data_dir=config['data_dir'])
else:
catalog_module = None
obs = Observation(config=config, Catalog=None, work_dir=config['work_dir'], data_dir=config['data_dir'])
obs = Observation(config=config, Catalog=None,
work_dir=config['work_dir'], data_dir=config['data_dir'])
# Run simulation
obs.runExposure_MPI_PointingList(pointing_list=pointing_list)
if __name__=='__main__':
if __name__ == '__main__':
run_sim()
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