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
csst-pipeline
csst_common
Commits
eda1b0c3
Commit
eda1b0c3
authored
Nov 21, 2022
by
BO ZHANG
🏀
Browse files
renamed exp_id to obs_id
parent
57bb7847
Changes
1
Hide whitespace changes
Inline
Side-by-side
csst_common/data_manager.py
View file @
eda1b0c3
...
@@ -80,11 +80,11 @@ class CsstMsDataManager:
...
@@ -80,11 +80,11 @@ class CsstMsDataManager:
dfs_node : str
dfs_node : str
The environment in which the pipeline will run.
The environment in which the pipeline will run.
Use "pml" for Purple Mountain Lab cluster and "local" for others.
Use "pml" for Purple Mountain Lab cluster and "local" for others.
_exp
_id : int
obs
_id : int
The exposure ID.
The exposure ID.
_
exp_start : int
exp_start : int
The exposure start time in ``yyyymmddhhmmss`` format.
The exposure start time in ``yyyymmddhhmmss`` format.
_
exp_stop : int
exp_stop : int
The exposure start time in ``yyyymmddhhmmss`` format.
The exposure start time in ``yyyymmddhhmmss`` format.
_telescope : str
_telescope : str
The telescope name. Defaults to ``CSST`` for C5.2 simulation.
The telescope name. Defaults to ``CSST`` for C5.2 simulation.
...
@@ -92,9 +92,9 @@ class CsstMsDataManager:
...
@@ -92,9 +92,9 @@ class CsstMsDataManager:
The instrument name. Defaults to ``MSC`` for C5.2 simulation.
The instrument name. Defaults to ``MSC`` for C5.2 simulation.
_survey : str
_survey : str
The survey name. Defaults to ``MS`` for C5.2 simulation.
The survey name. Defaults to ``MS`` for C5.2 simulation.
_image
type : str
obs_
type : str
The image type signature for science images. Defualts to ``SCI`` for C5.2 simulation.
The image type signature for science images. Defualts to ``SCI`` for C5.2 simulation.
_
l0_post : str
l0_post : str
The postfix. Defaults to ``L0_1`` for C5.2 simulation.
The postfix. Defaults to ``L0_1`` for C5.2 simulation.
log_ppl : str
log_ppl : str
The pipeline log file name.
The pipeline log file name.
...
@@ -134,14 +134,14 @@ class CsstMsDataManager:
...
@@ -134,14 +134,14 @@ class CsstMsDataManager:
path_aux
:
str
=
""
,
# bias dark flat
path_aux
:
str
=
""
,
# bias dark flat
dfs_mode
:
bool
=
False
,
dfs_mode
:
bool
=
False
,
dfs_node
:
str
=
"kmust"
,
dfs_node
:
str
=
"kmust"
,
_exp
_id
:
int
=
100000100
,
obs
_id
:
str
=
"
100000100
"
,
_
exp_start
:
int
=
20270810081950
,
exp_start
:
int
=
"
20270810081950
"
,
_
exp_stop
:
int
=
20270810082220
,
exp_stop
:
int
=
"
20270810082220
"
,
_telescope
:
str
=
"CSST"
,
_telescope
:
str
=
"CSST"
,
_instrument
:
str
=
"MSC"
,
_instrument
:
str
=
"MSC"
,
_survey
:
str
=
"MS"
,
_survey
:
str
=
"MS"
,
_image
type
:
str
=
"SCI"
,
obs_
type
:
str
=
"SCI"
,
_
l0_post
:
str
=
"L0_1"
,
l0_post
:
str
=
"L0_1"
,
log_ppl
=
"csst-l1ppl.log"
,
log_ppl
=
"csst-l1ppl.log"
,
log_mod
=
"csst-l1mod.log"
,
log_mod
=
"csst-l1mod.log"
,
clear_dir
=
False
,
clear_dir
=
False
,
...
@@ -176,16 +176,16 @@ class CsstMsDataManager:
...
@@ -176,16 +176,16 @@ class CsstMsDataManager:
self
.
target_detectors
=
target_detectors
self
.
target_detectors
=
target_detectors
# exposure info
# exposure info
self
.
_exp
_id
=
_exp
_id
self
.
obs
_id
=
obs
_id
self
.
_
exp_start
=
_
exp_start
self
.
exp_start
=
exp_start
self
.
_
exp_stop
=
_
exp_stop
self
.
exp_stop
=
exp_stop
# file name components
# file name components
self
.
_telescope
=
_telescope
self
.
_telescope
=
_telescope
self
.
_instrument
=
_instrument
self
.
_instrument
=
_instrument
self
.
_survey
=
_survey
self
.
_survey
=
_survey
self
.
_image
type
=
_image
type
self
.
obs_
type
=
obs_
type
self
.
_
l0_post
=
_
l0_post
self
.
l0_post
=
l0_post
# for catalog query
# for catalog query
self
.
dfs_mode
=
dfs_mode
self
.
dfs_mode
=
dfs_mode
...
@@ -266,13 +266,13 @@ class CsstMsDataManager:
...
@@ -266,13 +266,13 @@ class CsstMsDataManager:
available_detectors
.
sort
()
available_detectors
.
sort
()
# parse info
# parse info
_telescope
,
_instrument
,
_survey
,
_image
type
,
\
(
_telescope
,
_instrument
,
_survey
,
obs_
type
,
_
exp_start
,
_
exp_stop
,
_exp
_id
,
\
exp_start
,
exp_stop
,
obs
_id
,
_detector
,
*
_
l0_post
,
_ext
=
re
.
split
(
r
"[_.]"
,
fps_img
[
0
])
_detector
,
*
l0_post
,
_ext
)
=
re
.
split
(
r
"[_.]"
,
fps_img
[
0
])
_
exp_start
=
int
(
_
exp_start
)
#
exp_start = int(exp_start)
_
exp_stop
=
int
(
_
exp_stop
)
#
exp_stop = int(exp_stop)
_exp
_id
=
int
(
_exp
_id
)
# obs
_id = int(
obs
_id)
return
CsstMsDataManager
(
ver_sim
=
ver_sim
,
return
CsstMsDataManager
(
ver_sim
=
ver_sim
,
datatype
=
datatype
,
datatype
=
datatype
,
...
@@ -283,14 +283,14 @@ class CsstMsDataManager:
...
@@ -283,14 +283,14 @@ class CsstMsDataManager:
path_aux
=
path_aux
,
# bias dark flat
path_aux
=
path_aux
,
# bias dark flat
dfs_mode
=
dfs_mode
,
dfs_mode
=
dfs_mode
,
dfs_node
=
dfs_node
,
dfs_node
=
dfs_node
,
_exp_id
=
_exp
_id
,
obs_id
=
obs
_id
,
_
exp_start
=
_
exp_start
,
exp_start
=
exp_start
,
_
exp_stop
=
_
exp_stop
,
exp_stop
=
exp_stop
,
_telescope
=
_telescope
,
_telescope
=
_telescope
,
_instrument
=
_instrument
,
_instrument
=
_instrument
,
_survey
=
_survey
,
_survey
=
_survey
,
_imagetype
=
_image
type
,
obs_type
=
obs_
type
,
_
l0_post
=
"_"
.
join
(
_
l0_post
),
l0_post
=
"_"
.
join
(
l0_post
),
)
)
@
staticmethod
@
staticmethod
...
@@ -320,18 +320,22 @@ class CsstMsDataManager:
...
@@ -320,18 +320,22 @@ class CsstMsDataManager:
print
(
"@DM.glob_dir: {} files found with pattern: {}"
.
format
(
len
(
fps
),
pattern
))
print
(
"@DM.glob_dir: {} files found with pattern: {}"
.
format
(
len
(
fps
),
pattern
))
return
fps
return
fps
def
l0_id
(
self
,
detector
=
6
):
""" Level0 ID, consistent with DFS. """
return
f
"
{
self
.
obs_id
}{
detector
:
02
d
}
"
def
l0_cat
(
self
,
detector
=
6
):
def
l0_cat
(
self
,
detector
=
6
):
""" the L0 cat file path"""
""" the L0 cat file path"""
assert
self
.
ver_sim
==
"C5.2"
assert
self
.
ver_sim
==
"C5.2"
fn
=
"{}_{}_chip_{:02d}_filt_{}.cat"
.
format
(
fn
=
"{}_{}_chip_{:02d}_filt_{}.cat"
.
format
(
self
.
_instrument
,
self
.
_exp
_id
,
detector
,
self
.
detector2filter
[
detector
])
self
.
_instrument
,
self
.
obs
_id
,
detector
,
self
.
detector2filter
[
detector
])
return
os
.
path
.
join
(
self
.
dir_l0
,
fn
)
return
os
.
path
.
join
(
self
.
dir_l0
,
fn
)
def
l0_log
(
self
,
detector
=
6
):
def
l0_log
(
self
,
detector
=
6
):
""" L0 log file path """
""" L0 log file path """
assert
self
.
ver_sim
==
"C5.2"
assert
self
.
ver_sim
==
"C5.2"
fn
=
"{}_{}_chip_{:02d}_filt_{}.log"
.
format
(
fn
=
"{}_{}_chip_{:02d}_filt_{}.log"
.
format
(
self
.
_instrument
,
self
.
_exp
_id
,
detector
,
self
.
detector2filter
[
detector
])
self
.
_instrument
,
self
.
obs
_id
,
detector
,
self
.
detector2filter
[
detector
])
return
os
.
path
.
join
(
self
.
dir_l0
,
fn
)
return
os
.
path
.
join
(
self
.
dir_l0
,
fn
)
def
l0_detector
(
self
,
detector
=
6
):
def
l0_detector
(
self
,
detector
=
6
):
...
@@ -339,7 +343,7 @@ class CsstMsDataManager:
...
@@ -339,7 +343,7 @@ class CsstMsDataManager:
assert
self
.
ver_sim
in
[
"C5.1"
,
"C5.2"
]
assert
self
.
ver_sim
in
[
"C5.1"
,
"C5.2"
]
fn
=
"{}_{}_{}_SCI_{}_{}_{}_{:02d}_L0_1.fits"
.
format
(
fn
=
"{}_{}_{}_SCI_{}_{}_{}_{:02d}_L0_1.fits"
.
format
(
self
.
_telescope
,
self
.
_instrument
,
self
.
_survey
,
self
.
_telescope
,
self
.
_instrument
,
self
.
_survey
,
self
.
_
exp_start
,
self
.
_
exp_stop
,
self
.
_exp
_id
,
detector
)
self
.
exp_start
,
self
.
exp_stop
,
self
.
obs
_id
,
detector
)
return
os
.
path
.
join
(
self
.
dir_l0
,
fn
)
return
os
.
path
.
join
(
self
.
dir_l0
,
fn
)
def
l0_crs
(
self
,
detector
=
6
):
def
l0_crs
(
self
,
detector
=
6
):
...
@@ -347,7 +351,7 @@ class CsstMsDataManager:
...
@@ -347,7 +351,7 @@ class CsstMsDataManager:
assert
self
.
ver_sim
in
[
"C5.1"
,
"C5.2"
]
assert
self
.
ver_sim
in
[
"C5.1"
,
"C5.2"
]
fn
=
"{}_{}_{}_CRS_{}_{}_{}_{:02d}_L0_1.fits"
.
format
(
fn
=
"{}_{}_{}_CRS_{}_{}_{}_{:02d}_L0_1.fits"
.
format
(
self
.
_telescope
,
self
.
_instrument
,
self
.
_survey
,
self
.
_telescope
,
self
.
_instrument
,
self
.
_survey
,
self
.
_
exp_start
,
self
.
_
exp_stop
,
self
.
_exp
_id
,
detector
)
self
.
exp_start
,
self
.
exp_stop
,
self
.
obs
_id
,
detector
)
return
os
.
path
.
join
(
self
.
dir_l0
,
fn
)
return
os
.
path
.
join
(
self
.
dir_l0
,
fn
)
def
l1_detector
(
self
,
detector
=
6
,
post
=
"img.fits"
):
def
l1_detector
(
self
,
detector
=
6
,
post
=
"img.fits"
):
...
@@ -369,7 +373,7 @@ class CsstMsDataManager:
...
@@ -369,7 +373,7 @@ class CsstMsDataManager:
assert
self
.
ver_sim
in
[
"C5.1"
,
"C5.2"
]
assert
self
.
ver_sim
in
[
"C5.1"
,
"C5.2"
]
fn
=
"{}_{}_{}_SCI_{}_{}_{}_{:02d}_{}"
.
format
(
fn
=
"{}_{}_{}_SCI_{}_{}_{}_{:02d}_{}"
.
format
(
self
.
_telescope
,
self
.
_instrument
,
self
.
_survey
,
self
.
_telescope
,
self
.
_instrument
,
self
.
_survey
,
self
.
_
exp_start
,
self
.
_
exp_stop
,
self
.
_exp
_id
,
detector
,
post
)
self
.
exp_start
,
self
.
exp_stop
,
self
.
obs
_id
,
detector
,
post
)
return
os
.
path
.
join
(
self
.
dir_l1
,
fn
)
return
os
.
path
.
join
(
self
.
dir_l1
,
fn
)
def
get_bias
(
self
,
detector
=
6
):
def
get_bias
(
self
,
detector
=
6
):
...
@@ -576,7 +580,7 @@ class CsstMsDataManager:
...
@@ -576,7 +580,7 @@ class CsstMsDataManager:
if
os
.
uname
()[
1
]
==
"ubuntu"
:
# use pml test node
if
os
.
uname
()[
1
]
==
"ubuntu"
:
# use pml test node
dfs_root
=
"/share/dfs"
dfs_root
=
"/share/dfs"
else
:
# in docker
else
:
# in docker
dfs_root
=
"/dfsroot"
dfs_root
=
"/dfsroot"
# (clear and) make directories
# (clear and) make directories
...
...
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