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
f2ae94cc
Commit
f2ae94cc
authored
Oct 04, 2022
by
BO ZHANG
🏀
Browse files
tweaks
parent
1424860c
Changes
1
Hide whitespace changes
Inline
Side-by-side
csst_common/data_manager.py
View file @
f2ae94cc
...
@@ -6,6 +6,7 @@ Author: Bo Zhang
...
@@ -6,6 +6,7 @@ Author: Bo Zhang
Created: 2022-09-13
Created: 2022-09-13
Modified-History:
Modified-History:
2022-09-13, Bo Zhang, created
2022-09-13, Bo Zhang, created
2022-09-13, Bo Zhang, added CsstMbiDataManager
2022-09-29, Bo Zhang, favor CsstMsDataManager instead of CsstMbiDataManager
2022-09-29, Bo Zhang, favor CsstMsDataManager instead of CsstMbiDataManager
"""
"""
import
os
import
os
...
@@ -40,7 +41,7 @@ class CsstMsDataManager:
...
@@ -40,7 +41,7 @@ class CsstMsDataManager:
"""
"""
def
__init__
(
self
,
ver_sim
=
"C5.2"
,
dir_l0
=
""
,
dir_l1
=
""
,
dir_pcref
=
""
,
path_aux
=
""
,
force
_all_detectors
=
False
,
def
__init__
(
self
,
ver_sim
=
"C5.2"
,
dir_l0
=
""
,
dir_l1
=
""
,
dir_pcref
=
""
,
path_aux
=
""
,
assert
_all_detectors
=
False
,
datatype
=
"mbi"
):
datatype
=
"mbi"
):
""" initialize the multi-band imaging data manager
""" initialize the multi-band imaging data manager
...
@@ -54,9 +55,10 @@ class CsstMsDataManager:
...
@@ -54,9 +55,10 @@ class CsstMsDataManager:
L1 directory
L1 directory
dir_pcref: str
dir_pcref: str
position calibration data directory
position calibration data directory
will be removed in the next version
path_aux: str
path_aux: str
aux data directory (bias, flat, dark)
aux data directory (bias, flat, dark)
force
_all_detectors: bool
assert
_all_detectors: bool
if True, assert data for all detectors are available
if True, assert data for all detectors are available
datatype: str
datatype: str
{"mbi", "sls"}
{"mbi", "sls"}
...
@@ -84,8 +86,11 @@ class CsstMsDataManager:
...
@@ -84,8 +86,11 @@ class CsstMsDataManager:
>>> dm_mbi.l1_file("flipped_image.fits")
>>> dm_mbi.l1_file("flipped_image.fits")
"""
"""
assert
ver_sim
in
CP
[
"sim"
][
"versions"
]
assert
ver_sim
in
CP
[
"sim"
][
"versions"
]
self
.
ver_sim
=
ver_sim
assert
datatype
in
[
"mbi"
,
"sls"
]
assert
datatype
in
[
"mbi"
,
"sls"
]
self
.
datatype
=
datatype
if
datatype
==
"mbi"
:
if
datatype
==
"mbi"
:
# MBI
# MBI
self
.
valid_detectors
=
CP
[
"mbi"
][
"detectors"
]
self
.
valid_detectors
=
CP
[
"mbi"
][
"detectors"
]
...
@@ -107,7 +112,7 @@ class CsstMsDataManager:
...
@@ -107,7 +112,7 @@ class CsstMsDataManager:
fps_img
=
self
.
glob_image
(
dir_l0
,
ver_sim
=
ver_sim
)
fps_img
=
self
.
glob_image
(
dir_l0
,
ver_sim
=
ver_sim
)
fps_cat
=
self
.
glob_cat
(
dir_l0
,
ver_sim
=
ver_sim
)
fps_cat
=
self
.
glob_cat
(
dir_l0
,
ver_sim
=
ver_sim
)
if
force
_all_detectors
:
if
assert
_all_detectors
:
assert
len
(
fps_img
)
==
len
(
self
.
valid_detectors
)
assert
len
(
fps_img
)
==
len
(
self
.
valid_detectors
)
else
:
else
:
assert
len
(
fps_img
)
>
0
assert
len
(
fps_img
)
>
0
...
@@ -636,11 +641,11 @@ class CsstMbiDataManager:
...
@@ -636,11 +641,11 @@ class CsstMbiDataManager:
Parameters
Parameters
----------
----------
ver_sim:
ver_sim:
str
{"C5.2"}
{"C5.2"}
dir_l1:
dir_l1:
str
output directory
output directory
exposure_id:
exposure_id:
int
21-154 for C5.2
21-154 for C5.2
Returns
Returns
...
...
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