c8_changes.rst 4.5 KB
Newer Older
BO ZHANG's avatar
tweaks    
BO ZHANG committed
1
C8主巡天流水线接口
BO ZHANG's avatar
BO ZHANG committed
2
3
4
5
6
7
8
9
10
11
================

Change list
    - 仓库名修改:
        - ``csst_ms*`` 修改为 ``csst_msc_*``, 注意修改文件夹路径和 ``setup.py`` 中的名称
    - 接口文件修改:
        ``top_level_interface.py`` 文件改名为 ``api.py`` , 这个文件中用于导入每个 python package 与流水线的接口函数
    - 接口名称修改:
        每个开发模块需要把接口函数命名为 ``base_`` 开头的函数,例如 ``base_phot``
    - ``DataManager`` ``FileRecorder`` 不再使用, 底层接口都尽可能使用文件路径作为参数
BO ZHANG's avatar
tweaks    
BO ZHANG committed
12
    - 使用 ``csst_common.status.CsstResult`` 作为返回类型, 包含三个部分:
BO ZHANG's avatar
BO ZHANG committed
13
14
15
16
        - 运行状态 ``status`` 必须是 ``CsstStatus`` 的三种类型之一
        - 输出文件列表 ``file_list``, 是一个 ``list``, 需要包含所有输出文件,包括临时文件
        - 额外输出 (一般不需要,除非有其他额外输出)
    - 程序中禁止使用当前文件夹 ``.`` 或 ``./``,所有路径应使用绝对路径
BO ZHANG's avatar
tweaks    
BO ZHANG committed
17
18
19
20
21
22
23
    - 尽可能避免创建临时文件夹等操作

    - 单元测试
        - 覆盖率合格线可以设置稍低
        - 由于代码接口定义更新,原则上单元测试应该会更加容易,
        - 单元测试服务器: csstunittest@10.3.10.10 外网 -p 2000 159.226.170.52
        - 单元测试需要一个大表来统计所有模块的每个案例(文件、类、函数名)和其简单解释(~10个字)
BO ZHANG's avatar
tweaks    
BO ZHANG committed
24
        - Jenkins上需要有一个随时更新的单元测试统计结果 包括覆盖率,测试案例列表等
BO ZHANG's avatar
tweaks    
BO ZHANG committed
25

BO ZHANG's avatar
BO ZHANG committed
26
27
28
29
30
31
32
    - 接口定义修改:
        ``csst_msc_mbi_distortion`` 样例代码如下

        .. code-block:: python

            from csst_common.status import CsstStatus, CsstResult

BO ZHANG's avatar
tweaks    
BO ZHANG committed
33
            def base_distortion(input_file, output_file, rc="/path/to/gaia_dr3.fits", **kwargs): -> CsstResult:
BO ZHANG's avatar
BO ZHANG committed
34
35
36
37
38
39
40
41
42
43
                """ your docstring here """
                # do your calculation
                process(input_file, output_fle)
                # construct CsstResult
                result = CsstResult(
                    status=CsstStatus.PERFECT,
                    file_list=[output_file, "an additional output file"]
                )
                return result

BO ZHANG's avatar
BO ZHANG committed
44
45
导入模块
---------
BO ZHANG's avatar
BO ZHANG committed
46
47
48

.. code-block:: python

BO ZHANG's avatar
BO ZHANG committed
49
50
51
52
53
    # import modules
    import numpy as np
    import matplotlib.pyplot as plt
    from astropy.io import fits
    from astropy import table
BO ZHANG's avatar
BO ZHANG committed
54

BO ZHANG's avatar
BO ZHANG committed
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
    # import modules
    from scipy import signal
    from astropy import units as u
    from astropy import constants as const

    # import classes / functions
    from astropy.coordinates import SkyCoord
    from scipy.interpolate import least_squares

    # DO NOT use 'import *'


.. 主巡天模块-接口列表
.. ----------------------

.. .. code-block:: python

..     # csst-l1/mbi/csst_msc_mbi_instrument
..     def base_instcorr(input_file, img_file, wht_file, flg_file) -> CsstResult
..     # csst-l1/mbi/csst_msc_mbi_distortion
..     def base_distortion(input_file, img_file, wht_file, flg_file): -> CsstResult
..     # csst-l1/mbi/csst_msc_mbi_position
..     def base_position_single(input_file, img_file, wht_file, flg_file): -> CsstResult
..     def base_position_multiple(input_file, img_file, wht_file, flg_file): -> CsstResult
..     # csst-l1/mbi/csst_msc_mbi_flux
..     def base_flux(input_file, img_file, wht_file, flg_file): -> CsstResult
..     # csst-l1/mbi/csst_msc_mbi_photometry
..     def base_phot(input_file, img_file, wht_file, flg_file): -> CsstResult
..     # csst-l1/sls/csst_msc_sls_instrument
..     def base_instcorr(input_file, output_file): -> CsstResult
..     # csst-l1/sls/csst_msc_sls_position
..     def base_position(input_file, output_file): -> CsstResult
..     # csst-l1/sls/csst_msc_sls_mosaic
..     def base_mosaic(input_files, output_file): -> CsstResult
..     # csst-l1/sls/csst_msc_sls_directimage
..     def base_dimg(input_file, output_file): -> CsstResult
..     # csst-l1/sls/csst_msc_sls_sky
..     def base_skybkg(input_file, output_file): -> CsstResult
..     # csst-l1/sls/csst_msc_sls_objextraction
..     def base_objext(input_file, output_file): -> CsstResult
..     # csst-l1/sls/csst_msc_sls_axe
..     def base_axe(input_file, output_file, dir_slsconf): -> CsstResult
..     # csst-l1/sls/csst_msc_sls_cde
..     def base_cde(input_file, output_file, dir_slsconf): -> CsstResult
..     # csst-l1/qc/csst_msc_qc0
..     def base_qc0(input_file, output_file): -> CsstResult
..     # csst-l1/qc/csst_msc_sls_qc1
..     def base_qc1(input_file, output_file): -> CsstResult
BO ZHANG's avatar
BO ZHANG committed
103