pipeline.py 1.8 KB
Newer Older
BO ZHANG's avatar
BO ZHANG committed
1
2
3
4
5
6

# def do_one_exposure():

# node name
HOST = "tulip"
# working directory
7
DIR_WORK = "/share/HDD7/csstpipeline/msc"
BO ZHANG's avatar
BO ZHANG committed
8
9
10
# gaia catalog directory (for position calibration)
DIR_GAIA_CATALOG = ""

11
12
13
14
DIR_TEST = "/share/Cycle-3-SimuData/multipleBandsImaging/CSST_shearOFF/MSC_0000020/"  #  MSC_MS_210525220000_100000020_06_raw.fits
PATH_BIAS = "/share/HDD7/csstpipeline/ref/MSC_CLB_210525200000_100000016_{:02d}_combine.fits"
PATH_DARK = "/share/HDD7/csstpipeline/ref/MSC_CLD_210525202000_100000016_{:02d}_combine.fits"
PATH_FLAT = "/share/HDD7/csstpipeline/ref/MSC_CLF_210525201000_100000016_{:02d}_combine.fits"
BO ZHANG's avatar
BO ZHANG committed
15

16
17
import os
os.chdir(DIR_WORK)
BO ZHANG's avatar
BO ZHANG committed
18

19
import glob
BO ZHANG's avatar
BO ZHANG committed
20
21
from csst.msc.data import CsstMscImgData
from csst.msc.instrument import CsstMscInstrumentProc
22
# from astropy.io import fits
BO ZHANG's avatar
BO ZHANG committed
23

24
25
26
27
28
29
for i_ccd in range(6, 26):
    # i_ccd = 6
    print("processing CCD {}".format(i_ccd))
    fp_raw = glob.glob("{}/MSC_MS_*{:02}_raw.fits".format(DIR_TEST, i_ccd))
    assert len(fp_raw) == 1
    fp_raw = fp_raw[0]
BO ZHANG's avatar
BO ZHANG committed
30

31
32
33
34
    raw = CsstMscImgData.read(fp_raw)
    bias = raw.get_bias(PATH_BIAS.format(i_ccd))
    dark = raw.get_bias(PATH_DARK.format(i_ccd))
    flat = raw.get_bias(PATH_FLAT.format(i_ccd))
BO ZHANG's avatar
BO ZHANG committed
35
36
37

    # initialize Instrument Processor
    instProc = CsstMscInstrumentProc()
38
39
    instProc.prepare(n_jobs=2)
    img, wht, flg = instProc.run(raw, bias, dark, flat)
BO ZHANG's avatar
BO ZHANG committed
40
41
    instProc.cleanup()

42
43
44
45
    # save img, wht, flg to somewhere
    img.writeto("{}/{}.fits".format(DIR_WORK, img.get_keyword("FILENAME")))
    wht.writeto("{}/{}.fits".format(DIR_WORK, wht.get_keyword("FILENAME")))
    flg.writeto("{}/{}.fits".format(DIR_WORK, flg.get_keyword("FILENAME")))
BO ZHANG's avatar
BO ZHANG committed
46
47


48
# TODO:  position calibration
BO ZHANG's avatar
BO ZHANG committed
49
50
51
52
53
54
55
56
from csst.msc.astrometry import CsstProcMscPositionCalibration
pcProc = CsstProcMscPositionCalibration()
pcProc.prepare(search_radius=2.,)
pcProc.run(data_list)
pcProc.cleanup()