README.md 2.61 KB
Newer Older
Yi Hu's avatar
Yi Hu committed
1
# CSST-COMMOM-CRMASK - Introduction
Hu Yi's avatar
Hu Yi committed
2

Yi Hu's avatar
Yi Hu committed
3
**CRMask** is a module for detecting cosmic rays on the CSST images using state-of-art models. It should be also applied for images from other telescopes, as long as the images have the same data structure as that of CSST.
Hu Yi's avatar
Hu Yi committed
4

Yi Hu's avatar
Yi Hu committed
5
# Python package dependencies
Yi Hu's avatar
Yi Hu committed
6

Yi Hu's avatar
Yi Hu committed
7
The following python packages are needed to **CRMask**:
Hu Yi's avatar
Hu Yi committed
8

Yi Hu's avatar
Yi Hu committed
9
10
11
12
13
14
15
* 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
Hu Yi's avatar
Hu Yi committed
16

Yi Hu's avatar
Yi Hu committed
17
Install these package under Ubuntu 20.04 LTS:
Hu Yi's avatar
Hu Yi committed
18

Yi Hu's avatar
Yi Hu committed
19
20
21
22
```
sudo apt install python3-numpy python3-scipy python3-matplotlib python3-astropy python3-ccdproc
sudo python3 -m pip install pytorch deepCR
```
Yi Hu's avatar
Yi Hu committed
23
24
25
26
27
28
#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.  

Yi Hu's avatar
Yi Hu committed
29
# Usage
Hu Yi's avatar
Hu Yi committed
30

Yi Hu's avatar
Yi Hu committed
31
32
33
Download crmask.py and crmask.ini, put them in the same directory.

Running it:
Yi Hu's avatar
Yi Hu committed
34

Yi Hu's avatar
Yi Hu committed
35
36
37
```
./crmask.py your_file.fits your_model
```
Yi Hu's avatar
Yi Hu committed
38
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_.
Yi Hu's avatar
Yi Hu committed
39
40

<!--
Hu Yi's avatar
Hu Yi committed
41
42
43
44
45
46
下载crmask.py,crmask.ini这两个文件。

./crmask.py your_file.fits your_model

其中your_file.fits是输入fits文件,your_model是扣除宇宙线的方法,可以是deepCR或者lacosmic。

Hu Yi's avatar
Hu Yi committed
47
如果需要使用CSST仿真数据训练得到的模型扣除宇宙线,下载CSST_2021-12-30_CCD23_epoch20.pth,该模型隐藏层数为50。
Yi Hu's avatar
Yi Hu committed
48
-->
Hu Yi's avatar
Hu Yi committed
49

Yi Hu's avatar
Yi Hu committed
50
51
52
53
54
55
56
57
# 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. 

* 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. 
<!--
If you would like use the native training model of deepCR, which are obtained from HST/ACS
如果使用deepCR自带用HST/ACS数据训练得到的模型,在配置文件中,要将hidden这个配置参数改为32。-->
Hu Yi's avatar
Hu Yi committed
58

Yi Hu's avatar
Yi Hu committed
59
# Bugs
Hu Yi's avatar
Hu Yi committed
60

Yi Hu's avatar
Yi Hu committed
61
Please contact **_HU Yi_** (huyi.naoc@gmail.com) to report bugs.