Esempio n. 1
0
 def get_selected_fit_workspaces(self):
     if self.selected_data:
         if self._get_fit_type() == "Single":
             fit = self.context.fitting_context.find_fit_for_input_workspace_list_and_function(
                 [self.view.display_workspace], self.model.function_name)
             return [FitPlotInformation(input_workspaces=[self.view.display_workspace], fit=fit)]
         else:
             fit = self.context.fitting_context.find_fit_for_input_workspace_list_and_function(
                 self.selected_data, self.model.function_name)
             return [FitPlotInformation(input_workspaces=self.selected_data, fit=fit)]
     else:
         return []
Esempio n. 2
0
    def handle_fit_selected_in_table(self):
        rows = self.view.fit_table.get_selected_rows()
        fit_information = []
        for i, row in enumerate(rows):
            workspaces = self.get_workspaces_for_row_in_fit_table(row)
            fit = self.context.fitting_context.find_fit_for_input_workspace_list_and_function(
                workspaces, self.model.function_name)
            fit_information += [FitPlotInformation(input_workspaces=workspaces, fit=fit)]

        self.selected_sequential_fit_notifier.notify_subscribers(fit_information)
Esempio n. 3
0
    def test_handle_plot_selected_fits_correctly_calls_model(self):
        fit = FitInformation(mock.MagicMock(), 'GaussOsc',
                            ['MUSR62260; Group; bottom; Asymmetry; MA'],
                            ['MUSR62260; Group; bottom; Asymmetry; MA; Fitted'])

        self.model.get_fit_workspace_and_indices.return_value = [["MUSR62260; Group; bottom; Asymmetry; MA; Fitted"],
                                                                 [1]]

        fit_information = FitPlotInformation(input_workspaces=["MUSR62260; Group; bottom; Asymmetry; MA"], fit=fit)

        self.view.is_plot_diff.return_value = False
        self.presenter.handle_plot_selected_fits([fit_information])
        self.model.get_fit_workspace_and_indices.assert_called_once_with(fit,False)
Esempio n. 4
0
    def test_handle_plot_selected_fits_correctly_calls_plot(self):
        fit = FitInformation(mock.MagicMock(), 'GaussOsc',
                             ['MUSR62260; Group; bottom; Asymmetry; MA'],
                             ['MUSR62260; Group; bottom; Asymmetry; MA; Fitted'])
        self.model.get_fit_workspace_and_indices.return_value = [["MUSR62260; Group; bottom; Asymmetry; MA; Fitted"],
                                                                 [1]]
        fit_information = FitPlotInformation(input_workspaces=["MUSR62260; Group; bottom; Asymmetry; MA"], fit=fit)

        expected_workspace_list = ["MUSR62260; Group; bottom; Asymmetry; MA"] + \
                                  ['MUSR62260; Group; bottom; Asymmetry; MA; Fitted']
        expected_indices = [0] + [1]

        self.presenter.handle_plot_selected_fits([fit_information])

        self.figure_presenter.plot_workspaces.assert_called_once_with(expected_workspace_list, expected_indices,
                                                                      hold_on=False, autoscale=False)