Commit 8519b59b authored by BO ZHANG's avatar BO ZHANG 🏀
Browse files

compatible with C5.2 naming convention

parent c283cd15
...@@ -380,23 +380,42 @@ class CsstMsDataManager: ...@@ -380,23 +380,42 @@ class CsstMsDataManager:
raise FileNotFoundError(f"No file found with pattern {pattern} in {dir_l0}") raise FileNotFoundError(f"No file found with pattern {pattern} in {dir_l0}")
# parse filename # parse filename
pattern = re.compile( if ver_sim == "C6.2":
r"(?P<telescope>[A-Z]+)_" pattern = re.compile(
r"(?P<instrument>[A-Z]+)_" r"(?P<telescope>[A-Z]+)_"
r"(?P<project>[A-Z]+)_" r"(?P<instrument>[A-Z]+)_"
r"(?P<obs_type>[A-Z]+)_" r"(?P<project>[A-Z]+)_"
r"(?P<exp_start>[0-9]{14})_" r"(?P<obs_type>[A-Z]+)_"
r"(?P<exp_stop>[0-9]{14})_" r"(?P<exp_start>[0-9]{14})_"
r"(?P<obs_id>[0-9]{11})_" r"(?P<exp_stop>[0-9]{14})_"
r"(?P<detector>[0-9]{2})_" r"(?P<obs_id>[0-9]{11})_"
r"L(?P<level>[0-9]{1})_" r"(?P<detector>[0-9]{2})_"
r"V(?P<version>[0-9]{2})" r"L(?P<level>[0-9]{1})_"
r".(?P<ext>[a-z]{4})" 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 mo = re.fullmatch(pattern, fps_img[0])
mogd = mo.groupdict() assert mo is not None
mogd.pop("detector") 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
available_detectors = [int(re.fullmatch(pattern, fp)["detector"]) for fp in fps_img] available_detectors = [int(re.fullmatch(pattern, fp)["detector"]) for fp in fps_img]
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment