Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Fang Yuedong
injection_pipeline
Commits
05b89e5d
Commit
05b89e5d
authored
Oct 22, 2024
by
Fang Yuedong
Browse files
move input & output options to config_injection.yaml
parent
1e98863d
Changes
4
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
05b89e5d
# 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
config/config_injection.yaml
View file @
05b89e5d
...
...
@@ -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
injection_pipeline/config.py
View file @
05b89e5d
...
...
@@ -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
injection_pipeline/injection_pipeline.py
View file @
05b89e5d
...
...
@@ -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
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment