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
082956f0
Commit
082956f0
authored
Aug 19, 2023
by
BO ZHANG
🏀
Browse files
use local reference files as fallback
parent
6fb3c1db
Pipeline
#1163
failed with stage
in 0 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
csst_common/data_manager.py
View file @
082956f0
...
...
@@ -529,27 +529,30 @@ class CsstMsDataManager:
'shutter': '/crdsroot/references/msc/csst_msc_ms_shutter_11_000001.fits'}
"""
if
self
.
crds
.
is_available
:
print
(
"CRDS available, use refs from CRDS ..."
)
return
self
.
crds
.
retry
(
self
.
crds
.
get_refs
,
3
,
file_path
=
self
.
l0_detector
(
detector
)
)
else
:
print
(
"CRDS unavailable, use refs from local files ..."
)
refs
=
dict
()
if
self
.
datatype
==
"mbi"
:
ref_types
=
[
"bias"
,
"dark"
,
"ledflat"
,
"shutter"
]
else
:
ref_types
=
[
"bias"
,
"dark"
,
"ledflat"
]
for
ref_type
in
ref_types
:
fp
=
os
.
path
.
join
(
self
.
path_aux
,
"C6.2_ref_crds"
,
"csst_msc_ms_{}_{:02d}_{:06d}.fits"
.
format
(
ref_type
,
detector
,
1
)
try
:
print
(
"CRDS available, use refs from CRDS ..."
)
return
self
.
crds
.
retry
(
self
.
crds
.
get_refs
,
3
,
file_path
=
self
.
l0_detector
(
detector
)
)
assert
os
.
path
.
exists
(
fp
),
f
"File not found: [
{
fp
}
]"
refs
[
ref_type
]
=
fp
return
refs
except
BaseException
as
e
:
print
(
"CRDS reference access failed! "
,
e
)
print
(
"Use refs from local files ..."
)
refs
=
dict
()
if
self
.
datatype
==
"mbi"
:
ref_types
=
[
"bias"
,
"dark"
,
"ledflat"
,
"shutter"
]
else
:
ref_types
=
[
"bias"
,
"dark"
,
"ledflat"
]
for
ref_type
in
ref_types
:
fp
=
os
.
path
.
join
(
self
.
path_aux
,
"C6.2_ref_crds"
,
"csst_msc_ms_{}_{:02d}_{:06d}.fits"
.
format
(
ref_type
,
detector
,
1
)
)
assert
os
.
path
.
exists
(
fp
),
f
"File not found: [
{
fp
}
]"
refs
[
ref_type
]
=
fp
return
refs
def
get_bias
(
self
,
detector
=
6
):
""" get bias data """
...
...
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