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:
target_detectors
:
Union
[
None
,
list
,
int
]
=
None
,
dir_l0
:
str
=
"."
,
dir_l1
:
str
=
"."
,
path_aux
:
str
=
"
"
,
# bias dark flat
path_aux
:
str
=
"
/L1Pipeline/aux"
,
# aux dir
use_dfs
:
bool
=
False
,
dfs_node
:
str
=
"kmust"
,
dfs_root
:
str
=
"/share/dfs"
,
...
...
@@ -213,6 +213,7 @@ class CsstMsDataManager:
self
.
dir_l0
=
dir_l0
self
.
dir_l1
=
dir_l1
self
.
path_aux
=
path_aux
self
.
ref_version
=
None
# record hard code names in history
self
.
hardcode_history
=
[]
...
...
@@ -435,39 +436,44 @@ class CsstMsDataManager:
def
get_bias
(
self
,
detector
=
6
):
""" get bias data """
if
self
.
custom_bias
is
None
:
if
self
.
datatype
==
"mbi"
:
return
glob
.
glob
(
self
.
path_aux
.
format
(
"CLB"
,
detector
))[
0
]
else
:
return
self
.
path_aux
.
format
(
detector
,
"bias"
)
return
os
.
path
.
join
(
self
.
path_aux
,
"C6.1_ref_crds"
,
"csst_msc_{}_{:02d}_{:04d}.fits"
.
format
(
"bias"
,
detector
,
1
if
self
.
ref_version
is
None
else
self
.
ref_version
)
)
else
:
return
self
.
custom_bias
.
format
(
"bias"
,
detector
)
def
get_dark
(
self
,
detector
=
6
):
""" get dark data """
if
self
.
custom_dark
is
None
:
if
self
.
datatype
==
"mbi"
:
return
glob
.
glob
(
self
.
path_aux
.
format
(
"CLD"
,
detector
))[
0
]
else
:
return
self
.
path_aux
.
format
(
detector
,
"dark"
)
return
os
.
path
.
join
(
self
.
path_aux
,
"C6.1_ref_crds"
,
"csst_msc_{}_{:02d}_{:04d}.fits"
.
format
(
"dark"
,
detector
,
1
if
self
.
ref_version
is
None
else
self
.
ref_version
)
)
else
:
return
self
.
custom_dark
.
format
(
"dark"
,
detector
)
def
get_flat
(
self
,
detector
=
6
):
""" get flat data """
if
self
.
custom_flat
is
None
:
if
self
.
datatype
==
"mbi"
:
return
glob
.
glob
(
self
.
path_aux
.
format
(
"CLF"
,
detector
))[
0
]
else
:
return
self
.
path_aux
.
format
(
detector
,
"flat"
)
return
os
.
path
.
join
(
self
.
path_aux
,
"C6.1_ref_crds"
,
"csst_msc_{}_{:02d}_{:04d}.fits"
.
format
(
"flat"
,
detector
,
1
if
self
.
ref_version
is
None
else
self
.
ref_version
)
)
else
:
return
self
.
custom_flat
.
format
(
"flat"
,
detector
)
def
get_axeconf
(
self
):
if
os
.
uname
()[
1
]
==
"dandelion"
:
return
"/home/csstpipeline/L1Pipeline/aux/axeconf"
else
:
# in docker
return
"/L1Pipeline/aux/axeconf"
return
os
.
path
.
join
(
self
.
path_aux
,
"axeconf"
)
# "/home/csstpipeline/L1Pipeline/aux/axeconf"
def
l1_file
(
self
,
name
=
""
,
comment
=
""
):
""" L1 file path
...
...
@@ -548,11 +554,11 @@ class CsstMsDataManager:
if
hostname
==
"dandelion"
and
datatype
==
"mbi"
:
dir_l0
=
"/nfsdata/share/csst_simulation_data/Cycle-5-SimuData/multipleBandsImaging/"
\
"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"
:
dir_l0
=
"/nfsdata/share/csst_simulation_data/Cycle-5-SimuData/slitlessSpectroscopy/"
\
"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
elif
hostname
==
"ubuntu"
and
datatype
==
"mbi"
:
...
...
@@ -568,7 +574,8 @@ class CsstMsDataManager:
return
CsstMsDataManager
.
from_dir
(
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
):
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