Пример #1
0
    def test_groupResults_create_correct_group_results(self):

        results_dir = results(self.results_dir)
        group_results_dir = group_results(results_dir, "test_group")
        group_results_dir_expected = os.path.join(results_dir, "test_group")

        self.assertEqual(group_results_dir_expected, group_results_dir)
        self.assertTrue(os.path.exists(group_results_dir_expected))

        shutil.rmtree(results_dir)
    def test_css_create_correct_dir(self):

        results_dir = results(self.results_dir)
        group_results_dir = group_results(results_dir, "test_group")
        css_dir = css(group_results_dir)
        css_dir_expected = os.path.join(group_results_dir, 'css')

        self.assertEqual(css_dir_expected, css_dir)
        self.assertTrue(os.path.exists(css_dir_expected))

        shutil.rmtree(css_dir)
    def test_support_pages_create_correct_dir(self):

        results_dir = results(self.results_dir)
        group_results_dir = group_results(results_dir, "test_group")
        support_pages_dir = support_pages(group_results_dir)
        support_pages_dir_expected = os.path.join(group_results_dir,
                                                  'support_pages')

        self.assertEqual(support_pages_dir_expected, support_pages_dir)
        self.assertTrue(os.path.exists(support_pages_dir_expected))

        shutil.rmtree(results_dir)
Пример #4
0
def create_directories(options, group_name):
    """
    Create the directory structure ready to store the results

    :param options: The options used in the fitting problem and plotting
    :type options: fitbenchmarking.utils.options.Options
    :param group_name: name of the problem group
    :type group_name: str
    :return: paths to the top level results, group results, support pages,
             and figures directories
    :rtype: (str, str, str, str)
    """
    results_dir = create_dirs.results(options.results_dir)
    group_dir = create_dirs.group_results(results_dir, group_name)
    support_dir = create_dirs.support_pages(group_dir)
    figures_dir = create_dirs.figures(support_dir)
    return results_dir, group_dir, support_dir, figures_dir
Пример #5
0
def fitbenchmark_group(group_name, options, data_dir):
    """
    Gather the user input and list of paths. Call benchmarking on these.

    :param group_name: is the name (label) for a group. E.g. the name for
                       the group of problems in "NIST/low_difficulty" may be
                       picked to be NIST_low_difficulty
    :type group_name: str
    :param options: dictionary containing software used in fitting
                    the problem, list of minimizers and location of
                    json file contain minimizers
    :type options: fitbenchmarking.utils.options.Options
    :param data_dir: full path of a directory that holds a group of problem
                     definition files
    :type date_dir: str

    :returns: tuple(prob_results, results_dir) array of fitting results for
              the problem group and the path to the results directory
    :rtype: (list of FittingResult, str)
    """

    # Create results directory
    results_dir = create_dirs.results(options.results_dir)
    group_results_dir = create_dirs.group_results(results_dir, group_name)

    # Extract problem definitions
    problem_group = misc.get_problem_files(data_dir)

    results = []
    for p in problem_group:
        parsed_problem = parse_problem_file(p)
        problem_results = fitbm_one_prob(problem=parsed_problem,
                                         options=options,
                                         directory=group_results_dir)

        # Convert from list of dict to list of list and store
        for r in problem_results:
            tmp_result = []
            for s in options.software:
                tmp_result.extend(r[s])
            results.append(tmp_result)

    return results