Exemple #1
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 _create_workspace_label(self, workspace_name, index):
     group = str(get_group_or_pair_from_name(workspace_name))
     run = str(get_run_numbers_as_string_from_workspace_name(workspace_name, self.context.data_context.instrument))
     instrument = self.context.data_context.instrument
     rebin_label = self._get_rebin_label(workspace_name)
     if not self.context.plot_panes_context[self.name].settings._is_tiled:
         return f"{instrument}{run};{group}{rebin_label}"
     if self.context.plot_panes_context[self.name].settings.is_tiled_by == "Group/Pair":
         return f"{run}{rebin_label}"
     else:
         return f"{group}{rebin_label}"
 def _get_runs_groups_and_pairs_for_simultaneous_fit_by_runs(
         self, display_type: str):
     """Returns the runs and group/pairs for the selected data in simultaneous fit by runs mode."""
     runs = self._get_selected_runs()
     groups_and_pairs = [
         get_group_or_pair_from_name(name)
         for name in self.fitting_context.dataset_names
     ]
     workspace_names = [
         "/".join(
             self.get_fit_workspace_names_from_groups_and_runs(
                 [run], groups_and_pairs)) for run in runs
     ]
     return self._get_datasets_containing_string(
         display_type, workspace_names, runs,
         [";".join(groups_and_pairs)] * len(runs))
 def _create_workspace_label(self, workspace_name, index):
     group = str(get_group_or_pair_from_name(workspace_name))
     run = str(
         get_run_numbers_as_string_from_workspace_name(
             workspace_name, self.context.data_context.instrument))
     instrument = self.context.data_context.instrument
     fit_label = self._get_fit_label(workspace_name, index)
     rebin_label = self._get_rebin_label(workspace_name)
     if not self.context.plot_panes_context[self.name].settings._is_tiled:
         return "".join(
             [instrument, run, ';', group, fit_label, rebin_label])
     if self.context.plot_panes_context[
             self.name].settings.is_tiled_by == "Group/Pair":
         return "".join([run, fit_label, rebin_label])
     else:
         return "".join([group, fit_label, rebin_label])