Loading csst_common/__init__.py +2 −2 Original line number Original line Diff line number Diff line Loading @@ -10,11 +10,11 @@ Modified-History: 2023-12-15, Bo Zhang, add module header 2023-12-15, Bo Zhang, add module header """ """ from .ccds import CCDS from .decorator import parameterized_module_decorator from .decorator import parameterized_module_decorator from .dfs import DFS from .file import File from .file import File from .pipeline import Pipeline from .pipeline import Pipeline from .status import CsstResult, CsstStatus from .status import CsstResult, CsstStatus __version__ = "0.0.2" __version__ = "0.0.2" __all__ = ["Pipeline", "File", "CsstResult"] csst_common/file.py +16 −1 Original line number Original line Diff line number Diff line Loading @@ -16,7 +16,22 @@ from typing import Optional class File: class File: def __init__(self, file_path: str = "/path/to/file.fits", new_dir=None): """ CSST MSC standard file path parser. It can be used for parse CSST MSC file paths and generate corresponding output file paths. Parameters ---------- file_path : str File path. new_dir : str New directory. """ def __init__( self, file_path: str = "/path/to/file.fits", new_dir: Optional[str] = None ): self.file_path = file_path self.file_path = file_path # get dir name # get dir name self.dirname = os.path.dirname(self.file_path) self.dirname = os.path.dirname(self.file_path) Loading csst_common/pipeline.py +29 −0 Original line number Original line Diff line number Diff line Loading @@ -25,6 +25,35 @@ from .logger import get_logger class Pipeline: class Pipeline: """ CSST pipeline configuration class. It should be used for every pipeline to initialize environment. Parameters ---------- dir_input : str Input path. dir_output : str Output path. dir_aux : str Aux path. dfs_root : str DFS root path. ccds_root : str CCDS root path. ccds_cache : str CCDS cache path. filter_warnings : bool If `True`, filter warnings. dfs : bool If `True`, initialize DFS. ccds : bool If `True`, initialize CCDS. **kwargs : Any Additional keyword arguments. """ def __init__( def __init__( self, self, dir_input: str = "/pipeline/input", dir_input: str = "/pipeline/input", Loading csst_common/status.py +16 −3 Original line number Original line Diff line number Diff line Loading @@ -15,10 +15,10 @@ from typing import Optional, Any class CsstStatus(IntEnum): class CsstStatus(IntEnum): """ """ The CSST Status class. The CSST standard status class. This class provides a set of status which should be returned This class provides a set of status which should be returned from each CSST algorithm module. from each CSST L1 functional module. 0, 1, 2 stands for PERFECT, WARNING, ERROR, respectively. Examples Examples -------- -------- Loading @@ -36,6 +36,19 @@ class CsstStatus(IntEnum): class CsstResult: class CsstResult: """ """ CSST standard result class. This is designed for all algorithm modules. Parameters ---------- status : CsstStatus The final status of the algorithm. files : Optional[list[str]] The files to which changes are made. **output : Any Additional results. Examples Examples -------- -------- >>> CsstResult(CsstStatus.PERFECT, ["file1.fits", "file2.fits"]) >>> CsstResult(CsstStatus.PERFECT, ["file1.fits", "file2.fits"]) Loading Loading
csst_common/__init__.py +2 −2 Original line number Original line Diff line number Diff line Loading @@ -10,11 +10,11 @@ Modified-History: 2023-12-15, Bo Zhang, add module header 2023-12-15, Bo Zhang, add module header """ """ from .ccds import CCDS from .decorator import parameterized_module_decorator from .decorator import parameterized_module_decorator from .dfs import DFS from .file import File from .file import File from .pipeline import Pipeline from .pipeline import Pipeline from .status import CsstResult, CsstStatus from .status import CsstResult, CsstStatus __version__ = "0.0.2" __version__ = "0.0.2" __all__ = ["Pipeline", "File", "CsstResult"]
csst_common/file.py +16 −1 Original line number Original line Diff line number Diff line Loading @@ -16,7 +16,22 @@ from typing import Optional class File: class File: def __init__(self, file_path: str = "/path/to/file.fits", new_dir=None): """ CSST MSC standard file path parser. It can be used for parse CSST MSC file paths and generate corresponding output file paths. Parameters ---------- file_path : str File path. new_dir : str New directory. """ def __init__( self, file_path: str = "/path/to/file.fits", new_dir: Optional[str] = None ): self.file_path = file_path self.file_path = file_path # get dir name # get dir name self.dirname = os.path.dirname(self.file_path) self.dirname = os.path.dirname(self.file_path) Loading
csst_common/pipeline.py +29 −0 Original line number Original line Diff line number Diff line Loading @@ -25,6 +25,35 @@ from .logger import get_logger class Pipeline: class Pipeline: """ CSST pipeline configuration class. It should be used for every pipeline to initialize environment. Parameters ---------- dir_input : str Input path. dir_output : str Output path. dir_aux : str Aux path. dfs_root : str DFS root path. ccds_root : str CCDS root path. ccds_cache : str CCDS cache path. filter_warnings : bool If `True`, filter warnings. dfs : bool If `True`, initialize DFS. ccds : bool If `True`, initialize CCDS. **kwargs : Any Additional keyword arguments. """ def __init__( def __init__( self, self, dir_input: str = "/pipeline/input", dir_input: str = "/pipeline/input", Loading
csst_common/status.py +16 −3 Original line number Original line Diff line number Diff line Loading @@ -15,10 +15,10 @@ from typing import Optional, Any class CsstStatus(IntEnum): class CsstStatus(IntEnum): """ """ The CSST Status class. The CSST standard status class. This class provides a set of status which should be returned This class provides a set of status which should be returned from each CSST algorithm module. from each CSST L1 functional module. 0, 1, 2 stands for PERFECT, WARNING, ERROR, respectively. Examples Examples -------- -------- Loading @@ -36,6 +36,19 @@ class CsstStatus(IntEnum): class CsstResult: class CsstResult: """ """ CSST standard result class. This is designed for all algorithm modules. Parameters ---------- status : CsstStatus The final status of the algorithm. files : Optional[list[str]] The files to which changes are made. **output : Any Additional results. Examples Examples -------- -------- >>> CsstResult(CsstStatus.PERFECT, ["file1.fits", "file2.fits"]) >>> CsstResult(CsstStatus.PERFECT, ["file1.fits", "file2.fits"]) Loading