From 03f43f98205852a1ff175c260a74e7add671dbca Mon Sep 17 00:00:00 2001 From: BO ZHANG Date: Wed, 24 May 2023 15:14:20 +0800 Subject: [PATCH] add CsstMsFile --- csst_common/data_manager.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/csst_common/data_manager.py b/csst_common/data_manager.py index a54004d..127ae30 100644 --- a/csst_common/data_manager.py +++ b/csst_common/data_manager.py @@ -1017,7 +1017,6 @@ class CsstMsFile(dict): self.filename = os.path.basename(filepath) self.dir_l0 = os.path.dirname(filepath) - print("parsing", filepath) # parse filename pattern = re.compile( r"(?P[A-Z]+)_" @@ -1033,7 +1032,11 @@ class CsstMsFile(dict): r"(?P[a-zA-Z._]+)" ) mo = re.fullmatch(pattern, self.filename) - assert mo is not None + try: + assert mo is not None + except AssertionError as ae: + print(self.filename) + raise ae mogd = mo.groupdict() # mogd.pop("detector") @@ -1079,6 +1082,8 @@ class CsstMsFile(dict): return CsstMsFile( filepath=rec["data"].file_path, ver_sim=ver_sim, dir_l0=dir_l0, dir_l1=dir_l1, dfs_root=dfs_root, **header) + def __repr__(self): + return f"CsstMsFile({self.filename})" # file = CsstMsFile( # "L1/MSC/SCI/62173/10160000108/CSST_MSC_MS_SCI_20290206174352_20290206174622_10160000108_21_L1_V01.fits") # -- GitLab