From f254cf5d4271c53641c6730549012066afad77bc Mon Sep 17 00:00:00 2001 From: Martyn Gigg <martyn.gigg@stfc.ac.uk> Date: Thu, 17 Mar 2011 15:51:39 +0000 Subject: [PATCH] Fix for diag script overwriting masks from successive diagnose calls. This will allow them to be combined. Re #1762 --- .../Inelastic/DirectEnergyConversion.py | 26 +++++++++++++------ Code/Mantid/Scripts/Inelastic/diagnostics.py | 7 ++++- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/Code/Mantid/Scripts/Inelastic/DirectEnergyConversion.py b/Code/Mantid/Scripts/Inelastic/DirectEnergyConversion.py index df305b0c07f..80f2c94492e 100755 --- a/Code/Mantid/Scripts/Inelastic/DirectEnergyConversion.py +++ b/Code/Mantid/Scripts/Inelastic/DirectEnergyConversion.py @@ -96,14 +96,24 @@ class DirectEnergyConversion(object): print_results - If True then the results are printed to std out inst_name - The name of the instrument to perform the diagnosis. If it is not provided then the default instrument is used (default = None) - """ - self.spectra_masks = \ - diagnostics.diagnose(white_run, sample_run, other_white, remove_zero, - tiny, large, median_lo, median_hi, signif, - bkgd_threshold, bkgd_range, variation, - bleed_test, bleed_maxrate, bleed_pixels, - hard_mask, print_results, self.instr_name) - return self.spectra_masks + """ + lhs_names = lhs_info('names') + if len(lhs_names) > 0: + var_name = lhs_names[0] + else: + var_name = None + + __diagnostic_mask = diagnostics.diagnose(white_run, sample_run, other_white, remove_zero, + tiny, large, median_lo, median_hi, signif, + bkgd_threshold, bkgd_range, variation, + bleed_test, bleed_maxrate, bleed_pixels, + hard_mask, print_results, self.instr_name) + if var_name is not None: + result = RenameWorkspace(str(__diagnostic_mask), var_name).workspace() + else: + result = __diagnostic_mask + self.spectra_masks = result + return result def do_white(self, white_run, spectra_masks, map_file): """ diff --git a/Code/Mantid/Scripts/Inelastic/diagnostics.py b/Code/Mantid/Scripts/Inelastic/diagnostics.py index 4e86c8f29b8..073cca0867c 100644 --- a/Code/Mantid/Scripts/Inelastic/diagnostics.py +++ b/Code/Mantid/Scripts/Inelastic/diagnostics.py @@ -74,7 +74,12 @@ def diagnose(white_run, sample_run=None, other_white=None, remove_zero=None, ## ## Accumulate the masking on this workspace ## - diag_total_mask = 'diag_total_mask' + # What shall we call the output + lhs_names = lhs_info('names') + if len(lhs_names) > 0: + diag_total_mask = lhs_names[0] + else: + diag_total_mask = 'diag_total_mask' ## ## White beam Test -- GitLab