Commit d07f6fa2 authored by BO ZHANG's avatar BO ZHANG 🏀
Browse files

make compatible with custom reference files

parent 52be14c7
Loading
Loading
Loading
Loading
+24 −10
Original line number Diff line number Diff line
@@ -227,6 +227,10 @@ class CsstMsDataManager:
        if verbose:
            self.logger_mod.info("logger_mod initialized")

        self.custom_bias = None
        self.custom_dark = None
        self.custom_flat = None

    # DFS APIs
    @property
    def dfs_L0DataApi(self):
@@ -406,30 +410,40 @@ class CsstMsDataManager:

    def get_bias(self, detector=6):
        """ get bias data """
        if self.custom_bias is None:
            if self.datatype == "mbi":
                return glob.glob(self.path_aux.format("CLB", detector))[0]
            else:
                return self.path_aux.format(detector, "bias")
        else:
            return self.custom_bias(detector)

    def get_dark(self, detector=6):
        """ get dark data """
        if self.custom_dark is None:
            if self.datatype == "mbi":
                return glob.glob(self.path_aux.format("CLD", detector))[0]
            else:
                return self.path_aux.format(detector, "dark")
        else:
            return self.custom_dark(detector)

    def get_flat(self, detector=6):
        """ get flat data """
        if self.custom_flat is None:
            if self.datatype == "mbi":
                return glob.glob(self.path_aux.format("CLF", detector))[0]
            else:
                return self.path_aux.format(detector, "flat")
        else:
            return self.custom_flat(detector)

    def get_axeconf(self):
        if os.uname()[1] == "dandelion":
            return "/home/csstpipeline/L1Pipeline/aux/axeconf"
        else:
            return ""
            # in docker
            return "/L1Pipeline/aux/axeconf"

    def l1_file(self, name="", comment=""):
        """ L1 file path