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
b3dd2837
Commit
b3dd2837
authored
Jan 09, 2023
by
BO ZHANG
🏀
Browse files
compatible with CRDS ref files
parent
71f3aba8
Changes
1
Show whitespace changes
Inline
Side-by-side
csst_common/data_manager.py
View file @
b3dd2837
...
@@ -140,7 +140,7 @@ class CsstMsDataManager:
...
@@ -140,7 +140,7 @@ class CsstMsDataManager:
target_detectors
:
Union
[
None
,
list
,
int
]
=
None
,
target_detectors
:
Union
[
None
,
list
,
int
]
=
None
,
dir_l0
:
str
=
"."
,
dir_l0
:
str
=
"."
,
dir_l1
:
str
=
"."
,
dir_l1
:
str
=
"."
,
path_aux
:
str
=
"
"
,
# bias dark flat
path_aux
:
str
=
"
/L1Pipeline/aux"
,
# aux dir
use_dfs
:
bool
=
False
,
use_dfs
:
bool
=
False
,
dfs_node
:
str
=
"kmust"
,
dfs_node
:
str
=
"kmust"
,
dfs_root
:
str
=
"/share/dfs"
,
dfs_root
:
str
=
"/share/dfs"
,
...
@@ -213,6 +213,7 @@ class CsstMsDataManager:
...
@@ -213,6 +213,7 @@ class CsstMsDataManager:
self
.
dir_l0
=
dir_l0
self
.
dir_l0
=
dir_l0
self
.
dir_l1
=
dir_l1
self
.
dir_l1
=
dir_l1
self
.
path_aux
=
path_aux
self
.
path_aux
=
path_aux
self
.
ref_version
=
None
# record hard code names in history
# record hard code names in history
self
.
hardcode_history
=
[]
self
.
hardcode_history
=
[]
...
@@ -435,39 +436,44 @@ class CsstMsDataManager:
...
@@ -435,39 +436,44 @@ class CsstMsDataManager:
def
get_bias
(
self
,
detector
=
6
):
def
get_bias
(
self
,
detector
=
6
):
""" get bias data """
""" get bias data """
if
self
.
custom_bias
is
None
:
if
self
.
custom_bias
is
None
:
if
self
.
datatype
==
"mbi"
:
return
os
.
path
.
join
(
return
glob
.
glob
(
self
.
path_aux
.
format
(
"CLB"
,
detector
))[
0
]
self
.
path_aux
,
else
:
"C6.1_ref_crds"
,
return
self
.
path_aux
.
format
(
detector
,
"bias"
)
"csst_msc_{}_{:02d}_{:04d}.fits"
.
format
(
"bias"
,
detector
,
1
if
self
.
ref_version
is
None
else
self
.
ref_version
)
)
else
:
else
:
return
self
.
custom_bias
.
format
(
"bias"
,
detector
)
return
self
.
custom_bias
.
format
(
"bias"
,
detector
)
def
get_dark
(
self
,
detector
=
6
):
def
get_dark
(
self
,
detector
=
6
):
""" get dark data """
""" get dark data """
if
self
.
custom_dark
is
None
:
if
self
.
custom_dark
is
None
:
if
self
.
datatype
==
"mbi"
:
return
os
.
path
.
join
(
return
glob
.
glob
(
self
.
path_aux
.
format
(
"CLD"
,
detector
))[
0
]
self
.
path_aux
,
else
:
"C6.1_ref_crds"
,
return
self
.
path_aux
.
format
(
detector
,
"dark"
)
"csst_msc_{}_{:02d}_{:04d}.fits"
.
format
(
"dark"
,
detector
,
1
if
self
.
ref_version
is
None
else
self
.
ref_version
)
)
else
:
else
:
return
self
.
custom_dark
.
format
(
"dark"
,
detector
)
return
self
.
custom_dark
.
format
(
"dark"
,
detector
)
def
get_flat
(
self
,
detector
=
6
):
def
get_flat
(
self
,
detector
=
6
):
""" get flat data """
""" get flat data """
if
self
.
custom_flat
is
None
:
if
self
.
custom_flat
is
None
:
if
self
.
datatype
==
"mbi"
:
return
os
.
path
.
join
(
return
glob
.
glob
(
self
.
path_aux
.
format
(
"CLF"
,
detector
))[
0
]
self
.
path_aux
,
else
:
"C6.1_ref_crds"
,
return
self
.
path_aux
.
format
(
detector
,
"flat"
)
"csst_msc_{}_{:02d}_{:04d}.fits"
.
format
(
"flat"
,
detector
,
1
if
self
.
ref_version
is
None
else
self
.
ref_version
)
)
else
:
else
:
return
self
.
custom_flat
.
format
(
"flat"
,
detector
)
return
self
.
custom_flat
.
format
(
"flat"
,
detector
)
def
get_axeconf
(
self
):
def
get_axeconf
(
self
):
if
os
.
uname
()[
1
]
==
"dandelion"
:
return
os
.
path
.
join
(
self
.
path_aux
,
"axeconf"
)
# "/home/csstpipeline/L1Pipeline/aux/axeconf"
return
"/home/csstpipeline/L1Pipeline/aux/axeconf"
else
:
# in docker
return
"/L1Pipeline/aux/axeconf"
def
l1_file
(
self
,
name
=
""
,
comment
=
""
):
def
l1_file
(
self
,
name
=
""
,
comment
=
""
):
""" L1 file path
""" L1 file path
...
@@ -548,11 +554,11 @@ class CsstMsDataManager:
...
@@ -548,11 +554,11 @@ class CsstMsDataManager:
if
hostname
==
"dandelion"
and
datatype
==
"mbi"
:
if
hostname
==
"dandelion"
and
datatype
==
"mbi"
:
dir_l0
=
"/nfsdata/share/csst_simulation_data/Cycle-5-SimuData/multipleBandsImaging/"
\
dir_l0
=
"/nfsdata/share/csst_simulation_data/Cycle-5-SimuData/multipleBandsImaging/"
\
"NGP_AstrometryON_shearOFF/MSC_{:07d}/"
.
format
(
exposure_id
)
"NGP_AstrometryON_shearOFF/MSC_{:07d}/"
.
format
(
exposure_id
)
path_aux
=
"/nfsdata/users/c
ham/L1Test/ref_C5.2/MSC_{}_*_{:02d}_combine.fits
"
path_aux
=
"/nfsdata/users/c
sstpipeline/L1Pipeline/aux
"
elif
hostname
==
"dandelion"
and
datatype
==
"sls"
:
elif
hostname
==
"dandelion"
and
datatype
==
"sls"
:
dir_l0
=
"/nfsdata/share/csst_simulation_data/Cycle-5-SimuData/slitlessSpectroscopy/"
\
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
=
"/nfsdata/
share/csst_simulation_data/Cycle-5-SimuData/slitlessSpectroscopy/csst_{:02d}{}.fits
"
path_aux
=
"/nfsdata/
users/csstpipeline/L1Pipeline/aux
"
# PMO
# PMO
elif
hostname
==
"ubuntu"
and
datatype
==
"mbi"
:
elif
hostname
==
"ubuntu"
and
datatype
==
"mbi"
:
...
@@ -568,7 +574,8 @@ class CsstMsDataManager:
...
@@ -568,7 +574,8 @@ class CsstMsDataManager:
return
CsstMsDataManager
.
from_dir
(
return
CsstMsDataManager
.
from_dir
(
ver_sim
=
ver_sim
,
datatype
=
datatype
,
dir_l0
=
dir_l0
,
dir_l1
=
dir_l1
,
path_aux
=
path_aux
,
ver_sim
=
ver_sim
,
datatype
=
datatype
,
dir_l0
=
dir_l0
,
dir_l1
=
dir_l1
,
path_aux
=
path_aux
,
use_dfs
=
use_dfs
,
dfs_node
=
dfs_node
,
n_jobs
=
n_jobs
,
backend
=
backend
)
use_dfs
=
use_dfs
,
dfs_node
=
dfs_node
,
n_jobs
=
n_jobs
,
backend
=
backend
)
def
__repr__
(
self
):
def
__repr__
(
self
):
lines
=
""
lines
=
""
...
...
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