diff --git a/csst_common/__init__.py b/csst_common/__init__.py index bd486b377ec32762c2b1cae0b2f3e1d9c29a1e6e..f0f48ca7afa1da32687cf12040746a951312b62a 100644 --- a/csst_common/__init__.py +++ b/csst_common/__init__.py @@ -10,11 +10,11 @@ Modified-History: 2023-12-15, Bo Zhang, add module header """ -from .ccds import CCDS from .decorator import parameterized_module_decorator -from .dfs import DFS from .file import File from .pipeline import Pipeline from .status import CsstResult, CsstStatus __version__ = "0.0.2" + +__all__ = ["Pipeline", "File", "CsstResult"] diff --git a/csst_common/file.py b/csst_common/file.py index 25136ba384af2cbff247bec33085de5b4e1b988c..5fa0e5623c359f78b48719dbfe1687f41987cb1f 100644 --- a/csst_common/file.py +++ b/csst_common/file.py @@ -16,7 +16,22 @@ from typing import Optional 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 # get dir name self.dirname = os.path.dirname(self.file_path) diff --git a/csst_common/pipeline.py b/csst_common/pipeline.py index 94a3e05f5efc10f3e9befa7af7fa192c77305270..f6440f036f13c83dad8eb320bf316b1458203740 100644 --- a/csst_common/pipeline.py +++ b/csst_common/pipeline.py @@ -25,6 +25,35 @@ from .logger import get_logger 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__( self, dir_input: str = "/pipeline/input", diff --git a/csst_common/status.py b/csst_common/status.py index 0b0980c56b2ed754a3864331896ab8b11c4789f5..9f8c6b71144b028abc8b3c777799a39911939a16 100644 --- a/csst_common/status.py +++ b/csst_common/status.py @@ -15,10 +15,10 @@ from typing import Optional, Any class CsstStatus(IntEnum): """ - The CSST Status class. + The CSST standard status class. - This class provides a set of status which should be returned - from each CSST L1 functional module. + This class provides a set of status which should be returned from each CSST algorithm module. + 0, 1, 2 stands for PERFECT, WARNING, ERROR, respectively. Examples -------- @@ -36,6 +36,19 @@ class CsstStatus(IntEnum): 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 -------- >>> CsstResult(CsstStatus.PERFECT, ["file1.fits", "file2.fits"])