test_facility_level1.py 1.49 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.facility.level1 import Level1DataApi
Wei Shoulin's avatar
c3  
Wei Shoulin committed
6

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

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

    def test_find(self):
Wei Shoulin's avatar
Wei Shoulin committed
13
14
        recs = self.api.find(
            level0_id='000001201',
Wei Shoulin's avatar
c3  
Wei Shoulin committed
15
16
17
            create_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
22
23
    def test_find_by_ids(self):
        recs = self.api.find_by_ids(
            ids=[1,2,3,4]
        )
        print('find_by_ids:', recs)

Wei Shoulin's avatar
c3  
Wei Shoulin committed
24
25
26
27
28
29
30
31
32
33
34
35
36
    def test_get(self):
        rec = self.api.get(id = 2)
        print('get:', rec)

    def test_update_proc_status(self):
        rec = self.api.update_proc_status(id = 2, status = 4)
        print('update_proc_status:', rec)

    def test_update_qc1_status(self):
        rec = self.api.update_qc1_status(id = 2, status = 7)
        print('update_qc1_status:', rec)

    def test_write(self):
Wei Shoulin's avatar
Wei Shoulin committed
37
        rec = self.api.write(
Wei Shoulin's avatar
Wei Shoulin committed
38
39
40
            level0_id = '1000001201', 
            data_type = "SCIE",
            cor_sci_id = 0,
Wei Shoulin's avatar
c3  
Wei Shoulin committed
41
42
            prc_params = "/opt/dddasd.params",
            prc_status = 3,
Wei Shoulin's avatar
Wei Shoulin committed
43
            prc_time = '2021-10-22 11:12:13',
Wei Shoulin's avatar
Wei Shoulin committed
44
45
            filename = "CSST_MSC_MS_SCI_20270810142128_20270810142358_100000101_20_img_L1.fits",
            file_path = "/opt/temp/csst/CSST_MSC_MS_SCI_20270810142128_20270810142358_100000101_20_img_L1.fits",
Wei Shoulin's avatar
Wei Shoulin committed
46
            pipeline_id = "P1",
Wei Shoulin's avatar
Wei Shoulin committed
47
            refs = {'dark': '1', 'bias': '2', 'flat': '3' })
Wei Shoulin's avatar
c3  
Wei Shoulin committed
48
        print('write:', rec)