test_msc_level1.py 1.29 KB
Newer Older
Wei Shoulin's avatar
c3  
Wei Shoulin committed
1
2
3
4
5
6
7
8
9
10
11
12
import os
import unittest
from astropy.io import fits

from csst_dfs_api.msc.level1 import Level1DataApi

class MSCLevel1DataTestCase(unittest.TestCase):

    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
18
19
20
21
22
23
24
25
26
27
28
29
30
            create_time = ("2021-06-01 11:12:13","2021-06-08 11:12:13"))
        print('find:', 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):
Wei Shoulin's avatar
Wei Shoulin committed
31
32
        rec = self.api.write(
            level0_id='000001201', 
Wei Shoulin's avatar
c3  
Wei Shoulin committed
33
34
35
36
            data_type = "sci",
            cor_sci_id = 1,
            prc_params = "/opt/dddasd.params",
            prc_status = 3,
Wei Shoulin's avatar
Wei Shoulin committed
37
38
            prc_time = '2021-10-22 11:12:13',
            filename = "MSC_MS_210525121500_100000001_09_raw",
Wei Shoulin's avatar
Wei Shoulin committed
39
            file_path = "/opt/temp/csst/msc/level1/MSC_210304093000_0000000_06_img.fits.fz",
Wei Shoulin's avatar
Wei Shoulin committed
40
41
            pipeline_id = "P1",
            refs = {'dark': 1, 'bias': 2, 'flat': 3 })
Wei Shoulin's avatar
c3  
Wei Shoulin committed
42
        print('write:', rec)