Beispiel #1
0
def create_test_model(input_workspaces,
                      function_name,
                      parameters,
                      output_workspace_names=None,
                      logs=None,
                      global_parameters=None):
    """
    Create a list of fits with time series logs on the workspaces
    :param input_workspaces: See create_test_fits
    :param function_name: See create_test_fits
    :param parameters: See create_test_fits
    :param logs: A list of (name, (values...), (name, (values...)))
    :param global_parameters: An optional list of tied parameters
    :return: A list of Fits with workspaces/logs attached
    """
    fits = create_test_fits(input_workspaces, function_name, parameters,
                            output_workspace_names, global_parameters)
    logs = logs if logs is not None else []
    for fit, workspace_name in zip(fits, input_workspaces):
        add_logs(workspace_name, logs)

    fitting_context = TFAsymmetryFittingContext()
    for fit in fits:
        fitting_context.add_fit(fit)
    return fitting_context, ResultsTabModel(fitting_context, ResultsContext())
Beispiel #2
0
    def test_that_when_new_fit_is_performed_function_name_is_set_to_lastest_fit_name(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()
        fits = fits_func1 + fits_func2
        for fit in fits:
            fitting_context.add_fit(fit)
        model = ResultsTabModel(fitting_context, ResultsContext())

        model.on_new_fit_performed()

        self.assertEqual(model.selected_fit_function(), 'func2')