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
1f9bff72
Commit
1f9bff72
authored
Sep 29, 2022
by
BO ZHANG
🏀
Browse files
updated CsstMsDataManager
parent
f83bc722
Changes
2
Show whitespace changes
Inline
Side-by-side
csst_common/data_manager.py
View file @
1f9bff72
...
@@ -331,7 +331,7 @@ class CsstMsDataManager:
...
@@ -331,7 +331,7 @@ class CsstMsDataManager:
path_aux
=
"/nfsdata/users/cham/L1Test/ref_C5.2/MSC_{}_*_{:02d}_combine.fits"
path_aux
=
"/nfsdata/users/cham/L1Test/ref_C5.2/MSC_{}_*_{:02d}_combine.fits"
dir_pcref
=
"/nfsdata/users/csstpipeline/L1Pipeline/msc/gaia_dr3/"
dir_pcref
=
"/nfsdata/users/csstpipeline/L1Pipeline/msc/gaia_dr3/"
elif
hostname
==
"dandelion"
and
datatype
==
"sls"
:
elif
hostname
==
"dandelion"
and
datatype
==
"sls"
:
dir_l0
=
"/nfsdata/share/csst_simulation_data/Cycle-5-SimuData/
multipleBandsImaging
/"
\
dir_l0
=
"/nfsdata/share/csst_simulation_data/Cycle-5-SimuData/
slitlessSpectroscopy
/"
\
"NGP_AstrometryON_shearOFF_Spec/MSC_{:07d}/"
.
format
(
exposure_id
)
"NGP_AstrometryON_shearOFF_Spec/MSC_{:07d}/"
.
format
(
exposure_id
)
path_aux
=
""
path_aux
=
""
dir_pcref
=
""
dir_pcref
=
""
...
@@ -663,50 +663,3 @@ class CsstMbiDataManager:
...
@@ -663,50 +663,3 @@ class CsstMbiDataManager:
raise
ValueError
(
"@DM: invalid hostname {}!"
.
format
(
hostname
))
raise
ValueError
(
"@DM: invalid hostname {}!"
.
format
(
hostname
))
return
CsstMbiDataManager
(
ver_sim
=
ver_sim
,
dir_l0
=
dir_l0
,
dir_l1
=
dir_l1
,
dir_pcref
=
dir_pcref
,
path_aux
=
path_aux
)
return
CsstMbiDataManager
(
ver_sim
=
ver_sim
,
dir_l0
=
dir_l0
,
dir_l1
=
dir_l1
,
dir_pcref
=
dir_pcref
,
path_aux
=
path_aux
)
# DIR_SIM = {
# ("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/"
# "NGP_AstrometryON_shearOFF/MSC_{:07d}/",
# }
if
__name__
==
"__main__"
:
# test C3
dm
=
CsstMbiDataManager
(
ver_sim
=
"C3"
,
dir_l0
=
"/data/L1Pipeline/msc/MSC_0000020"
,
dir_l1
=
"/data/L1Pipeline/msc/work"
)
print
(
"----- L0 images -----"
)
print
(
dm
.
l0_detector
(
detector
=
6
))
print
(
os
.
path
.
exists
(
dm
.
l0_detector
(
detector
=
6
)))
print
(
"----- L0 crs -----"
)
print
(
dm
.
l0_crs
(
detector
=
6
))
print
(
os
.
path
.
exists
(
dm
.
l0_detector
(
detector
=
8
)))
print
(
"----- L0 input cat -----"
)
print
(
dm
.
l0_cat
(
8
))
print
(
os
.
path
.
exists
(
dm
.
l0_cat
(
detector
=
8
)))
print
(
"----- available detectors -----"
)
print
(
dm
.
available_detectors
)
print
(
"----- L1 images -----"
)
print
(
dm
.
l1_detector
(
25
,
"img.fits"
))
# test C5.1
dm
=
CsstMbiDataManager
(
ver_sim
=
"C5.1"
,
dir_l0
=
"/data/sim_data/MSC_0000100"
,
dir_l1
=
"/home/user/L1Pipeline/msc/work"
)
print
(
"----- available detectors -----"
)
print
(
dm
.
available_detectors
)
for
detector
in
dm
.
available_detectors
[:
2
]:
print
(
"----- L0 images -----"
)
print
(
dm
.
l0_detector
(
detector
=
detector
))
print
(
os
.
path
.
exists
(
dm
.
l0_detector
(
detector
=
detector
)))
print
(
"----- L0 crs -----"
)
print
(
dm
.
l0_crs
(
detector
=
detector
))
print
(
os
.
path
.
exists
(
dm
.
l0_detector
(
detector
=
detector
)))
print
(
"----- L0 input cat -----"
)
print
(
dm
.
l0_cat
(
detector
=
detector
))
print
(
os
.
path
.
exists
(
dm
.
l0_cat
(
detector
=
detector
)))
print
(
"----- L0 input log -----"
)
print
(
dm
.
l0_log
(
detector
=
detector
))
print
(
os
.
path
.
exists
(
dm
.
l0_log
(
detector
=
detector
)))
print
(
"----- L1 images -----"
)
print
(
dm
.
l1_detector
(
detector
,
post
=
"img.fits"
))
tests/test_data_manager.py
View file @
1f9bff72
...
@@ -33,6 +33,8 @@ class TestCsstMsDataManager(unittest.TestCase):
...
@@ -33,6 +33,8 @@ class TestCsstMsDataManager(unittest.TestCase):
def
setUp
(
self
)
->
None
:
def
setUp
(
self
)
->
None
:
self
.
dm_mbi
=
CsstMsDataManager
.
quickstart
(
ver_sim
=
"C5.2"
,
datatype
=
"mbi"
,
dir_l1
=
"."
,
exposure_id
=
100
)
self
.
dm_mbi
=
CsstMsDataManager
.
quickstart
(
ver_sim
=
"C5.2"
,
datatype
=
"mbi"
,
dir_l1
=
"."
,
exposure_id
=
100
)
self
.
dm_sls
=
CsstMsDataManager
.
quickstart
(
ver_sim
=
"C5.2"
,
datatype
=
"sls"
,
dir_l1
=
"."
,
exposure_id
=
100
)
self
.
dm_sls
=
CsstMsDataManager
.
quickstart
(
ver_sim
=
"C5.2"
,
datatype
=
"sls"
,
dir_l1
=
"."
,
exposure_id
=
100
)
self
.
dm_mbi
.
set_detectors
(
detectors
=
None
)
self
.
dm_sls
.
set_detectors
(
detectors
=
None
)
def
test_mbi_data_existence
(
self
):
def
test_mbi_data_existence
(
self
):
self
.
assertTrue
(
self
.
dm_mbi
.
available_detectors
==
CP
[
"mbi"
][
"detectors"
])
self
.
assertTrue
(
self
.
dm_mbi
.
available_detectors
==
CP
[
"mbi"
][
"detectors"
])
...
@@ -51,8 +53,3 @@ class TestCsstMsDataManager(unittest.TestCase):
...
@@ -51,8 +53,3 @@ class TestCsstMsDataManager(unittest.TestCase):
self
.
assertTrue
(
os
.
path
.
exists
(
self
.
dm_sls
.
l0_crs
(
6
)))
self
.
assertTrue
(
os
.
path
.
exists
(
self
.
dm_sls
.
l0_crs
(
6
)))
self
.
assertTrue
(
isinstance
(
self
.
dm_sls
.
l1_detector
(
6
,
post
=
"img.fits"
),
str
))
self
.
assertTrue
(
isinstance
(
self
.
dm_sls
.
l1_detector
(
6
,
post
=
"img.fits"
),
str
))
self
.
assertTrue
(
isinstance
(
self
.
dm_sls
.
l1_file
(
name
=
"some_file.ext"
,
comment
=
"a demo file"
),
str
))
self
.
assertTrue
(
isinstance
(
self
.
dm_sls
.
l1_file
(
name
=
"some_file.ext"
,
comment
=
"a demo file"
),
str
))
# class TestParams(unittest.TestCase):
# def test_params(self):
# self.assertTrue(True)
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