## csst_common 
[![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_common](https://csst-tb.bao.ac.cn/code/csst-l1/csst_common).

## documentation

A sphinx-based documentation is available at
- [https://csst-proto.readthedocs.io/en/latest/](https://csst-proto.readthedocs.io/en/latest/)

## dependency

- numpy~=1.20.3
- joblib~=1.1.0
- astropy~=5.1

## installation

`csst_common` can be installed with the following shell command

```bash
git clone https://csst-tb.bao.ac.cn/code/csst-l1/csst_common.git
cd csst_common
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_common/-/raw/main/install.sh)"
```

## instruction

how to import CSST parameters:
```python
from csst_common.params import CSST_PARAMS as CP
print(CP)
print(CP["mbi"]["detector2filter"])
```

how to use data_manager
```python
from csst_common.data_manager import CsstMbiDataManager
dm = CsstMbiDataManager(...)
# access L0 directory
dm.dir_l0
# access L1 directory
dm.dir_l1
# access dir_pcref
dm.dir_pcref
# access path_aux
dm.path_aux
# access ver_sim
dm.ver_sim
# access target detectors
dm.target_detectors
# access available detectors
dm.available_detectors
# define an L1 file (detector-specified)
dm.l1_detector(detector=6)
# define an L1 file (non-detector-specified)
dm.l1_file("flipped_image.fits")
```

a shortcut for test dataset

```python
from csst_common.data_manager import CsstMbiDataManager

CsstMbiDataManager.quickstart(ver_sim="C5.2", dir_l1=".", exposure_id=100)
```

## algorithm description

The `csst_common` provides some common modules for CSST pipeline.

- `csst_common.parameters`
- `csst_common.data_manager`