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
3380958f
Commit
3380958f
authored
Aug 31, 2022
by
BO ZHANG
🏀
Browse files
updated datamanager
parent
e39ba052
Changes
2
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
3380958f
...
...
@@ -70,9 +70,11 @@ dm.l1_file("flipped_image.fits")
```
a shortcut for test dataset
```
python
from
csst_common.data_manager
import
CsstMbiDataManager
CsstMbiDataManager
.
quick_dataset
(
hostname
=
"dandelion"
,
ver_sim
=
"C5.2"
,
dir_l1
=
"."
,
exposure_id
=
100
)
CsstMbiDataManager
.
quickstart
(
hostname
=
"dandelion"
,
ver_sim
=
"C5.2"
,
dir_l1
=
"."
,
exposure_id
=
100
)
```
## algorithm description
...
...
csst_common/data_manager.py
View file @
3380958f
import
os
import
glob
import
re
...
...
@@ -29,13 +28,13 @@ class CsstMbiDataManager:
"""
def
__init__
(
self
,
ver_sim
=
"C5.
1
"
,
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
=
""
,
force_all_detectors
=
False
):
""" initialize the multi-band imaging data manager
Parameters
----------
ver_sim: str
version of simulation data, see csst_common.params.
cp.sim.VERSIONS
version of simulation data, see csst_common.params.
CP
dir_l0: str
L0 directory
dir_l1: str
...
...
@@ -92,8 +91,8 @@ class CsstMbiDataManager:
# get info
# print(re.split(r"[_.]", fps[0]))
self
.
_instrument
,
self
.
_survey
,
\
self
.
_exp_start
,
self
.
_exp_id
,
\
_detector
,
self
.
_l0_suffix
,
_ext
=
re
.
split
(
r
"[_.]"
,
fps_img
[
0
])
self
.
_exp_start
,
self
.
_exp_id
,
\
_detector
,
self
.
_l0_suffix
,
_ext
=
re
.
split
(
r
"[_.]"
,
fps_img
[
0
])
self
.
_cat_id
=
re
.
split
(
r
"[_.]"
,
fps_cat
[
0
])[
1
]
self
.
_exp_start
=
int
(
self
.
_exp_start
)
...
...
@@ -107,8 +106,8 @@ class CsstMbiDataManager:
# get info
# print(re.split(r"[_.]", fps[0]))
self
.
_telescope
,
self
.
_instrument
,
self
.
_survey
,
self
.
_imagetype
,
\
self
.
_exp_start
,
self
.
_exp_stop
,
self
.
_exp_id
,
\
_detector
,
self
.
_l0_suffix
,
self
.
_version
,
_ext
=
re
.
split
(
r
"[_.]"
,
fps_img
[
0
])
self
.
_exp_start
,
self
.
_exp_stop
,
self
.
_exp_id
,
\
_detector
,
self
.
_l0_suffix
,
self
.
_version
,
_ext
=
re
.
split
(
r
"[_.]"
,
fps_img
[
0
])
self
.
_cat_id
=
re
.
split
(
r
"[_.]"
,
fps_cat
[
0
])[
1
]
self
.
_exp_start
=
int
(
self
.
_exp_start
)
...
...
@@ -156,20 +155,20 @@ class CsstMbiDataManager:
self
.
_instrument
,
self
.
_cat_id
,
self
.
_exp_id
-
100000000
,
detector
)
elif
self
.
ver_sim
==
"C5.1"
:
fn
=
"{}_{}_chip_{:02d}_filt_{}.cat"
.
format
(
self
.
_instrument
,
self
.
_exp_id
-
90000000
,
detector
,
cp
.
mbi
.
DETECTOR2FILTER
[
detector
])
self
.
_instrument
,
self
.
_exp_id
-
90000000
,
detector
,
CP
[
"mbi"
][
"detector2filter"
])
elif
self
.
ver_sim
==
"C5.2"
:
fn
=
"{}_{}_chip_{:02d}_filt_{}.cat"
.
format
(
self
.
_instrument
,
self
.
_exp_id
,
detector
,
cp
.
mbi
.
DETECTOR2FILTER
[
detector
])
self
.
_instrument
,
self
.
_exp_id
,
detector
,
CP
[
"mbi"
][
"detector2filter"
])
return
os
.
path
.
join
(
self
.
dir_l0
,
fn
)
def
l0_log
(
self
,
detector
=
6
):
""" L0 log file path """
if
self
.
ver_sim
==
"C5.1"
:
fn
=
"{}_{}_chip_{:02d}_filt_{}.log"
.
format
(
self
.
_instrument
,
self
.
_exp_id
-
90000000
,
detector
,
cp
.
mbi
.
DETECTOR2FILTER
[
detector
])
self
.
_instrument
,
self
.
_exp_id
-
90000000
,
detector
,
CP
[
"mbi"
][
"detector2filter"
])
elif
self
.
ver_sim
==
"C5.2"
:
fn
=
"{}_{}_chip_{:02d}_filt_{}.log"
.
format
(
self
.
_instrument
,
self
.
_exp_id
,
detector
,
cp
.
mbi
.
DETECTOR2FILTER
[
detector
])
self
.
_instrument
,
self
.
_exp_id
,
detector
,
CP
[
"mbi"
][
"detector2filter"
])
return
os
.
path
.
join
(
self
.
dir_l0
,
fn
)
def
l0_detector
(
self
,
detector
=
6
):
...
...
@@ -345,9 +344,9 @@ class CsstMbiDataManager:
DIR_SIM
=
{
(
"C5.2"
,
"dandelion"
):
"/nfsdata/share/csst_simulation_data/Cycle-5-SimuData/multipleBandsImaging/"
\
(
"C5.2"
,
"dandelion"
):
"/nfsdata/share/csst_simulation_data/Cycle-5-SimuData/multipleBandsImaging/"
"NGP_AstrometryON_shearOFF/MSC_{:07d}/"
,
(
"C5.2"
,
"ubuntu"
):
"/nfsdata/share/csst_simulation_data/Cycle-5-SimuData/multipleBandsImaging/"
\
(
"C5.2"
,
"ubuntu"
):
"/nfsdata/share/csst_simulation_data/Cycle-5-SimuData/multipleBandsImaging/"
"NGP_AstrometryON_shearOFF/MSC_{:07d}/"
,
}
...
...
@@ -369,7 +368,7 @@ if __name__ == "__main__":
print
(
"----- available detectors -----"
)
print
(
dm
.
available_detectors
)
print
(
"----- L1 images -----"
)
print
(
dm
.
l1_detector
(
25
,
"img
"
,
"
fits"
))
print
(
dm
.
l1_detector
(
25
,
"img
.
fits"
))
# test C5.1
import
os
...
...
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