test_facility_level0.py 1.41 KB
Newer Older
Wei Shoulin's avatar
c3  
Wei Shoulin committed
1
2
import unittest

Wei Shoulin's avatar
Wei Shoulin committed
3
from csst_dfs_api.facility.level0 import Level0DataApi
Wei Shoulin's avatar
c3  
Wei Shoulin committed
4

Wei Shoulin's avatar
Wei Shoulin committed
5
class Level0DataTestCase(unittest.TestCase):
Wei Shoulin's avatar
c3  
Wei Shoulin committed
6
7
8
9
10

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

    def test_find(self):
Wei Shoulin's avatar
test    
Wei Shoulin committed
11
        recs = self.api.find(file_type = 'FLAT', create_time = ('2024-01-01 01:01:01','2024-11-01 01:01:01'),  limit = 0)
Wei Shoulin's avatar
c3  
Wei Shoulin committed
12
13
14
        print('find:', recs)

    def test_get(self):
Wei Shoulin's avatar
C9    
Wei Shoulin committed
15
        rec = self.api.get(id = 14)
Wei Shoulin's avatar
c3  
Wei Shoulin committed
16
17
        print('get:', rec)

Wei Shoulin's avatar
C9    
Wei Shoulin committed
18
        rec = self.api.get(level0_id = '000001101',file_type='sci')
Wei Shoulin's avatar
Wei Shoulin committed
19
20
        print('get:', rec)        

Wei Shoulin's avatar
c3  
Wei Shoulin committed
21
    def test_update_proc_status(self):
Wei Shoulin's avatar
Wei Shoulin committed
22
        rec = self.api.update_proc_status(level0_id = '000001101', status = 6)
Wei Shoulin's avatar
c3  
Wei Shoulin committed
23
24
25
        print('update_proc_status:', rec)

    def test_update_qc0_status(self):
Wei Shoulin's avatar
Wei Shoulin committed
26
        rec = self.api.update_qc0_status(level0_id = '000001101', status = 7)
Wei Shoulin's avatar
c3  
Wei Shoulin committed
27
28
29
30
        print('update_qc0_status:', rec)

    def test_write(self):
        rec = self.api.write(
Wei Shoulin's avatar
Wei Shoulin committed
31
32
            level0_id = '10000010101',
            obs_id = '100000101',
Wei Shoulin's avatar
Wei Shoulin committed
33
            detector_no = "01",
Wei Shoulin's avatar
Wei Shoulin committed
34
            filter = "u",
Wei Shoulin's avatar
Wei Shoulin committed
35
            file_type = "SCI",            
Wei Shoulin's avatar
c3  
Wei Shoulin committed
36
37
38
            obs_time = "2021-06-06 11:12:13",
            exp_time = 150,
            detector_status_id = 3,
Wei Shoulin's avatar
Wei Shoulin committed
39
40
            filename = "CSST_MSC_MS_SCI_20270810142128_20270810142358_100000101_01_L0_1.fits",
            file_path = "/opt/temp/csst/CSST_MSC_MS_SCI_20270810142128_20270810142358_100000101_01_L0_1.fits")
Wei Shoulin's avatar
c3  
Wei Shoulin committed
41
        print('write:', rec)