Example #1
0
    def test_create_results_table_raises_error_if_number_params_different(
            self):
        parameters = OrderedDict([('Height', (100, 0.1)),
                                  ('Cost function value', (1.5, 0))])
        fits_func1 = create_test_fits(('ws1',), 'func1', parameters)

        parameters = OrderedDict([('Height', (100, 0.1)), ('A0', (1, 0.001)),
                                  ('Cost function value', (1.5, 0))])
        fits_func2 = create_test_fits(('ws2',), 'func2', parameters)

        fitting_context = TFAsymmetryFittingContext()
        fitting_context.fit_list = fits_func1 + fits_func2
        model = ResultsTabModel(fitting_context, ResultsContext())

        selected_results = [('ws1', 0), ('ws2', 1)]
        self.assertRaises(IndexError, model.create_results_table, [],
                          selected_results)
Example #2
0
    def test_create_results_table_with_mixed_global_non_global_raises_error(
            self):
        parameters = OrderedDict([('f0.Height', (100, 0.1)),
                                  ('f1.Height', (90, 0.001)),
                                  ('Cost function value', (1.5, 0))])
        fits_func1 = create_test_fits(('ws1',), 'func1', parameters)
        fits_globals = create_test_fits(('ws2',),
                                        'func1',
                                        parameters,
                                        global_parameters=['Height'])

        fitting_context = TFAsymmetryFittingContext()
        fitting_context.fit_list = fits_func1 + fits_globals
        model = ResultsTabModel(fitting_context, ResultsContext())

        selected_results = [('ws1', 0), ('ws2', 1)]
        self.assertRaises(IndexError, model.create_results_table, [],
                          selected_results)
Example #3
0
    def test_create_results_table_with_logs_missing_from_some_workspaces_raises(self):
        workspace = WorkspaceFactory.create("Workspace2D", NVectors=3, YLength=5, XLength=5)

        parameters = OrderedDict([('f0.Height', (100, 0.1))])
        logs = [('log1', (1., 2.)), ('log2', (3., 4.)), ('log3', (4., 5.)),
                ('log4', (5., 6.))]
        fits_logs1 = create_test_fits(('ws1',), 'func1', parameters,
                                      output_workspace_names=[StaticWorkspaceWrapper('test-ws1-ws', workspace)])
        add_logs(fits_logs1[0].input_workspaces[0], logs[:2])

        fits_logs2 = create_test_fits(('ws2',), 'func1', parameters,
                                      output_workspace_names=[StaticWorkspaceWrapper('test-ws2-ws', workspace)])
        add_logs(fits_logs2[0].input_workspaces[0], logs[2:])

        fitting_context = TFAsymmetryFittingContext()
        fitting_context.fit_list = fits_logs1 + fits_logs2
        model = ResultsTabModel(fitting_context, ResultsContext())

        selected_results = [('ws1', 0), ('ws2', 1)]
        selected_logs = ['log1', 'log3']
        self.assertRaises(IndexError, model.create_results_table,
                          selected_logs, selected_results)