コード例 #1
0
    def cancel(self):
        if self.maxent_alg is not None:
            self.maxent_alg.cancel()

            # Need to set this as sent as part of calculation finished signal
            self._maxent_output_workspace_name = get_maxent_workspace_name(
                self.get_parameters_for_maxent_calculation()['InputWorkspace'])
コード例 #2
0
    def calculate_maxent(self, alg):
        maxent_parameters = self.get_parameters_for_maxent_calculation()
        base_name = get_maxent_workspace_name(maxent_parameters['InputWorkspace'])

        maxent_workspace = run_MuonMaxent(maxent_parameters, alg, base_name)

        self.add_maxent_workspace_to_ADS(maxent_parameters['InputWorkspace'], maxent_workspace, alg)
コード例 #3
0
 def createThread(self):
     self.maxent_alg = mantid.AlgorithmManager.create("MuonMaxent")
     self._maxent_output_workspace_name = get_maxent_workspace_name(
         self.get_parameters_for_maxent_calculation()['InputWorkspace'],  self.view.get_method)
     calculation_function = functools.partial(self.calculate_maxent, self.maxent_alg)
     self._maxent_calculation_model = ThreadModelWrapper(calculation_function)
     return thread_model.ThreadModel(self._maxent_calculation_model)
コード例 #4
0
    def test_create_workspace_label_freq(self):
        name = get_raw_data_workspace_name("MUSR", "62260", False, 1, "FD")
        name = get_maxent_workspace_name(name, "by groups")
        self.model.set_if_groups(True)
        self.model.reconstructed_data = {0: "fwd", 1: "bwd"}

        label = self.model._create_workspace_label(name, 0)
        self.assertEqual(label, "62260 Frequency ;MaxEnt")
コード例 #5
0
 def calculate_maxent(self, alg):
     maxent_parameters = self.get_parameters_for_maxent_calculation()
     base_name = get_maxent_workspace_name(maxent_parameters['InputWorkspace'],  self.view.get_method)
     if self.use_groups and self.get_num_groups ==0:
         # this is caught as part of the calculation thread
         raise ValueError("Please select groups in the grouping tab")
     else:
         maxent_workspace = run_MuonMaxent(maxent_parameters, alg, base_name)
         self.add_maxent_workspace_to_ADS(maxent_parameters['InputWorkspace'], maxent_workspace, alg)
コード例 #6
0
    def test_create_workspace_label_dets_reconstructed(self):
        name = get_raw_data_workspace_name("MUSR", "62260", False, 1, "FD")
        name = get_maxent_workspace_name(name, "All detectors")
        name += RECONSTRUCTED_SPECTRA
        self.model.set_if_groups(False)
        self.raw._create_workspace_label = mock.Mock(return_value="det_label")

        label = self.model._create_workspace_label(name, 3)
        self.raw._create_workspace_label.assert_called_once_with(name, 3)
        self.assertEqual(label, "det_label" + RECONSTRUCTED_SPECTRA)
コード例 #7
0
    def add_maxent_workspace_to_ADS(self, input_workspace, maxent_workspace, alg):
        run = re.search('[0-9]+', input_workspace).group()
        base_name = get_maxent_workspace_name(input_workspace)
        directory = get_maxent_workspace_group_name(base_name, self.load.data_context.instrument, self.load.workspace_suffix)

        muon_workspace_wrapper = MuonWorkspaceWrapper(maxent_workspace, directory + base_name)
        muon_workspace_wrapper.show()

        maxent_output_options = self.get_maxent_output_options()
        self.load._frequency_context.add_maxEnt(run, maxent_workspace)
        self.add_optional_outputs_to_ADS(alg, maxent_output_options, base_name, directory)
コード例 #8
0
    def add_maxent_workspace_to_ADS(self, input_workspace, maxent_workspace, alg):
        run = re.search('[0-9]+', input_workspace).group()
        base_name = get_maxent_workspace_name(input_workspace)
        group = get_maxent_workspace_group_name(base_name, self.load.data_context.instrument)
        directory = get_base_data_directory(self.load, run) + group

        muon_workspace_wrapper = MuonWorkspaceWrapper(maxent_workspace, directory + base_name)
        muon_workspace_wrapper.show()

        maxent_output_options = self.get_maxent_output_options()

        self.add_optional_outputs_to_ADS(alg, maxent_output_options, base_name, directory)
コード例 #9
0
    def test_create_workspace_label_group_reconstructed(self):
        name = get_raw_data_workspace_name("MUSR", "62260", False, 1, "FD")
        name = get_maxent_workspace_name(name, "by groups")
        name += RECONSTRUCTED_SPECTRA
        self.model.set_if_groups(True)
        self.model.reconstructed_data = {0: "fwd", 1: "bwd"}

        label = self.model._create_workspace_label(name, 0)
        self.assertEqual(label, "62260 fwd ;MaxEnt" + RECONSTRUCTED_SPECTRA)

        label = self.model._create_workspace_label(name, 1)
        self.assertEqual(label, "62260 bwd ;MaxEnt" + RECONSTRUCTED_SPECTRA)
コード例 #10
0
    def add_maxent_workspace_to_ADS(self, input_workspace, maxent_workspace, alg):
        run = re.search('[0-9]+', input_workspace).group()
        base_name = get_maxent_workspace_name(input_workspace, self.view.get_method)
        directory = get_maxent_workspace_group_name(base_name, self.context.data_context.instrument, self.context.workspace_suffix)

        muon_workspace_wrapper = MuonWorkspaceWrapper(directory + base_name)
        muon_workspace_wrapper.show()

        maxent_output_options = self.get_maxent_output_options()
        self.context.frequency_context.add_maxEnt(run, maxent_workspace)
        self.add_optional_outputs_to_ADS(alg, maxent_output_options, base_name, directory)

        # Storing this on the class so it can be sent as part of the calculation
        # finished signal.
        self._maxent_output_workspace_name = base_name
コード例 #11
0
    def add_maxent_workspace_to_ADS(self, input_workspace, maxent_workspace,
                                    alg):
        run = re.search('[0-9]+', input_workspace).group()
        base_name = get_maxent_workspace_name(input_workspace)
        group = get_maxent_workspace_group_name(
            base_name, self.load.data_context.instrument)
        directory = get_base_data_directory(self.load, run) + group

        muon_workspace_wrapper = MuonWorkspaceWrapper(maxent_workspace,
                                                      directory + base_name)
        muon_workspace_wrapper.show()

        maxent_output_options = self.get_maxent_output_options()

        self.add_optional_outputs_to_ADS(alg, maxent_output_options, base_name,
                                         directory)