diff --git a/scripts/Inelastic/Direct/DirectEnergyConversion.py b/scripts/Inelastic/Direct/DirectEnergyConversion.py index e674471ab9c091d259edc796448793e920e5aa4a..8bd1155159366221ef71cb0d01d1338cff5752ee 100644 --- a/scripts/Inelastic/Direct/DirectEnergyConversion.py +++ b/scripts/Inelastic/Direct/DirectEnergyConversion.py @@ -566,11 +566,9 @@ class DirectEnergyConversion(object): if self._multirep_mode: result.append(deltaE_ws_sample) else: - if results_name != out_ws_name: - RenameWorkspace(InputWorkspace=results_name,OutputWorkspace=out_ws_name) - results_name = out_ws_name - result = mtd[results_name] - PropertyManager.sample_run.synchronize_ws(result) + if results_name != out_ws_name: # This actually returns deltaE_ws_sample.name() + # to the state, defined in ADS. Intentionally skip renaming here. + result = PropertyManager.sample_run.synchronize_ws(deltaE_ws_sample) else: result = deltaE_ws_sample else: # delete workspace if no output is requested diff --git a/scripts/Inelastic/Direct/ReductionWrapper.py b/scripts/Inelastic/Direct/ReductionWrapper.py index 5b6e2f75926fc1cd615a2a2eb8039d6ea2c63b83..804511d4bf6bc2d0a6c6e751a48ed6f2e1e32778 100644 --- a/scripts/Inelastic/Direct/ReductionWrapper.py +++ b/scripts/Inelastic/Direct/ReductionWrapper.py @@ -754,10 +754,10 @@ def iliad(reduce): if isinstance(rez, list): # multirep run, just return as it is return rez - if not(rez is None) and out_ws_name and rez.name() != out_ws_name: + if rez is not None and out_ws_name and rez.name() != out_ws_name: # the function does not return None, pylint is wrong #pylint: disable=W1111 - rez = RenameWorkspace(InputWorkspace=rez, OutputWorkspace=out_ws_name) + rez = PropertyManager.sample_run.synchronize_ws(rez,out_ws_name) return rez return iliad_wrapper diff --git a/scripts/Inelastic/Direct/RunDescriptor.py b/scripts/Inelastic/Direct/RunDescriptor.py index ca71ccb4f4116a3b2272e108f64314469c63125a..1f7f76e14db687fa4c47eb7fdb965a528b899db5 100644 --- a/scripts/Inelastic/Direct/RunDescriptor.py +++ b/scripts/Inelastic/Direct/RunDescriptor.py @@ -742,7 +742,7 @@ class RunDescriptor(PropDescriptor): return self._build_ws_name() #-------------------------------------------------------------------------------------------------------------------- - def synchronize_ws(self,workspace=None): + def synchronize_ws(self,workspace=None,new_ws_name = None): """Synchronize workspace name (after workspace may have changed due to algorithm) with internal run holder name. Accounts for the situation when @@ -753,8 +753,10 @@ class RunDescriptor(PropDescriptor): """ if not workspace: workspace = mtd[self._ws_name] - - new_name = self._build_ws_name() + if new_ws_name: + new_name = new_ws_name + else: + new_name = self._build_ws_name() old_name = workspace.name() if new_name != old_name: # Compatibility with old test code comes here: @@ -767,6 +769,8 @@ class RunDescriptor(PropDescriptor): workspace.setMonitorWorkspace(mon_ws) RenameWorkspace(InputWorkspace=old_name,OutputWorkspace=new_name,RenameMonitors=True) self._ws_name = new_name + + return mtd[new_name] #-------------------------------------------------------------------------------------------------------------------- @staticmethod