## csst_proto [![Documentation Status](https://readthedocs.org/projects/csst-proto/badge/?version=latest)](https://csst-proto.readthedocs.io/en/latest/?badge=latest) CSST L1 pipeline prototype. ## homepage This code is available at *CSST GitLab*: - [https://csst-tb.bao.ac.cn/code/csst-l1/csst_proto](https://csst-tb.bao.ac.cn/code/csst-l1/csst_proto). ## documentation A sphinx-based documentation is available at - [https://csst-proto.readthedocs.io/en/latest/](https://csst-proto.readthedocs.io/en/latest/) ## installation `csst_proto` can be installed with the following shell command ```bash git clone https://csst-tb.bao.ac.cn/code/csst-l1/csst_proto.git cd csst_proto pip install -r requirements.txt python setup.py install ``` or a single-line command ```bash sh -c "$(curl -fsSL https://csst-tb.bao.ac.cn/code/csst-l1/csst_proto/-/raw/main/install.sh)" ``` ## instruction A simple example on how to use this package: ```python from csst_proto.top_level_interface import flip_image from astropy.io import fits # read an L0 image img = fits.getdata("CSST_MS_SCI_06_L0_img.fits") # flip the image img_flipped = flip_image(img=img) ``` ## algorithm description The `csst_proto` uses an awesome algorithm based on `numpy.ndarray` indices to flip images. ## timeline | file / directory | description | urgent | C6 | C7 | |--------------------|---------------------------------|--------|-----|-----| | `csst_proto/` | source code & data | √√ | √ | | | `doc/` | sphinx-based documentation | | | √ | | `example/` | code examples | - | - | - | | `tests/` | unit tests | | | √ | | `.gitignore` | git file | | √ | | | `.gitlab-ci.yml` | gitlab CI/CD pipeline | | | √ | | `LICENSE` | code license | | √ | | | `README.md` | readme file | √√ | √ | | | `install.sh` | single-line installation script | | √ | | | `install_local.sh` | local installation script | | √ | | | `readthedocs.yml` | readthedocs.io configuration | | | √ | | `requirements.txt` | code requirements | √ | √ | | | `setup.py` | sphinx-based documentation | √√ | √ | | ## important stages 1. **code**, **code style** & `top_level_interface` 2. **installation**: `source code` & `setup.py` -> `pip install ` 3. **a simple instruction**: `README.md` 4. **unittest**: `pytest` 5. *gitlab CI/CD pipeline: `.gitlab-ci.yml` 6. *sphinx-based documentation: `doc/` & `readthedocs.yml` ## useful links - python packaging user guide: https://packaging.python.org/en/latest/ - packaging binary extensions (C/C++): https://packaging.python.org/en/latest/guides/packaging-binary-extensions - `setuptools`: https://packaging.python.org/en/latest/tutorials/installing-packages/ - recommended IDEs - PyCharm: https://www.jetbrains.com/pycharm/ - VS Code: https://code.visualstudio.com/ - `git`: https://git-scm.com/ - Pro Git: https://git-scm.com/book/en/v2 - Numpydoc: https://numpydoc.readthedocs.io/en/latest/format.html - for C: https://peps.python.org/pep-0007/ - for Python: https://peps.python.org/pep-0008/ - `unittest`: https://docs.python.org/3.8/library/unittest.html - gitlab CI/CD pipeline: https://docs.gitlab.com/ee/ci/pipelines/ - gitlab runners: https://docs.gitlab.com/runner/ - `sphinx`: https://www.sphinx-doc.org/en/master/index.html - markdown: https://www.markdownguide.org/ - restructured text: https://docutils.sourceforge.io/rst.html - readthedocs: https://readthedocs.io/ or https://rtfd.io/ ## `data manager` ```python import os from csst.ms.data_manager import CsstMscDataManager from csst.ms.backbone import CCD_ID_LIST # initialize data manager dm = CsstMscDataManager( ver_sim="C5.1", dir_l0="/data/sim_data/MSC_0000100", dir_l1="/home/user/L1Pipeline/msc/work") # process all CCDs dm.set_ccd_ids(CCD_ID_LIST) print("----- available ccd_ids -----") print(dm.available_ccd_ids) for ccd_id in dm.target_ccd_ids: print("----- L0 images -----") print(dm.l0_ccd(ccd_id=ccd_id)) print(os.path.exists(dm.l0_ccd(ccd_id=ccd_id))) print("----- L0 crs -----") print(dm.l0_crs(ccd_id=ccd_id)) print(os.path.exists(dm.l0_ccd(ccd_id=ccd_id))) print("----- L0 input cat -----") print(dm.l0_cat(ccd_id=ccd_id)) print(os.path.exists(dm.l0_cat(ccd_id=ccd_id))) print("----- L0 input log -----") print(dm.l0_log(ccd_id=ccd_id)) print(os.path.exists(dm.l0_log(ccd_id=ccd_id))) print("----- L1 images -----") print(dm.l1_ccd(ccd_id, post="img.fits")) ```