def _add_corrections_to_ads(corrections_group, prefix): corrections_names = [] for correction_workspace in corrections_group: name = prefix + correction_workspace.getName().rsplit('_', 1)[1] mtd.addOrReplace(name, correction_workspace) corrections_names.append(name) return corrections_names
def _cloneTestWorkspace(self, wsName=None): if not wsName: # Cannot use as default parameter as 'self' is not know in argument list. wsName = self._TEST_WS_NAME tempName = 'temp_testWS_' mtd.addOrReplace(tempName, self._testIN5WS) ws = CloneWorkspace(InputWorkspace=tempName, OutputWorkspace=wsName) mtd.remove(tempName) return ws
def _final_fit(self, corrected_data, masses, profiles): fit_result = self._fit_helper(InputWorkspace=corrected_data, WorkspaceIndex=0, Masses=masses, MassProfiles=profiles, OutputWorkspace="__fit_output", FitParameters=self._fit_namer.fit_parameters_name, StoreInADS=False) DeleteWorkspace(corrected_data) mtd.addOrReplace(self._fit_namer.fit_output_name, fit_result[0]) return fit_result
def group_spectra(workspace_name, masked_detectors, method, group_file=None, group_ws=None): """ Groups spectra in a given workspace according to the Workflow.GroupingMethod and Workflow.GroupingFile parameters and GroupingPolicy property. @param workspace_name Name of workspace to group spectra of @param masked_detectors List of spectra numbers to mask @param method Grouping method (IPF, All, Individual, File, Workspace) @param group_file File for File method @param group_ws Workspace for Workspace method """ grouped_ws = group_spectra_of(mtd[workspace_name], masked_detectors, method, group_file, group_ws) if grouped_ws is not None: mtd.addOrReplace(workspace_name, grouped_ws)
def _add_and_group_caad(fit_namer, vesuvio_input, suffices, normalised_workspaces, summed_workspaces, indices): normalised_names = [fit_namer.normalised_group_name + "_" + suffices[index] for index in indices] summed_names = [fit_namer.caad_group_name + "_" + suffices[index] for index in indices] name_count = dict() for name, workspace in zip(normalised_names + summed_names, normalised_workspaces + summed_workspaces): if name not in name_count: mtd.addOrReplace(name, workspace) name_count[name] = 1 else: name_count[name] += 1 mtd.addOrReplace(name + str(name_count[name]), workspace) map(_create_spectra_axis_copier(vesuvio_input.sample_data), normalised_workspaces) GroupWorkspaces(InputWorkspaces=normalised_workspaces, OutputWorkspace=fit_namer.normalised_group_name) GroupWorkspaces(InputWorkspaces=summed_workspaces, OutputWorkspace=fit_namer.caad_group_name)
def __init__(self, sample_runs, container_runs, spectra, loader): # Load sample and container runs self.spectra = _parse_spectra(loader.fit_mode, spectra, sample_runs) self.sample_runs, self.sample_data = self._try_load_data(sample_runs, self.spectra, loader, "Unable to load Sample Runs:") mtd.addOrReplace(self._tof_workspace_suffix(self.sample_runs, self.spectra), self.sample_data) if container_runs is not None: self.container_runs, self.container_data = self._try_load_data(container_runs, self.spectra, loader, "Unable to load Container Runs:") mtd.addOrReplace(self._tof_workspace_suffix(self.container_runs, self.spectra), self.container_data) else: self.container_runs, self.container_data = None, None self._back_scattering = is_back_scattering_spectra(self.spectra)
def _add_parameters_to_ads(vesuvio_output, fit_namer): mtd.addOrReplace(fit_namer.prefit_parameters_correction_name, vesuvio_output.prefit_parameters_workspace) mtd.addOrReplace(fit_namer.fit_correction_name, vesuvio_output.correction_parameters_workspace) mtd.addOrReplace(fit_namer.fit_parameters_correction_name, vesuvio_output.fit_parameters_workspace)