diff --git a/csst_common/data_manager.py b/csst_common/data_manager.py index d6cab3509c61f7c357b7b25a3a5b1c9ef0f9a9fb..4c42cec974ebebea6713e5488a09a53c1d8c94e0 100644 --- a/csst_common/data_manager.py +++ b/csst_common/data_manager.py @@ -463,7 +463,8 @@ class CsstMsDataManager: assert detector in self.available_detectors fn = f"{self.instrument}_{self.obs_id}_chip_{detector:02d}_filt_{self.detector2filter[detector]}.cat" fp = os.path.join(self.dir_l0, fn) - assert os.path.exists(fp) + if not os.path.exists(fp): + raise FileNotFoundError(f"File not found: {fp}") return fp def l0_log(self, detector=6): @@ -471,7 +472,8 @@ class CsstMsDataManager: assert detector in self.available_detectors fn = f"{self.instrument}_{self.obs_id}_chip_{detector:02d}_filt_{self.detector2filter[detector]}.log" fp = os.path.join(self.dir_l0, fn) - assert os.path.exists(fp) + if not os.path.exists(fp): + raise FileNotFoundError(f"File not found: {fp}") return fp def l0_detector(self, detector=6): @@ -484,8 +486,9 @@ class CsstMsDataManager: fn = f"{self.telescope}_{self.instrument}_{self.project}_{self.obs_type}_{self.exp_start}_" \ f"{self.exp_stop}_{self.obs_id}_{detector:02d}_L{self.level}_V{self.version}.{self.ext}" fp = os.path.join(self.dir_l0, fn) - assert os.path.exists(fp) - return os.path.join(self.dir_l0, fn) + if not os.path.exists(fp): + raise FileNotFoundError(f"File not found: {fp}") + return fp def l0_crs(self, detector=6): """ L0 cosmic ray file path """ @@ -497,8 +500,9 @@ class CsstMsDataManager: fn = f"{self.telescope}_{self.instrument}_{self.project}_CRS_{self.exp_start}_" \ f"{self.exp_stop}_{self.obs_id}_{detector:02d}_L{self.level}_V{self.version}.{self.ext}" fp = os.path.join(self.dir_l0, fn) - assert os.path.exists(fp) - return os.path.join(self.dir_l0, fn) + if not os.path.exists(fp): + raise FileNotFoundError(f"File not found: {fp}") + return fp def l1_detector(self, detector=6, post="IMG.fits"): """ generate L1 file path