diff --git a/csst_common/data_manager.py b/csst_common/data_manager.py index bf1d69b79cf3927169df231e00fcea1dd5a29b90..322ec754710898907da1c7d09155a99cb2166d2a 100644 --- a/csst_common/data_manager.py +++ b/csst_common/data_manager.py @@ -64,9 +64,6 @@ class CsstMsDataManager: The L1 directory. path_aux : str The aux data directory (bias, flat, dark). - dir_pcref : str - The position calibration reference data directory. - Will be removed in the next version. _exp_id : int The exposure ID. _exp_start : int @@ -83,6 +80,8 @@ class CsstMsDataManager: The image type signature for science images. Defualts to ``SCI`` for C5.2 simulation. _l0_post : str The postfix. Defaults to ``L0_1`` for C5.2 simulation. + dfs_mode : bool + DFS mode. If True, ``CsstMsDataManager`` will use DFS. Examples -------- @@ -115,7 +114,7 @@ class CsstMsDataManager: dir_l0: str = ".", dir_l1: str = ".", path_aux: str = "", # bias dark flat - dir_pcref: str = "", # deprecated + dfs_mode: bool = False, _exp_id: int = 100000100, _exp_start: int = 20270810081950, _exp_stop: int = 20270810082220, @@ -124,7 +123,6 @@ class CsstMsDataManager: _survey: str = "MS", _imagetype: str = "SCI", _l0_post: str = "L0_1", - _dfs_mode: bool = False, ): # version @@ -164,12 +162,11 @@ class CsstMsDataManager: self._survey = _survey self._imagetype = _imagetype self._l0_post = _l0_post - self._dfs_mode = _dfs_mode + self.dfs_mode = dfs_mode # data directory self.dir_l0 = dir_l0 self.dir_l1 = dir_l1 - self.dir_pcref = dir_pcref self.path_aux = path_aux # record hard code names in history @@ -180,7 +177,7 @@ class CsstMsDataManager: raise NotImplementedError("from_dfs is currently not available!") @staticmethod - def from_dir(ver_sim="C5.2", datatype="mbi", dir_l0=".", dir_l1=".", dir_pcref="", path_aux=""): + def from_dir(ver_sim="C5.2", datatype="mbi", dir_l0=".", dir_l1=".", dir_pcref="", path_aux="", dfs_mode=False): """ initialize the multi-band imaging data manager """ assert ver_sim in ["C5.2", ] @@ -210,7 +207,7 @@ class CsstMsDataManager: dir_l0=dir_l0, dir_l1=dir_l1, path_aux=path_aux, # bias dark flat - dir_pcref=dir_pcref, # deprecated + dfs_mode=dfs_mode, _exp_id=_exp_id, _exp_start=_exp_start, _exp_stop=_exp_stop, @@ -367,7 +364,7 @@ class CsstMsDataManager: def get_sls_info(self): """ Get the target SLS image header info and return. """ - if self._dfs_mode: + if self.dfs_mode: raise NotImplementedError() else: assert len(self.target_detectors) == 1 @@ -376,14 +373,14 @@ class CsstMsDataManager: def get_mbi_info(self): """ Get all MBI image header info and return as a table. """ - if self._dfs_mode: + if self.dfs_mode: raise NotImplementedError() else: info = Table.read("/nfsdata/share/csst_simulation_data/Cycle-5-SimuData/slitlessSpectroscopy/t_mbi_l1.fits") return info @staticmethod - def quickstart(ver_sim="C5.2", datatype="mbi", dir_l1=".", exposure_id=100): + def quickstart(ver_sim="C5.2", datatype="mbi", dir_l1=".", exposure_id=100, dfs_mode=False): """Quick dataset generator for tests on dandelion or PMO Parameters @@ -396,6 +393,8 @@ class CsstMsDataManager: output directory exposure_id : int The serial number of the exposure. 20-154 for C5.2. + dfs_mode : bool + If True, use DFS. Returns ------- @@ -412,30 +411,26 @@ class CsstMsDataManager: dir_l0 = "/nfsdata/share/csst_simulation_data/Cycle-5-SimuData/multipleBandsImaging/" \ "NGP_AstrometryON_shearOFF/MSC_{:07d}/".format(exposure_id) path_aux = "/nfsdata/users/cham/L1Test/ref_C5.2/MSC_{}_*_{:02d}_combine.fits" - dir_pcref = "/nfsdata/users/csstpipeline/L1Pipeline/msc/gaia_dr3/" elif hostname == "dandelion" and datatype == "sls": dir_l0 = "/nfsdata/share/csst_simulation_data/Cycle-5-SimuData/slitlessSpectroscopy/" \ "NGP_AstrometryON_shearOFF_Spec/MSC_{:07d}/".format(exposure_id) path_aux = "/nfsdata/share/csst_simulation_data/Cycle-5-SimuData/slitlessSpectroscopy/csst_{:02d}{}.fits" - dir_pcref = "" # PMO elif hostname == "ubuntu" and datatype == "mbi": dir_l0 = "/share/simudata/CSSOSDataProductsSims/data/CSSTSimImage_C5/" \ "NGP_AstrometryON_shearOFF/MSC_{:07d}/".format(exposure_id) path_aux = "/data/sim_data/MSC_0000100/ref/MSC_{}_*_{:02d}_combine.fits" - dir_pcref = "/home/user/L1Pipeline/msc/gaia_dr3/" elif hostname == "ubuntu" and datatype == "sls": dir_l0 = "/share/simudata/CSSOSDataProductsSims/data/CSSTSimImage_C5/" \ "NGP_AstrometryON_shearOFF_Spec/MSC_{:07d}/".format(exposure_id) path_aux = "" - dir_pcref = "" else: raise ValueError("@DM: invalid hostname {} or datatype {}!".format(hostname, datatype)) return CsstMsDataManager.from_dir( - ver_sim=ver_sim, datatype=datatype, dir_l0=dir_l0, dir_l1=dir_l1, dir_pcref=dir_pcref, path_aux=path_aux) + ver_sim=ver_sim, datatype=datatype, dir_l0=dir_l0, dir_l1=dir_l1, path_aux=path_aux, dfs_mode=dfs_mode) class CsstMbiDataManager: