Exemple #1
0
    def l3_output_file(self):
        """
        Get the full output definition file path. Multiple output filenames are possible if
        the command line argument is semicolon-separated list.
        :return: A list of output definition filenames
        """

        filenames = []
        for l3_output in self._args.l3_output.split(";"):
            filename = psrlcfg.get_settings_file("output", "l3", l3_output)
            if filename is None:
                msg = "Invalid output definition filename or id: %s\n" % l3_output
                msg = msg + "    Recognized output definition ids:\n"
                for output_id in psrlcfg.get_setting_ids("output", "l3"):
                    msg = msg + "    - " + output_id + "\n"
                self.error.add_error("invalid-outputdef", msg)
            else:
                filenames.append(filename)

        if len(filenames) == 0:
            msg = "No valid output definition file found for argument: %s"
            msg = msg % (str(self._args.l3_output))
            self.error.add_error("invalid-outputdef", msg)
            self.error.raise_on_error()

        return filenames
Exemple #2
0
    def testL1ProcessorDefinitions(self):
        """
        Test the processor definitions for L1 Pre-processor
        :return:
        """

        # Loop over all processor levels
        for processor_level in psrlcfg.processor_levels:

            # Get a list of all ids
            proc_defs = psrlcfg.get_processor_definition_ids(processor_level)
            label = "procdef:{}".format(processor_level)

            # lists of ids must be a list and longer than 0
            self.assertIsInstance(proc_defs,
                                  list,
                                  msg="Type is not list: {} [{}]".format(
                                      type(proc_defs), label))
            self.assertGreater(len(proc_defs),
                               0,
                               msg="No definitions found for {}".format(label))

            # Load all processor definitions (must return a valid AttrDict)
            for proc_def_id in proc_defs:
                filepath = psrlcfg.get_settings_file("proc", processor_level,
                                                     proc_def_id)
                self.assertIsInstance(filepath, Path)
                self.assertTrue(filepath.is_file())
Exemple #3
0
    def setUp(self):

        # Get a list of processor definition files in the code repository
        l2proc_ids = psrlcfg.get_setting_ids("proc", "l2")
        self.l2procdef_files = [
            psrlcfg.get_settings_file("proc", "l2", l2proc_id)
            for l2proc_id in l2proc_ids
        ]
Exemple #4
0
 def l3_griddef(self):
     l3_griddef = self._args.l3_griddef
     filename = psrlcfg.get_settings_file("grid", None, l3_griddef)
     if filename is None:
         msg = "Invalid griddef filename or id: %s\n" % l3_griddef
         msg = msg + "    Recognized grid definition ids:\n"
         for griddef_id in psrlcfg.get_setting_ids("grid"):
             msg = msg + "    - " + griddef_id + "\n"
         self.error.add_error("invalid-griddef", msg)
         self.error.raise_on_error()
     else:
         return filename
Exemple #5
0
 def l3_settings_file(self):
     l3_settings = self._args.l3_settings
     filename = psrlcfg.get_settings_file("proc", "l3", l3_settings)
     if filename is None:
         msg = "Invalid l3 settings filename or id: %s\n" % l3_settings
         msg = msg + " \nRecognized Level-3 processor setting ids:\n"
         for l3_settings_id in psrlcfg.get_setting_ids("proc", "l3"):
             msg = msg + "  " + l3_settings_id + "\n"
         self.error.add_error("invalid-l3-settings", msg)
         self.error.raise_on_error()
     else:
         return filename
Exemple #6
0
 def l2p_output(self):
     l2p_output = self._args.l2p_output
     filename = psrlcfg.get_settings_file("output", "l2p", l2p_output)
     if filename is None:
         msg = "Invalid l2p outputdef filename or id: %s\n" % l2p_output
         msg = msg + " \nRecognized Level-2 output definitions ids:\n"
         l2p_output_ids = psrlcfg.get_setting_ids("output", "l2p")
         for l2p_output_id in l2p_output_ids:
             msg = msg + "    - " + l2p_output_id + "\n"
         self.error.add_error("invalid-l2p-outputdef", msg)
         self.error.raise_on_error()
     else:
         return filename