test_sls_cal_merge.py 1.4 KB
Newer Older
Wei Shoulin's avatar
c3  
Wei Shoulin committed
1
2
3
4
import os
import unittest
from astropy.io import fits

Wei Shoulin's avatar
Wei Shoulin committed
5
from csst_dfs_api_local.sls.calmerge import CalMergeApi
Wei Shoulin's avatar
c3  
Wei Shoulin committed
6

Wei Shoulin's avatar
Wei Shoulin committed
7
class SLSCalMergeApiTestCase(unittest.TestCase):
Wei Shoulin's avatar
c3  
Wei Shoulin committed
8
9
10
11
12

    def setUp(self):
        self.api = CalMergeApi()

    def test_find(self):
Wei Shoulin's avatar
Wei Shoulin committed
13
        recs = self.api.find(detector_no='01',
Wei Shoulin's avatar
c3  
Wei Shoulin committed
14
15
16
17
            ref_type = "bias",
            obs_time = ("2021-06-01 11:12:13","2021-06-08 11:12:13"))
        print('find:', recs)

Wei Shoulin's avatar
Wei Shoulin committed
18
19
20
21
    def test_get_latest_by_l0(self):
        rec = self.api.get_latest_by_l0(level0_id='000001301', ref_type = "bias")
        print('get:', rec)

Wei Shoulin's avatar
c3  
Wei Shoulin committed
22
    def test_get(self):
Wei Shoulin's avatar
Wei Shoulin committed
23
        rec = self.api.get(cal_id='0000231')
Wei Shoulin's avatar
c3  
Wei Shoulin committed
24
25
26
        print('get:', rec)

    def test_update_proc_status(self):
Wei Shoulin's avatar
Wei Shoulin committed
27
        rec = self.api.update_proc_status(id = 100, status = 1)
Wei Shoulin's avatar
c3  
Wei Shoulin committed
28
29
30
        print('update_proc_status:', rec)

    def test_update_qc1_status(self):
Wei Shoulin's avatar
Wei Shoulin committed
31
        rec = self.api.update_qc1_status(id = 100, status = 2)
Wei Shoulin's avatar
c3  
Wei Shoulin committed
32
33
34
        print('update_qc1_status:', rec)    

    def test_write(self):
Wei Shoulin's avatar
Wei Shoulin committed
35
36
37
        rec = self.api.write(
            cal_id='0000231',
            detector_no='01', 
Wei Shoulin's avatar
c3  
Wei Shoulin committed
38
39
40
41
42
43
44
            ref_type = "bias",
            obs_time = "2021-06-04 11:12:13",
            exp_time = 150,
            filename = "/opt/dddasd.params",
            file_path = "/opt/dddasd.fits",
            prc_status = 3,
            prc_time = '2021-06-04 11:12:13',
Wei Shoulin's avatar
Wei Shoulin committed
45
            level0_ids = ['0000231','0000232','0000233','0000234'])
Wei Shoulin's avatar
c3  
Wei Shoulin committed
46
        print('write:', rec)