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
8519b59b
Commit
8519b59b
authored
Mar 17, 2023
by
BO ZHANG
🏀
Browse files
compatible with C5.2 naming convention
parent
c283cd15
Changes
1
Hide whitespace changes
Inline
Side-by-side
csst_common/data_manager.py
View file @
8519b59b
...
...
@@ -380,23 +380,42 @@ class CsstMsDataManager:
raise
FileNotFoundError
(
f
"No file found with pattern
{
pattern
}
in
{
dir_l0
}
"
)
# parse filename
pattern
=
re
.
compile
(
r
"(?P<telescope>[A-Z]+)_"
r
"(?P<instrument>[A-Z]+)_"
r
"(?P<project>[A-Z]+)_"
r
"(?P<obs_type>[A-Z]+)_"
r
"(?P<exp_start>[0-9]{14})_"
r
"(?P<exp_stop>[0-9]{14})_"
r
"(?P<obs_id>[0-9]{11})_"
r
"(?P<detector>[0-9]{2})_"
r
"L(?P<level>[0-9]{1})_"
r
"V(?P<version>[0-9]{2})"
r
".(?P<ext>[a-z]{4})"
)
mo
=
re
.
fullmatch
(
pattern
,
fps_img
[
0
])
assert
mo
is
not
None
mogd
=
mo
.
groupdict
()
mogd
.
pop
(
"detector"
)
if
ver_sim
==
"C6.2"
:
pattern
=
re
.
compile
(
r
"(?P<telescope>[A-Z]+)_"
r
"(?P<instrument>[A-Z]+)_"
r
"(?P<project>[A-Z]+)_"
r
"(?P<obs_type>[A-Z]+)_"
r
"(?P<exp_start>[0-9]{14})_"
r
"(?P<exp_stop>[0-9]{14})_"
r
"(?P<obs_id>[0-9]{11})_"
r
"(?P<detector>[0-9]{2})_"
r
"L(?P<level>[0-9]{1})_"
r
"V(?P<version>[0-9]{2})"
r
".(?P<ext>[a-z]{4})"
)
mo
=
re
.
fullmatch
(
pattern
,
fps_img
[
0
])
assert
mo
is
not
None
mogd
=
mo
.
groupdict
()
mogd
.
pop
(
"detector"
)
elif
ver_sim
==
"C5.2"
:
pattern
=
re
.
compile
(
r
"(?P<telescope>[A-Z]+)_"
r
"(?P<instrument>[A-Z]+)_"
r
"(?P<project>[A-Z]+)_"
r
"(?P<obs_type>[A-Z]+)_"
r
"(?P<exp_start>[0-9]{14})_"
r
"(?P<exp_stop>[0-9]{14})_"
r
"(?P<obs_id>[0-9]{11})_"
r
"(?P<detector>[0-9]{2})_"
r
"L(?P<level>[0-9]{1})_"
r
"(?P<version>[0-9]{1})"
r
".(?P<ext>[a-z]{4})"
)
mo
=
re
.
fullmatch
(
pattern
,
fps_img
[
0
])
assert
mo
is
not
None
mogd
=
mo
.
groupdict
()
mogd
.
pop
(
"detector"
)
# available detectors
available_detectors
=
[
int
(
re
.
fullmatch
(
pattern
,
fp
)[
"detector"
])
for
fp
in
fps_img
]
...
...
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