Commit eda1b0c3 authored by BO ZHANG's avatar BO ZHANG 🏀
Browse files

renamed exp_id to obs_id

parent 57bb7847
Loading
Loading
Loading
Loading
+36 −32
Original line number Diff line number Diff line
@@ -80,11 +80,11 @@ class CsstMsDataManager:
    dfs_node : str
        The environment in which the pipeline will run.
        Use "pml" for Purple Mountain Lab cluster and "local" for others.
    _exp_id : int
    obs_id : int
        The exposure ID.
    _exp_start : int
    exp_start : int
        The exposure start time in ``yyyymmddhhmmss`` format.
    _exp_stop : int
    exp_stop : int
        The exposure start time in ``yyyymmddhhmmss`` format.
    _telescope : str
        The telescope name. Defaults to ``CSST`` for C5.2 simulation.
@@ -92,9 +92,9 @@ class CsstMsDataManager:
        The instrument name. Defaults to ``MSC`` for C5.2 simulation.
    _survey : str
        The survey name. Defaults to ``MS`` for C5.2 simulation.
    _imagetype : str
    obs_type : str
        The image type signature for science images. Defualts to ``SCI`` for C5.2 simulation.
    _l0_post : str
    l0_post : str
        The postfix. Defaults to ``L0_1`` for C5.2 simulation.
    log_ppl : str
        The pipeline log file name.
@@ -134,14 +134,14 @@ class CsstMsDataManager:
                 path_aux: str = "",  # bias dark flat
                 dfs_mode: bool = False,
                 dfs_node: str = "kmust",
                 _exp_id: int = 100000100,
                 _exp_start: int = 20270810081950,
                 _exp_stop: int = 20270810082220,
                 obs_id: str = "100000100",
                 exp_start: int = "20270810081950",
                 exp_stop: int = "20270810082220",
                 _telescope: str = "CSST",
                 _instrument: str = "MSC",
                 _survey: str = "MS",
                 _imagetype: str = "SCI",
                 _l0_post: str = "L0_1",
                 obs_type: str = "SCI",
                 l0_post: str = "L0_1",
                 log_ppl="csst-l1ppl.log",
                 log_mod="csst-l1mod.log",
                 clear_dir=False,
@@ -176,16 +176,16 @@ class CsstMsDataManager:
        self.target_detectors = target_detectors

        # exposure info
        self._exp_id = _exp_id
        self._exp_start = _exp_start
        self._exp_stop = _exp_stop
        self.obs_id = obs_id
        self.exp_start = exp_start
        self.exp_stop = exp_stop

        # file name components
        self._telescope = _telescope
        self._instrument = _instrument
        self._survey = _survey
        self._imagetype = _imagetype
        self._l0_post = _l0_post
        self.obs_type = obs_type
        self.l0_post = l0_post

        # for catalog query
        self.dfs_mode = dfs_mode
@@ -266,13 +266,13 @@ class CsstMsDataManager:
        available_detectors.sort()

        # parse info
        _telescope, _instrument, _survey, _imagetype, \
            _exp_start, _exp_stop, _exp_id, \
            _detector, *_l0_post, _ext = re.split(r"[_.]", fps_img[0])
        (_telescope, _instrument, _survey, obs_type,
         exp_start, exp_stop, obs_id,
         _detector, *l0_post, _ext) = re.split(r"[_.]", fps_img[0])

        _exp_start = int(_exp_start)
        _exp_stop = int(_exp_stop)
        _exp_id = int(_exp_id)
        # exp_start = int(exp_start)
        # exp_stop = int(exp_stop)
        # obs_id = int(obs_id)

        return CsstMsDataManager(ver_sim=ver_sim,
                                 datatype=datatype,
@@ -283,14 +283,14 @@ class CsstMsDataManager:
                                 path_aux=path_aux,  # bias dark flat
                                 dfs_mode=dfs_mode,
                                 dfs_node=dfs_node,
                                 _exp_id=_exp_id,
                                 _exp_start=_exp_start,
                                 _exp_stop=_exp_stop,
                                 obs_id=obs_id,
                                 exp_start=exp_start,
                                 exp_stop=exp_stop,
                                 _telescope=_telescope,
                                 _instrument=_instrument,
                                 _survey=_survey,
                                 _imagetype=_imagetype,
                                 _l0_post="_".join(_l0_post),
                                 obs_type=obs_type,
                                 l0_post="_".join(l0_post),
                                 )

    @staticmethod
@@ -320,18 +320,22 @@ class CsstMsDataManager:
        print("@DM.glob_dir: {} files found with pattern: {}".format(len(fps), pattern))
        return fps

    def l0_id(self, detector=6):
        """ Level0 ID, consistent with DFS. """
        return f"{self.obs_id}{detector:02d}"

    def l0_cat(self, detector=6):
        """ the L0 cat file path"""
        assert self.ver_sim == "C5.2"
        fn = "{}_{}_chip_{:02d}_filt_{}.cat".format(
            self._instrument, self._exp_id, detector, self.detector2filter[detector])
            self._instrument, self.obs_id, detector, self.detector2filter[detector])
        return os.path.join(self.dir_l0, fn)

    def l0_log(self, detector=6):
        """ L0 log file path """
        assert self.ver_sim == "C5.2"
        fn = "{}_{}_chip_{:02d}_filt_{}.log".format(
            self._instrument, self._exp_id, detector, self.detector2filter[detector])
            self._instrument, self.obs_id, detector, self.detector2filter[detector])
        return os.path.join(self.dir_l0, fn)

    def l0_detector(self, detector=6):
@@ -339,7 +343,7 @@ class CsstMsDataManager:
        assert self.ver_sim in ["C5.1", "C5.2"]
        fn = "{}_{}_{}_SCI_{}_{}_{}_{:02d}_L0_1.fits".format(
            self._telescope, self._instrument, self._survey,
            self._exp_start, self._exp_stop, self._exp_id, detector)
            self.exp_start, self.exp_stop, self.obs_id, detector)
        return os.path.join(self.dir_l0, fn)

    def l0_crs(self, detector=6):
@@ -347,7 +351,7 @@ class CsstMsDataManager:
        assert self.ver_sim in ["C5.1", "C5.2"]
        fn = "{}_{}_{}_CRS_{}_{}_{}_{:02d}_L0_1.fits".format(
            self._telescope, self._instrument, self._survey,
            self._exp_start, self._exp_stop, self._exp_id, detector)
            self.exp_start, self.exp_stop, self.obs_id, detector)
        return os.path.join(self.dir_l0, fn)

    def l1_detector(self, detector=6, post="img.fits"):
@@ -369,7 +373,7 @@ class CsstMsDataManager:
        assert self.ver_sim in ["C5.1", "C5.2"]
        fn = "{}_{}_{}_SCI_{}_{}_{}_{:02d}_{}".format(
            self._telescope, self._instrument, self._survey,
            self._exp_start, self._exp_stop, self._exp_id, detector, post)
            self.exp_start, self.exp_stop, self.obs_id, detector, post)
        return os.path.join(self.dir_l1, fn)

    def get_bias(self, detector=6):