def test_that_cannot_change_name_when_workspace_in_ADS(self):
        workspace_handle = MuonWorkspaceWrapper(workspace=self.workspace)

        workspace_handle.show("name1")

        with self.assertRaises(ValueError):
            workspace_handle.name = "new_name"
Esempio n. 2
0
    def add_fft_workspace_to_ADS(self, input_workspace, imaginary_input_workspace, fft_workspace_label):
        run = re.search('[0-9]+', input_workspace).group()
        fft_workspace = mantid.AnalysisDataService.retrieve(fft_workspace_label)
        Im_run = ""
        if imaginary_input_workspace != "":
            Im_run = re.search('[0-9]+', imaginary_input_workspace).group()
        fft_workspace_name = get_fft_workspace_name(input_workspace, imaginary_input_workspace)
        directory = get_fft_workspace_group_name(fft_workspace_name, self.load.data_context.instrument,
                                                 self.load.workspace_suffix)
        Re = get_group_or_pair_from_name(input_workspace)
        Im = get_group_or_pair_from_name(imaginary_input_workspace)
        shift = 3 if fft_workspace.getNumberHistograms() == 6 else 0
        spectra = {"_" + FREQUENCY_EXTENSIONS["RE"]: 0 + shift, "_" + FREQUENCY_EXTENSIONS["IM"]: 1 + shift,
                   "_" + FREQUENCY_EXTENSIONS["MOD"]: 2 + shift}
        for spec_type in list(spectra.keys()):
            extracted_ws = extract_single_spec(fft_workspace, spectra[spec_type], fft_workspace_name + spec_type)

            if 'PhaseQuad' in self.view.workspace:
                self.load._frequency_context.add_FFT(fft_workspace_name + spec_type, run, Re, Im_run, Im,
                                                     phasequad=True)
            else:
                self.load._frequency_context.add_FFT(fft_workspace_name + spec_type, run, Re, Im_run, Im)

            muon_workspace_wrapper = MuonWorkspaceWrapper(extracted_ws)
            muon_workspace_wrapper.show(directory + fft_workspace_name + spec_type)
    def test_that_cannot_change_name_when_workspace_in_ADS(self):
        workspace_handle = MuonWorkspaceWrapper(workspace=self.workspace)

        workspace_handle.show("name1")

        with self.assertRaises(ValueError):
            workspace_handle.name = "new_name"
Esempio n. 4
0
    def add_fitting_info_to_ADS_if_required(self, base_name,
                                            fit_workspace_name):
        if not self.view.output_fit_information:
            return

        muon_workspace_wrapper = MuonWorkspaceWrapper(fit_workspace_name)
        muon_workspace_wrapper.show()
Esempio n. 5
0
 def add_phase_table_to_ADS(self, base_name):
     run = get_run_numbers_as_string_from_workspace_name(
         base_name, self.context.data_context.instrument)
     directory = get_base_data_directory(self.context, run)
     muon_workspace_wrapper = MuonWorkspaceWrapper(directory + base_name)
     muon_workspace_wrapper.show()
     self.context.phase_context.add_phase_table(muon_workspace_wrapper)
Esempio n. 6
0
    def test_that_if_workspace_exists_with_same_name_as_group_then_it_is_replaced(self):
        workspace = create_simple_workspace(data_x=[1, 2, 3, 4], data_y=[10, 10, 10, 10])
        simpleapi.mtd.add("group", workspace)

        workspace_handle = MuonWorkspaceWrapper(workspace=workspace)
        workspace_handle.show("group/ws1")

        self.assert_group_workspace_exists("group")
Esempio n. 7
0
    def test_that_workspace_added_correctly_for_single_nested_structure(self):
        workspace = create_simple_workspace(data_x=[1, 2, 3, 4], data_y=[10, 10, 10, 10])
        workspace_handle = MuonWorkspaceWrapper(workspace=workspace)

        workspace_handle.show("group1/ws1")

        self.assert_group_workspace_exists("group1")
        self.assert_workspace_in_group("ws1", "group1")
    def test_that_workspace_property_returns_workspace_when_in_ADS(self):
        workspace_handle = MuonWorkspaceWrapper(workspace=self.workspace)

        workspace_handle.show("arbitrary_name")
        ws_property = workspace_handle.workspace

        six.assertCountEqual(self, ws_property.readX(0), [1, 2, 3, 4])
        six.assertCountEqual(self, ws_property.readY(0), [10, 10, 10, 10])
 def add_optional_outputs_to_ADS(self, alg, output_options, base_name, directory):
     for key in output_options:
         if output_options[key]:
             output = alg.getProperty(key).valueAsStr
             self.load.ads_observer.observeRename(False)
             wrapped_workspace = MuonWorkspaceWrapper(output)
             wrapped_workspace.show(directory + base_name + optional_output_suffixes[key])
             self.load.ads_observer.observeRename(True)
Esempio n. 10
0
    def add_fft_workspace_to_ADS(self, input_workspace, imaginary_input_workspace, fft_workspace):
        run = re.search('[0-9]+', input_workspace).group()
        fft_workspace_name = get_fft_workspace_name(input_workspace, imaginary_input_workspace)
        group = get_fft_workspace_group_name(fft_workspace_name, self.load.data_context.instrument)
        directory = get_base_data_directory(self.load, run) + group

        muon_workspace_wrapper = MuonWorkspaceWrapper(fft_workspace, directory + fft_workspace_name)
        muon_workspace_wrapper.show()
Esempio n. 11
0
    def add_phase_table_to_ADS(self, base_name, detector_table):
        run = re.search('[0-9]+', base_name).group()

        directory = get_base_data_directory(self.context, run)
        muon_workspace_wrapper = MuonWorkspaceWrapper(detector_table, directory + base_name)
        muon_workspace_wrapper.show()

        self.context.phase_context.add_phase_table(muon_workspace_wrapper)
    def test_that_if_workspace_exists_with_same_name_as_group_then_it_is_replaced(
            self):
        group = simpleapi.CreateWorkspace([1, 2, 3, 4], [10, 10, 10, 10])

        workspace_handle = MuonWorkspaceWrapper('group')
        workspace_handle.show("group/ws1")

        self.assert_group_workspace_exists("group")
    def test_that_if_workspace_exists_with_same_name_as_group_then_it_is_replaced(self):
        workspace = create_simple_workspace(data_x=[1, 2, 3, 4], data_y=[10, 10, 10, 10])
        simpleapi.mtd.add("group", workspace)

        workspace_handle = MuonWorkspaceWrapper(workspace=workspace)
        workspace_handle.show("group/ws1")

        self.assert_group_workspace_exists("group")
    def test_that_hiding_workspace_more_than_once_has_no_effect_but_raises_RuntimeWarning(self):
        workspace_handle = MuonWorkspaceWrapper(workspace=self.workspace)
        workspace_handle.show("name1")

        workspace_handle.hide()

        with self.assertRaises(RuntimeWarning):
            workspace_handle.hide()
    def test_that_running_show_twice_with_different_names_causes_the_workspace_to_be_moved(self):
        workspace_handle = MuonWorkspaceWrapper(workspace=self.workspace)

        workspace_handle.show("name1")
        workspace_handle.show("name2")

        self.assertFalse(simpleapi.mtd.doesExist("name1"))
        self.assertTrue(simpleapi.mtd.doesExist("name2"))
    def test_that_workspace_added_correctly_for_single_nested_structure(self):
        workspace = create_simple_workspace(data_x=[1, 2, 3, 4], data_y=[10, 10, 10, 10])
        workspace_handle = MuonWorkspaceWrapper(workspace=workspace)

        workspace_handle.show("group1/ws1")

        self.assert_group_workspace_exists("group1")
        self.assert_workspace_in_group("ws1", "group1")
    def test_that_hiding_the_workspace_removes_it_from_ADS(self):
        workspace_handle = MuonWorkspaceWrapper(workspace=self.workspace)
        workspace_handle.show("test")

        workspace_handle.hide()

        self.assertEqual(workspace_handle.is_hidden, True)
        self.assertFalse(simpleapi.mtd.doesExist("test"))
    def test_that_hiding_the_workspace_removes_it_from_ADS(self):
        workspace_handle = MuonWorkspaceWrapper(workspace=self.workspace)
        workspace_handle.show("test")

        workspace_handle.hide()

        self.assertEqual(workspace_handle.is_hidden, True)
        self.assertFalse(simpleapi.mtd.doesExist("test"))
    def test_that_workspace_property_returns_workspace_when_in_ADS(self):
        workspace_handle = MuonWorkspaceWrapper(workspace=self.workspace)

        workspace_handle.show("arbitrary_name")
        ws_property = workspace_handle.workspace

        six.assertCountEqual(self, ws_property.readX(0), [1, 2, 3, 4])
        six.assertCountEqual(self, ws_property.readY(0), [10, 10, 10, 10])
    def test_that_if_workspace_deleted_from_ADS_then_hide_raises_a_RuntimeWarning(self):
        workspace_handle = MuonWorkspaceWrapper(workspace=self.workspace)
        workspace_handle.show("name1")

        simpleapi.mtd.clear()

        with self.assertRaises(RuntimeWarning):
            workspace_handle.hide()
    def test_that_setting_a_new_workspace_removes_the_previous_one_from_the_ADS(self):
        workspace_handle = MuonWorkspaceWrapper(workspace=self.workspace)
        workspace_handle.show("name1")

        workspace2 = create_simple_workspace(data_x=[5, 6, 7, 8], data_y=[20, 20, 20, 20])

        self.assertTrue(simpleapi.mtd.doesExist("name1"))
        workspace_handle.workspace = workspace2
        self.assertFalse(simpleapi.mtd.doesExist("name1"))
    def test_that_running_show_twice_with_different_names_causes_the_workspace_to_be_moved(
            self):
        workspace_handle = MuonWorkspaceWrapper(workspace=self.workspace)

        workspace_handle.show("name1")
        workspace_handle.show("name2")

        self.assertFalse(simpleapi.mtd.doesExist("name1"))
        self.assertTrue(simpleapi.mtd.doesExist("name2"))
    def test_that_hiding_workspace_more_than_once_has_no_effect_but_raises_RuntimeWarning(
            self):
        workspace_handle = MuonWorkspaceWrapper(workspace=self.workspace)
        workspace_handle.show("name1")

        workspace_handle.hide()

        with self.assertRaises(RuntimeWarning):
            workspace_handle.hide()
    def test_that_setting_a_new_workspace_resets_the_name_to_empty_string(self):
        workspace_handle = MuonWorkspaceWrapper(workspace=self.workspace)
        workspace_handle.show("name1")

        workspace2 = create_simple_workspace(data_x=[5, 6, 7, 8], data_y=[20, 20, 20, 20])

        self.assertEqual(workspace_handle.name, "name1")
        workspace_handle.workspace = workspace2
        self.assertEqual(workspace_handle.name, "")
    def test_that_showing_the_workspace_puts_it_in_ADS(self):
        workspace_handle = MuonWorkspaceWrapper(workspace=self.workspace)

        workspace_handle.show("test")

        self.assertTrue(simpleapi.mtd.doesExist("test"))
        ads_workspace = simpleapi.mtd["test"]
        six.assertCountEqual(self, ads_workspace.readX(0), [1, 2, 3, 4])
        six.assertCountEqual(self, ads_workspace.readY(0), [10, 10, 10, 10])
    def test_that_showing_the_workspace_puts_it_in_ADS(self):
        workspace_handle = MuonWorkspaceWrapper(workspace=self.workspace)

        workspace_handle.show("test")

        self.assertTrue(simpleapi.mtd.doesExist("test"))
        ads_workspace = simpleapi.mtd["test"]
        six.assertCountEqual(self, ads_workspace.readX(0), [1, 2, 3, 4])
        six.assertCountEqual(self, ads_workspace.readY(0), [10, 10, 10, 10])
Esempio n. 27
0
    def test_that_setting_a_new_workspace_removes_the_previous_one_from_the_ADS(self):
        workspace_handle = MuonWorkspaceWrapper(workspace=self.workspace)
        workspace_handle.show("name1")

        workspace2 = create_simple_workspace(data_x=[5, 6, 7, 8], data_y=[20, 20, 20, 20])

        self.assertTrue(simpleapi.mtd.doesExist("name1"))
        workspace_handle.workspace = workspace2
        self.assertFalse(simpleapi.mtd.doesExist("name1"))
    def test_that_if_workspace_deleted_from_ADS_then_hide_raises_a_RuntimeWarning(
            self):
        workspace_handle = MuonWorkspaceWrapper(workspace=self.workspace)
        workspace_handle.show("name1")

        simpleapi.mtd.clear()

        with self.assertRaises(RuntimeWarning):
            workspace_handle.hide()
Esempio n. 29
0
    def add_phase_quad_to_ADS(self, input_workspace, phasequad_workspace_name):
        run = re.search('^{}([0-9, -]+)[;,_]?'.format(self.context.data_context.instrument), input_workspace).group(1)

        directory = get_base_data_directory(self.context, run)

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

        self.context.phase_context.add_phase_quad(muon_workspace_wrapper, run)
        self.phase_quad_calculation_complete_nofifier.notify_subscribers()
    def add_phase_table_to_ADS(self, base_name, detector_table):
        run = re.search('[0-9]+', base_name).group()

        phase_table_group = get_phase_table_workspace_group_name(base_name,
                                                                 self.context.data_context.instrument)
        directory = get_base_data_directory(self.context, run) + phase_table_group
        muon_workspace_wrapper = MuonWorkspaceWrapper(detector_table, directory + base_name)
        muon_workspace_wrapper.show()

        self.context.phase_context.add_phase_table(muon_workspace_wrapper)
Esempio n. 31
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)
Esempio n. 32
0
    def add_phase_quad_to_ADS(self, input_workspace, input_phase_table, phase_quad):
        run = re.search('[0-9]+', input_workspace).group()
        phasequad_workspace_name = get_phase_quad_workspace_name(input_workspace, input_phase_table)

        directory = get_base_data_directory(self.context, run)

        muon_workspace_wrapper = MuonWorkspaceWrapper(phase_quad, directory + phasequad_workspace_name)
        muon_workspace_wrapper.show()

        self.context.phase_context.add_phase_quad(muon_workspace_wrapper)
        self.phase_quad_calculation_complete_nofifier.notify_subscribers()
    def test_that_setting_a_new_workspace_resets_the_name_to_empty_string(
            self):
        workspace_handle = MuonWorkspaceWrapper(workspace=self.workspace)
        workspace_handle.show("name1")

        workspace2 = create_simple_workspace(data_x=[5, 6, 7, 8],
                                             data_y=[20, 20, 20, 20])

        self.assertEqual(workspace_handle.name, "name1")
        workspace_handle.workspace = workspace2
        self.assertEqual(workspace_handle.name, "")
Esempio n. 34
0
    def add_fitting_info_to_ADS_if_required(self, base_name, fit_workspace_name):
        if not self.view.output_fit_information:
            return

        run = re.search('[0-9]+', base_name).group()
        phase_table_group = get_phase_table_workspace_group_name(base_name,
                                                                 self.context.data_context.instrument,
                                                                 self.context.workspace_suffix)
        directory = get_base_data_directory(self.context, run) + phase_table_group

        muon_workspace_wrapper = MuonWorkspaceWrapper(directory + fit_workspace_name)
        muon_workspace_wrapper.show()
Esempio n. 35
0
    def add_fft_workspace_to_ADS(self, input_workspace,
                                 imaginary_input_workspace, fft_workspace):
        run = re.search('[0-9]+', input_workspace).group()
        fft_workspace_name = get_fft_workspace_name(input_workspace,
                                                    imaginary_input_workspace)
        group = get_fft_workspace_group_name(fft_workspace_name,
                                             self.load.data_context.instrument)
        directory = get_base_data_directory(self.load, run) + group

        muon_workspace_wrapper = MuonWorkspaceWrapper(
            fft_workspace, directory + fft_workspace_name)
        muon_workspace_wrapper.show()
Esempio n. 36
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)
    def add_fitting_info_to_ADS_if_required(self, base_name, fitting_information):
        if not self.view.output_fit_information:
            return

        run = re.search('[0-9]+', base_name).group()
        phase_table_group = get_phase_table_workspace_group_name(base_name,
                                                                 self.context.data_context.instrument)
        fitting_workspace_name = get_fitting_workspace_name(base_name)
        directory = get_base_data_directory(self.context, run) + phase_table_group

        muon_workspace_wrapper = MuonWorkspaceWrapper(fitting_information, directory + fitting_workspace_name)
        muon_workspace_wrapper.show()
    def add_phase_quad_to_ADS(self, input_workspace, input_phase_table, phase_quad):
        run = re.search('[0-9]+', input_workspace).group()
        phasequad_workspace_name = get_phase_quad_workspace_name(input_workspace, input_phase_table)
        phase_table_group = get_phase_table_workspace_group_name(phasequad_workspace_name,
                                                                 self.context.data_context.instrument)
        directory = get_base_data_directory(self.context, run) + phase_table_group

        muon_workspace_wrapper = MuonWorkspaceWrapper(phase_quad, directory + phasequad_workspace_name)
        muon_workspace_wrapper.show()

        self.context.phase_context.add_phase_quad(muon_workspace_wrapper)
        self.phase_quad_calculation_complete_nofifier.notify_subscribers()
Esempio n. 39
0
    def add_phase_table_to_ADS(self, base_name, detector_table):
        run = re.search('[0-9]+', base_name).group()

        phase_table_group = get_phase_table_workspace_group_name(
            base_name, self.context.data_context.instrument,
            self.context.workspace_suffix)
        directory = get_base_data_directory(self.context,
                                            run) + phase_table_group
        muon_workspace_wrapper = MuonWorkspaceWrapper(detector_table,
                                                      directory + base_name)
        muon_workspace_wrapper.show()

        self.context.phase_context.add_phase_table(muon_workspace_wrapper)
Esempio n. 40
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
Esempio n. 41
0
    def _calculate_phasequads(self, phasequad_obj, rebin):
        for run in self._data_context.current_runs:
            if self._data_context.num_periods(run) > 1:
                raise ValueError("Cannot support multiple periods")

            ws_list = self.calculate_phasequad(phasequad_obj, run, rebin)
            run_string = run_list_to_string(run)
            directory = get_base_data_directory(self, run_string)
            for ws in ws_list:
                muon_workspace_wrapper = MuonWorkspaceWrapper(directory + ws)
                muon_workspace_wrapper.show()

            phasequad_obj.update_asymmetry_workspaces(ws_list,
                                                      run,
                                                      rebin=rebin)
    def test_that_workspaces_in_existing_folders_are_not_moved_by_directory_manipulation(
            self):
        workspace1 = create_simple_workspace(data_x=[1, 2, 3, 4],
                                             data_y=[10, 10, 10, 10])
        workspace2 = create_simple_workspace(data_x=[1, 2, 3, 4],
                                             data_y=[10, 10, 10, 10])
        workspace_handle1 = MuonWorkspaceWrapper(workspace=workspace1)
        workspace_handle2 = MuonWorkspaceWrapper(workspace=workspace2)

        workspace_handle1.show("group2/ws1")
        workspace_handle2.show("group3/ws2")

        self.assert_group_workspace_exists("group2")
        self.assert_group_workspace_exists("group3")
        self.assert_workspace_in_group("ws1", "group2")
        self.assert_workspace_in_group("ws2", "group3")
Esempio n. 43
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)
    def test_that_workspaces_in_existing_folders_are_not_moved_by_directory_manipulation(self):
        workspace1 = create_simple_workspace(data_x=[1, 2, 3, 4], data_y=[10, 10, 10, 10])
        workspace2 = create_simple_workspace(data_x=[1, 2, 3, 4], data_y=[10, 10, 10, 10])
        workspace_handle1 = MuonWorkspaceWrapper(workspace=workspace1)
        workspace_handle2 = MuonWorkspaceWrapper(workspace=workspace2)

        workspace_handle1.show("group1/group2/ws1")
        workspace_handle2.show("group1/group2/group3/ws2")

        self.assert_group_workspace_exists("group1")
        self.assert_group_workspace_exists("group2")
        self.assert_group_workspace_exists("group3")
        self.assert_group1_is_inside_group2("group2", "group1")
        self.assert_group1_is_inside_group2("group3", "group2")
        self.assert_workspace_in_group("ws1", "group2")
        self.assert_workspace_in_group("ws2", "group3")
Esempio n. 45
0
 def add_optional_outputs_to_ADS(self, alg, output_options, base_name, directory):
     for key in output_options:
         if key == GROUPINGTABLE and output_options[key]:
             output = GROUPINGTABLE
             self.context.ads_observer.observeRename(False)
             wrapped_workspace = MuonWorkspaceWrapper(output)
             name = directory + base_name + " " + GROUPINGTABLE
             self._optional_output_names[key] = name
             wrapped_workspace.show(name)
             self.context.ads_observer.observeRename(True)
         elif output_options[key]:
             output = alg.getProperty(key).valueAsStr
             self.context.ads_observer.observeRename(False)
             wrapped_workspace = MuonWorkspaceWrapper(output)
             name = directory + base_name + "(" + str(self.get_num_groups)+" groups) "+ optional_output_suffixes[key]
             self._optional_output_names[key] = name
             wrapped_workspace.show(name)
             self.context.ads_observer.observeRename(True)
Esempio n. 46
0
    def add_fft_workspace_to_ADS(self, input_workspace,
                                 imaginary_input_workspace,
                                 fft_workspace_label):
        run = re.search('[0-9]+', input_workspace).group()
        fft_workspace = mantid.AnalysisDataService.retrieve(
            fft_workspace_label)
        Im_run = ""
        if imaginary_input_workspace != "":
            Im_run = re.search('[0-9]+', imaginary_input_workspace).group()
        fft_workspace_name = get_fft_workspace_name(input_workspace,
                                                    imaginary_input_workspace)
        directory = get_fft_workspace_group_name(
            fft_workspace_name, self.load.data_context.instrument,
            self.load.workspace_suffix)
        Re = get_group_or_pair_from_name(input_workspace)
        Im = get_group_or_pair_from_name(imaginary_input_workspace)
        shift = 3 if fft_workspace.getNumberHistograms() == 6 else 0
        spectra = {
            "_" + FREQUENCY_EXTENSIONS["RE"]: 0 + shift,
            "_" + FREQUENCY_EXTENSIONS["IM"]: 1 + shift,
            "_" + FREQUENCY_EXTENSIONS["MOD"]: 2 + shift
        }

        for spec_type in list(spectra.keys()):
            extracted_ws = extract_single_spec(fft_workspace,
                                               spectra[spec_type],
                                               fft_workspace_name + spec_type)

            self.load._frequency_context.add_FFT(
                fft_workspace_name + spec_type, run, Re, Im_run, Im)

            muon_workspace_wrapper = MuonWorkspaceWrapper(extracted_ws)
            muon_workspace_wrapper.show(directory + fft_workspace_name +
                                        spec_type)

        # This is a small hack to get the output name to a location where it can be part of the calculation finished
        # signal.
        self._output_workspace_name = fft_workspace_name + '_mod'
    def test_that_if_workspace_deleted_from_ADS_then_hide_does_nothing(self):
        workspace_handle = MuonWorkspaceWrapper(workspace=self.workspace)
        workspace_handle.show("name1")

        simpleapi.mtd.clear()
    def test_that_hiding_workspace_more_than_once_has_no_effect(self):
        workspace_handle = MuonWorkspaceWrapper(workspace=self.workspace)
        workspace_handle.show("name1")

        workspace_handle.hide()
    def test_that_showing_the_workspace_with_empty_string_for_name_raises_ValueError(
            self):
        workspace_handle = MuonWorkspaceWrapper(workspace=self.workspace)

        with self.assertRaises(ValueError):
            workspace_handle.show("")
    def test_that_showing_the_workspace_with_empty_string_for_name_raises_ValueError(self):
        workspace_handle = MuonWorkspaceWrapper(workspace=self.workspace)

        with self.assertRaises(ValueError):
            workspace_handle.show("")