test_ifs_level1.py 1.56 KB
Newer Older
Wei Shoulin's avatar
Wei Shoulin committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import os
import unittest
from astropy.io import fits

from csst_dfs_api.ifs.level1 import Level1DataApi

class Level1DataTestCase(unittest.TestCase):

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

    def test_find(self):
        recs = self.api.find(
            level0_id='10000010101',
            module_id = "IFS",
            create_time = ("2024-01-01 11:12:13","2024-06-08 11:12:13"))
        print('find:', recs)

    def test_find_refs_by_ids(self):
        recs = self.api.find_refs_by_ids(
            ids=[16]
        )
        print('test_find_refs_by_ids:', recs)
        
    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):
        rec = self.api.write(
            level0_id = '10000010101',
            rss_id = "123RSSID",
            module_id = "IFS",
            file_type = "SCI",
            prc_status = 3,
            prc_time = '2021-10-22 11:12:13',
            filename = "CSST_IFS_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",
            pipeline_id = "P1",
            build_id = 123,
            refs = {'flat': '3', 'arc': '2', 'bias': '1'}
        )
        print('write:', rec)