# -*- coding: utf-8 -*- from abc import abstractmethod, ABCMeta from csst_mci_common.common import CsstMCIInit from csst_mci_common.mci_status import CsstMCIStatus from csst_mci_common.mci_result import CsstMCIResult from csst_mci_common.interface import BasePipelineInterface csst_mci = CsstMCIInit() class PipMCIL1RSS(BasePipelineInterface): def __init__(self): self.result = CsstMCIStatus self.logger = csst_mci.logger self.status = CsstMCIResult def run(self): """API, ... Parameters ---------- Returns ------- """ from csst_mci_rss.rss import run_all self.exit_code = "200" self.additionally_algorithm_01() sci_fits_list = list() sci_list = csst_mci.config.get_mci_config("path_l0_rss") for path_sci in sci_list: print(path_sci) fits_output = run_all(path_sci) for i in [2, 6, 7]: sci_fits_list.append(fits_output[i]) csst_mci.config.set_mci_config("path_l1_rss", sci_fits_list) def para_set(self): """API, ... Parameters ---------- Returns ------- """ csst_mci.config_mci_rss_env() csst_mci.config.set_mci_config( "path_RSSlog", "/nfsdata/share/pipeline-unittest/csst_mci/data/dfs_dummy/L1/MCI_simData_2023-07-25/rss/path_RSSlog.txt") csst_mci.config.set_mci_config( "dir_rss_proc", "/nfsdata/share/pipeline-unittest/csst_mci/data/dfs_dummy/L1/MCI_simData_2023-07-25/rss/") path_list = csst_mci.get_all_file_path( "/nfsdata/share/pipeline-unittest/csst_mci/data/dfs_dummy/L0/MCI_simData_2023-07-25/sky_data_case_1") csst_mci.config.set_mci_config("path_l0_rss", path_list) def result_check(self): """API, ... Parameters ---------- Returns ------- """ something_wrong = True if something_wrong: status = 2 assert status in [CsstMCIStatus.PERFECT, CsstMCIStatus.WARNING] # 可以或计划被外部调用的方法 def additionally_algorithm_01(self): pass # 内部方法,"_"前缀用于添加隐藏属性 def _additionally_algorithm_02(self): pass class L1Instrument(BasePipelineInterface): def __init__(self): self.result = CsstMCIStatus self.logger = csst_mci.logger self.status = CsstMCIResult def run(self): self.logger.info("instrument running...") try: fits_output, self.status = self.run_all() except Exception as e: self.logger.error(e) self.logger.info("instrument pipeline finish!") print(self.result) return self.status def para_set(self, list_para): env_crds_set_ins_csst1() env_dfs_set_l0_csst1(obsid=self.obsid) target_detector = csst_mci.config.get_mci_config("target_detector") env_dfs_set_ins_csst1(target_detector) def result_check(self): print(self.result) def run_all(self): bias_ref = csst_mci.config.get_mci_config("bias_ref") dark_ref = csst_mci.config.get_mci_config("dark_ref") flat_ref = csst_mci.config.get_mci_config("flat_ref") shutter_ref = csst_mci.config.get_mci_config("shutter_ref") sci_path = csst_mci.config.get_mci_config("sci_path") output_dir = csst_mci.config.get_mci_config("ins_output") self.status = inst_corr( sci_path, bias_ref, dark_ref, flat_ref, shutter_ref, output_dir, logger=None, os_bias=False, cr_flag=False) return self.status