Commit 4b820c11 authored by Fang Yuedong's avatar Fang Yuedong
Browse files

add configuration files for detrending and photometry

parent 05b89e5d
...@@ -8,9 +8,22 @@ ...@@ -8,9 +8,22 @@
``` ```
## Usage ## Usage
### Run L1 Detrending pipeline (optional)
* If the L1 images are not available, we need first to run the CSST detrending pipeline on the raw images to get the L1 calibrated products. Otherwise this step can be ignored.
* This step removes all the instrumental related effects as well as cosmoic rays
* modify the corresponding ```config_detrending.yaml``` file to configure all running options
```
python ./measurement_pipeline/run_csst_msc_instrument.py /path/to/config_detrending.yaml
```
### Run Source Injection ### Run Source Injection
* Inject souces onto the L1 (detrended)
* modify the corresponding ```config_injection.yaml``` file to configure all running options
``` ```
python ./injection_pipeline/injection_pipeline.py /path/to/config_injection.yaml python ./injection_pipeline/injection_pipeline.py /path/to/config_injection.yaml
``` ```
### Run L1 Detrending pipeline
### Run L1 Detection & Photometry pipeline ### Run L1 Detection & Photometry pipeline
* Re-detect and redo the photometry measurements on the injected images
* modify the corresponding ```config_photometry.yaml``` file to configure all running options
```
python ./measurement_pipeline/run_csst_msc_mbi_photometry.py /path/to/config_photometry.yaml
```
\ No newline at end of file
input_dir: "/public/share/yangxuliu/CSSOSDataProductsSims/outputs_50sqDeg/50sqDeg_Photo_W2/"
output_dir: "/public/home/fangyuedong/project/demo_csst_injection/50sqDeg_Photo_W2/"
pointing_label_list: ["MSC_0000000"]
chip_label_list: ["07"]
\ No newline at end of file
input_dir: "/public/home/fangyuedong/project/demo_csst_injection/50sqDeg_Photo_W2/"
flag_weight_dir: "/public/home/fangyuedong/project/demo_csst_injection/L1_products/50sqDeg_Photo_W2/"
output_dir: "/public/home/fangyuedong/project/demo_csst_injection/50sqDeg_Photo_W2/"
pointing_label_list: ["MSC_0000000"]
chip_label_list: ["07"]
calib_data_path: "/public/home/fangyuedong/project/calib_data/"
\ No newline at end of file
import argparse
def parse_args():
'''
Parse command line arguments. Many of the following
can be set in the .yaml config file as well.
'''
parser = argparse.ArgumentParser()
parser.add_argument('config_file', help='.yaml config file for injection settings.')
# 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
"""_summary_ """_summary_
""" """
import os import os
import yaml
from glob import glob from glob import glob
import mpi4py.MPI as MPI import mpi4py.MPI as MPI
# from .L1_pipeline.csst_msc_instrument.csst_msc_mbi_instrument import core_msc_l1_mbi_instrument # from .L1_pipeline.csst_msc_instrument.csst_msc_mbi_instrument import core_msc_l1_mbi_instrument
from L1_pipeline.csst_msc_instrument.csst_msc_mbi_instrument import core_msc_l1_mbi_instrument from L1_pipeline.csst_msc_instrument.csst_msc_mbi_instrument import core_msc_l1_mbi_instrument
from config import parse_args
def run_csst_msc_instrument(image_path, def run_csst_msc_instrument(image_path,
...@@ -126,13 +128,24 @@ if __name__ == "__main__": ...@@ -126,13 +128,24 @@ if __name__ == "__main__":
# output_dir = "/public/home/fangyuedong/project/test_deepcr" # output_dir = "/public/home/fangyuedong/project/test_deepcr"
# input_dir = "/public/share/yangxuliu/CSSOSDataProductsSims/outputs_50sqDeg/50sqDeg_Photo_W2/" # input_dir = "/public/share/yangxuliu/CSSOSDataProductsSims/outputs_50sqDeg/50sqDeg_Photo_W2/"
# output_dir = "/public/home/fangyuedong/project/50sqDeg_L1_outputs/50sqDeg_Photo_W2/" # output_dir = "/public/home/fangyuedong/project/50sqDeg_L1_outputs/50sqDeg_Photo_W2/"
input_dir = "/public/share/yangxuliu/CSSOSDataProductsSims/outputs_50sqDeg/50sqDeg_Photo_W3/" # input_dir = "/public/share/yangxuliu/CSSOSDataProductsSims/outputs_50sqDeg/50sqDeg_Photo_W3/"
output_dir = "/public/home/fangyuedong/project/50sqDeg_L1_outputs/50sqDeg_Photo_W3/" # output_dir = "/public/home/fangyuedong/project/50sqDeg_L1_outputs/50sqDeg_Photo_W3/"
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
run_pointing_list(input_dir=input_dir, args = parse_args()
pointing_label_list=pointing_label_list, config_file = args.config_file
output_dir=output_dir, with open(config_file, "r") as stream:
chip_label_list=chip_label_list) try:
config = yaml.safe_load(stream)
for key, value in config.items():
print(key + " : " + str(value))
except yaml.YAMLError as exc:
print(exc)
run_pointing_list(input_dir=config["input_dir"],
pointing_label_list=config["pointing_label_list"],
output_dir=config["output_dir"],
chip_label_list=config["chip_label_list"],
calib_data_path=config["calib_data_path"])
"""_summary_ """_summary_
""" """
import os import os
import yaml
from glob import glob from glob import glob
import mpi4py.MPI as MPI import mpi4py.MPI as MPI
from L1_pipeline.csst_msc_mbi_photometry.csst_photometry import core_msc_l1_mbi_phot from L1_pipeline.csst_msc_mbi_photometry.csst_photometry import core_msc_l1_mbi_phot
from typing import Optional from typing import Optional
from config import parse_args
def run_csst_msc_mbi_photometry(image_path, def run_csst_msc_mbi_photometry(image_path,
output_dir, output_dir,
...@@ -135,17 +136,28 @@ if __name__ == "__main__": ...@@ -135,17 +136,28 @@ if __name__ == "__main__":
# chip_label_list = None # chip_label_list = None
# output_dir = "/public/home/fangyuedong/project/processed_injected_50sqDeg_L1_outputs" # output_dir = "/public/home/fangyuedong/project/processed_injected_50sqDeg_L1_outputs"
# flag_weight_dir = "/public/home/fangyuedong/project/50sqDeg_L1_outputs/50sqDeg_Photo_W2/" # flag_weight_dir = "/public/home/fangyuedong/project/50sqDeg_L1_outputs/50sqDeg_Photo_W2/"
flag_weight_dir = "/public/home/fangyuedong/project/50sqDeg_L1_outputs/50sqDeg_Photo_W3/" # flag_weight_dir = "/public/home/fangyuedong/project/50sqDeg_L1_outputs/50sqDeg_Photo_W3/"
# input_dir = "/public/home/fangyuedong/project/50sqDeg_L1_outputs/50sqDeg_Photo_W3/" # # input_dir = "/public/home/fangyuedong/project/50sqDeg_L1_outputs/50sqDeg_Photo_W3/"
input_dir = "/public/home/fangyuedong/project/injected_50sqDeg_L1_outputs/50sqDeg_Photo_W3/" # input_dir = "/public/home/fangyuedong/project/injected_50sqDeg_L1_outputs/50sqDeg_Photo_W3/"
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
# output_dir = "/public/home/fangyuedong/project/50sqDeg_L1_outputs/50sqDeg_Photo_W3/" # # output_dir = "/public/home/fangyuedong/project/50sqDeg_L1_outputs/50sqDeg_Photo_W3/"
output_dir = "/public/home/fangyuedong/project/processed_injected_50sqDeg_L1_outputs/50sqDeg_Photo_W3/" # output_dir = "/public/home/fangyuedong/project/processed_injected_50sqDeg_L1_outputs/50sqDeg_Photo_W3/"
run_pointing_list(input_dir=input_dir,
flag_weight_dir=flag_weight_dir, args = parse_args()
pointing_label_list=pointing_label_list, config_file = args.config_file
output_dir=output_dir, with open(config_file, "r") as stream:
chip_label_list=chip_label_list) try:
config = yaml.safe_load(stream)
for key, value in config.items():
print(key + " : " + str(value))
except yaml.YAMLError as exc:
print(exc)
run_pointing_list(input_dir=config["input_dir"],
flag_weight_dir=config["flag_weight_dir"],
pointing_label_list=config["pointing_label_list"],
output_dir=config["output_dir"],
chip_label_list=config["chip_label_list"])
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