diff --git a/README.md b/README.md index 0b39a3f60fa7a8cbe4ddedde720f55330e33a69e..c2e83d3cd3312f3328a54d49b1ab68a21dd6af35 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,16 @@ # Pipeline for source injection on CSST images ## Installation +1. First make sure CSST simulation package is installed +2. Install the source injection packages: ``` -python setup.py install --user -``` \ No newline at end of file + python setup.py install --user + ``` + +## 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 diff --git a/config/config_injection.yaml b/config/config_injection.yaml index b5fb2c367a1b56e50b60803e0498b19a4fa8420d..9e27f8dccd7eeb2be6b843fad3f2adf886932256 100644 --- a/config/config_injection.yaml +++ b/config/config_injection.yaml @@ -19,7 +19,10 @@ pos_sampling: # type: "uniform" # 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 @@ -63,7 +66,7 @@ catalog_options: # observation_sim.instruments.chip object # (TODO) Should readout from header ############################################### -ins_effects: +# ins_effects: # switches # bright_fatter: ON # Whether to simulate Brighter-Fatter (also diffusion) effect @@ -82,16 +85,16 @@ ins_effects: # random_seeds: # seed_Av: 121212 # Seed for generating random intrinsic extinction -############################################### -# 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/input_L1_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_psf_list: "/share/home/fangyuedong/injection_pipeline/psf_img_MSC_0000000.list" - sex_config: "/share/home/fangyuedong/injection_pipeline/config/default.config" - sex_param: "/share/home/fangyuedong/injection_pipeline/config/default.param" - n_jobs: 8 - output_dir: "/share/home/fangyuedong/injection_pipeline/workspace" \ No newline at end of file +# ############################################### +# # 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/input_L1_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_psf_list: "/share/home/fangyuedong/injection_pipeline/psf_img_MSC_0000000.list" +# sex_config: "/share/home/fangyuedong/injection_pipeline/config/default.config" +# sex_param: "/share/home/fangyuedong/injection_pipeline/config/default.param" +# n_jobs: 8 +# output_dir: "/share/home/fangyuedong/injection_pipeline/workspace" \ No newline at end of file diff --git a/injection_pipeline/config.py b/injection_pipeline/config.py index c20d01ee8ab510505238d41c4c64389aebd657da..3c91869687070236f6f75ab500415a4e833b52be 100644 --- a/injection_pipeline/config.py +++ b/injection_pipeline/config.py @@ -7,7 +7,6 @@ def parse_args(): ''' parser = argparse.ArgumentParser() 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('-w', '--work_dir', help='The path for output.') return parser.parse_args() \ No newline at end of file diff --git a/injection_pipeline/injection_pipeline.py b/injection_pipeline/injection_pipeline.py index 8d1c6822292c0d9f77572588fc98ae2d7a61bc05..19090c6b697697dbb5a9098f86b41aef4e7c3897 100644 --- a/injection_pipeline/injection_pipeline.py +++ b/injection_pipeline/injection_pipeline.py @@ -15,10 +15,6 @@ class InjectionPipeline(object): # Load configuration if config_file is None: 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 with open(config_file, "r") as stream: @@ -29,6 +25,11 @@ class InjectionPipeline(object): except yaml.YAMLError as 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, input_dir, pointing_label, @@ -57,11 +58,20 @@ class InjectionPipeline(object): return image_path_list def run_pointing_list(self, - input_dir, - pointing_label_list, - output_dir, Catalog, + input_dir=None, + pointing_label_list=None, + output_dir=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 = [] output_path_list = [] try: @@ -110,19 +120,21 @@ class InjectionPipeline(object): if __name__ == "__main__": - input_dir = "/public/home/fangyuedong/project/50sqDeg_L1_outputs/50sqDeg_Photo_W2/" - # pointing_label_list = ["MSC_0000000", "MSC_0000001", - # "MSC_0000002", "MSC_0000003", "MSC_0000004", "MSC_0000005", "MSC_0000006", "MSC_0000007", "MSC_0000008", "MSC_0000009"] - chip_label_list = None - pointing_label_list = ["MSC_0000000"] - chip_label_list = ["07"] - # output_dir = "/public/home/fangyuedong/project/injected_50sqDeg_L1_outputs/50sqDeg_Photo_W3/" - output_dir = "/public/home/fangyuedong/project/test_photometry/50sqDeg_Photo_W2/" - config_file = "/public/home/fangyuedong/project/injection_pipeline/config/config_injection.yaml" - - pipeline = InjectionPipeline(config_file=config_file) - pipeline.run_pointing_list(input_dir=input_dir, - pointing_label_list=pointing_label_list, - output_dir=output_dir, - chip_label_list=chip_label_list, - Catalog=SimCat) + # input_dir = "/public/home/fangyuedong/project/50sqDeg_L1_outputs/50sqDeg_Photo_W2/" + # # pointing_label_list = ["MSC_0000000", "MSC_0000001", + # # "MSC_0000002", "MSC_0000003", "MSC_0000004", "MSC_0000005", "MSC_0000006", "MSC_0000007", "MSC_0000008", "MSC_0000009"] + # chip_label_list = None + # pointing_label_list = ["MSC_0000000"] + # chip_label_list = ["07"] + # # output_dir = "/public/home/fangyuedong/project/injected_50sqDeg_L1_outputs/50sqDeg_Photo_W3/" + # output_dir = "/public/home/fangyuedong/project/test_photometry/50sqDeg_Photo_W2/" + # config_file = "/public/home/fangyuedong/project/injection_pipeline/config/config_injection.yaml" + + # pipeline = InjectionPipeline(config_file=config_file) + pipeline = InjectionPipeline() + # pipeline.run_pointing_list(input_dir=input_dir, + # pointing_label_list=pointing_label_list, + # output_dir=output_dir, + # chip_label_list=chip_label_list, + # Catalog=SimCat) + pipeline.run_pointing_list(Catalog=SimCat)