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

compatible with C5.2 naming convention

parent c283cd15
Loading
Loading
Loading
Loading
+36 −17
Original line number Diff line number Diff line
@@ -380,6 +380,7 @@ class CsstMsDataManager:
            raise FileNotFoundError(f"No file found with pattern {pattern} in {dir_l0}")

        # parse filename
        if ver_sim == "C6.2":
            pattern = re.compile(
                r"(?P<telescope>[A-Z]+)_"
                r"(?P<instrument>[A-Z]+)_"
@@ -397,6 +398,24 @@ class CsstMsDataManager:
            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]