# CSST-COMMOM-CRMASK - Introduction **CRMask** is a module for detecting cosmic rays on the CSST images using state-of-art algorithms. It should be also applicable for images from other telescopes, as long as the images have the same data structure as that of CSST. # Python package dependencies The following python packages are needed to **CRMask**: * astropy == 4.x (>= 5.0 will be tested in the future) * ccdproc >= 2.1.0 * deepCR >= 0.1.5 * matplotlib >= 3.1.2 * numpy >= 1.19.5 * pytorch >= 1.8.1 * scipy >= 1.3.3 Install these package under Ubuntu 20.04 LTS: ``` sudo apt install python3-numpy python3-scipy python3-matplotlib python3-astropy python3-ccdproc sudo python3 -m pip install pytorch deepCR ``` # File list * crmask.py, cosmic ray detection class, it can be either used standalone or imported as a Python module. * crmask.ini, configuration file that will be loaded when CRMask class initialized. * CSST\_2021-12-30\_CCD23\_epoch20.pth, training models obtained from CSST simulated iimages with 50 hidden layers and 50 epoch. # Usage Download crmask.py and crmask.ini, put them in the same directory. Running it: ``` ./crmask.py your_file.fits your_model ``` where **your\_file.fits** is the filename of the image which you want to do cosmic ray detection, and **your\_model** is the algorithm you select. Available algorithms are _deepCR_ and _lacosmic_. # Warning * The default training model of deepCR are obtained from HST/ACS data by Zhang and Bloom (2020). If you would like to use the native model rather than the model **CSST\_2021-12-30\_CCD23\_epoch20.pth** obtained from CSST simulated data by **Hu Yi**, you must also change the **hidden** parameters in the configuration file **crmask.ini** to 32. * **CSST\_2021-12-30\_CCD23\_epoch20.pth** model is **_ONLY_** suitable for CSST-MSC simulated images. You need to train your own models for CSST-MSC simulated slitless spretra or images/spectra from other telescopes. * The input images must be **bias-substracted** (either by bias reference fram or overscan region) no matter which algorithm selected, otherwise you will get very inefficient detection rate thus wrong results. Flat-field corrected images are preferable, but not necessary. # Bugs Bugs can be reported and filed at https://csst-tb.bao.ac.cn/code/huyi/csst-commom-crmask/-/issues. Alternatively, you can contact **_HU Yi_** (huyi.naoc@gmail.com) to report bugs.