Commit 05b89e5d authored by Fang Yuedong's avatar Fang Yuedong
Browse files

move input & output options to config_injection.yaml

parent 1e98863d
# Pipeline for source injection on CSST images # Pipeline for source injection on CSST images
## Installation ## Installation
1. First make sure CSST simulation package is installed
2. Install the source injection packages:
``` ```
python setup.py install --user python setup.py install --user
``` ```
\ No newline at end of file
## Usage
### Run Source Injection
```
python ./injection_pipeline/injection_pipeline.py /path/to/config_injection.yaml
```
### Run L1 Detrending pipeline
### Run L1 Detection & Photometry pipeline
\ No newline at end of file
...@@ -19,7 +19,10 @@ pos_sampling: ...@@ -19,7 +19,10 @@ pos_sampling:
# type: "uniform" # type: "uniform"
# object_density: 37 # arcmin^-2 # object_density: 37 # arcmin^-2
# output_img_dir: "/public/home/fangyuedong/project/injection_pipeline/workspace" input_dir: "/public/home/fangyuedong/project/50sqDeg_L1_outputs/50sqDeg_Photo_W2/"
output_dir: "/public/home/fangyuedong/project/demo_csst_injection/50sqDeg_Photo_W2/"
pointing_label_list: ["MSC_0000000"]
chip_label_list: ["07"]
############################################### ###############################################
# PSF setting # PSF setting
...@@ -63,7 +66,7 @@ catalog_options: ...@@ -63,7 +66,7 @@ catalog_options:
# observation_sim.instruments.chip object # observation_sim.instruments.chip object
# (TODO) Should readout from header # (TODO) Should readout from header
############################################### ###############################################
ins_effects: # ins_effects:
# switches # switches
# bright_fatter: ON # Whether to simulate Brighter-Fatter (also diffusion) effect # bright_fatter: ON # Whether to simulate Brighter-Fatter (also diffusion) effect
...@@ -82,16 +85,16 @@ ins_effects: ...@@ -82,16 +85,16 @@ ins_effects:
# random_seeds: # random_seeds:
# seed_Av: 121212 # Seed for generating random intrinsic extinction # seed_Av: 121212 # Seed for generating random intrinsic extinction
############################################### # ###############################################
# Measurement setting # # Measurement setting
############################################### # ###############################################
measurement_setting: # measurement_setting:
input_img_list: "/share/home/fangyuedong/injection_pipeline/injected_L1_img_MSC_0000000.list" # input_img_list: "/share/home/fangyuedong/injection_pipeline/injected_L1_img_MSC_0000000.list"
# input_img_list: "/share/home/fangyuedong/injection_pipeline/input_L1_img_MSC_0000000.list" # # input_img_list: "/share/home/fangyuedong/injection_pipeline/input_L1_img_MSC_0000000.list"
input_wht_list: "/share/home/fangyuedong/injection_pipeline/L1_wht_img_MSC_0000000.list" # input_wht_list: "/share/home/fangyuedong/injection_pipeline/L1_wht_img_MSC_0000000.list"
input_flg_list: "/share/home/fangyuedong/injection_pipeline/L1_flg_img_MSC_0000000.list" # input_flg_list: "/share/home/fangyuedong/injection_pipeline/L1_flg_img_MSC_0000000.list"
input_psf_list: "/share/home/fangyuedong/injection_pipeline/psf_img_MSC_0000000.list" # input_psf_list: "/share/home/fangyuedong/injection_pipeline/psf_img_MSC_0000000.list"
sex_config: "/share/home/fangyuedong/injection_pipeline/config/default.config" # sex_config: "/share/home/fangyuedong/injection_pipeline/config/default.config"
sex_param: "/share/home/fangyuedong/injection_pipeline/config/default.param" # sex_param: "/share/home/fangyuedong/injection_pipeline/config/default.param"
n_jobs: 8 # n_jobs: 8
output_dir: "/share/home/fangyuedong/injection_pipeline/workspace" # output_dir: "/share/home/fangyuedong/injection_pipeline/workspace"
\ No newline at end of file \ No newline at end of file
...@@ -7,7 +7,6 @@ def parse_args(): ...@@ -7,7 +7,6 @@ def parse_args():
''' '''
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('config_file', help='.yaml config file for injection settings.') parser.add_argument('config_file', help='.yaml config file for injection settings.')
parser.add_argument('-c', '--config_dir', help='Directory that houses the .yaml config file.')
# parser.add_argument('-d', '--data_dir', help='Directory that houses the input data.') # parser.add_argument('-d', '--data_dir', help='Directory that houses the input data.')
# parser.add_argument('-w', '--work_dir', help='The path for output.') # parser.add_argument('-w', '--work_dir', help='The path for output.')
return parser.parse_args() return parser.parse_args()
\ No newline at end of file
...@@ -15,10 +15,6 @@ class InjectionPipeline(object): ...@@ -15,10 +15,6 @@ class InjectionPipeline(object):
# Load configuration # Load configuration
if config_file is None: if config_file is None:
args = parse_args() args = parse_args()
if args.config_dir is None:
args.config_dir = ''
args.config_dir = os.path.abspath(args.config_dir)
args.config_file = os.path.join(args.config_dir, args.config_file)
config_file = args.config_file config_file = args.config_file
with open(config_file, "r") as stream: with open(config_file, "r") as stream:
...@@ -29,6 +25,11 @@ class InjectionPipeline(object): ...@@ -29,6 +25,11 @@ class InjectionPipeline(object):
except yaml.YAMLError as exc: except yaml.YAMLError as exc:
print(exc) print(exc)
self.input_dir = self.config['input_dir']
self.output_dir = self.config['output_dir']
self.pointing_label_list = self.config['pointing_label_list']
self.chip_label_list = self.config['chip_label_list']
def genearte_path_list_for_one_pointing(self, def genearte_path_list_for_one_pointing(self,
input_dir, input_dir,
pointing_label, pointing_label,
...@@ -57,11 +58,20 @@ class InjectionPipeline(object): ...@@ -57,11 +58,20 @@ class InjectionPipeline(object):
return image_path_list return image_path_list
def run_pointing_list(self, def run_pointing_list(self,
input_dir,
pointing_label_list,
output_dir,
Catalog, Catalog,
input_dir=None,
pointing_label_list=None,
output_dir=None,
chip_label_list=None): chip_label_list=None):
if input_dir is None:
input_dir = self.input_dir
if pointing_label_list is None:
pointing_label_list = self.pointing_label_list
if output_dir is None:
output_dir = self.output_dir
if chip_label_list is None:
chip_label_list = self.chip_label_list
image_path_list = [] image_path_list = []
output_path_list = [] output_path_list = []
try: try:
...@@ -110,19 +120,21 @@ class InjectionPipeline(object): ...@@ -110,19 +120,21 @@ class InjectionPipeline(object):
if __name__ == "__main__": if __name__ == "__main__":
input_dir = "/public/home/fangyuedong/project/50sqDeg_L1_outputs/50sqDeg_Photo_W2/" # input_dir = "/public/home/fangyuedong/project/50sqDeg_L1_outputs/50sqDeg_Photo_W2/"
# pointing_label_list = ["MSC_0000000", "MSC_0000001", # # pointing_label_list = ["MSC_0000000", "MSC_0000001",
# "MSC_0000002", "MSC_0000003", "MSC_0000004", "MSC_0000005", "MSC_0000006", "MSC_0000007", "MSC_0000008", "MSC_0000009"] # # "MSC_0000002", "MSC_0000003", "MSC_0000004", "MSC_0000005", "MSC_0000006", "MSC_0000007", "MSC_0000008", "MSC_0000009"]
chip_label_list = None # chip_label_list = None
pointing_label_list = ["MSC_0000000"] # pointing_label_list = ["MSC_0000000"]
chip_label_list = ["07"] # chip_label_list = ["07"]
# output_dir = "/public/home/fangyuedong/project/injected_50sqDeg_L1_outputs/50sqDeg_Photo_W3/" # # output_dir = "/public/home/fangyuedong/project/injected_50sqDeg_L1_outputs/50sqDeg_Photo_W3/"
output_dir = "/public/home/fangyuedong/project/test_photometry/50sqDeg_Photo_W2/" # output_dir = "/public/home/fangyuedong/project/test_photometry/50sqDeg_Photo_W2/"
config_file = "/public/home/fangyuedong/project/injection_pipeline/config/config_injection.yaml" # config_file = "/public/home/fangyuedong/project/injection_pipeline/config/config_injection.yaml"
pipeline = InjectionPipeline(config_file=config_file) # pipeline = InjectionPipeline(config_file=config_file)
pipeline.run_pointing_list(input_dir=input_dir, pipeline = InjectionPipeline()
pointing_label_list=pointing_label_list, # pipeline.run_pointing_list(input_dir=input_dir,
output_dir=output_dir, # pointing_label_list=pointing_label_list,
chip_label_list=chip_label_list, # output_dir=output_dir,
Catalog=SimCat) # chip_label_list=chip_label_list,
# Catalog=SimCat)
pipeline.run_pointing_list(Catalog=SimCat)
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