From 8fe6fa31e6ba0011e478c72eed0aea96b90563ae Mon Sep 17 00:00:00 2001 From: Joseph Ramsay <joseph.ramsay@stfc.ac.uk> Date: Mon, 27 Nov 2017 09:59:25 +0000 Subject: [PATCH] Re #21252 Expose POLARIS suffix param to all instruments HRPD decided they want a suffix parameter with the behaviour of the one recently implemented for POLARIS. The suffix-related was moved from POLARIS-specific scripts to abstract instrument in order to expose it to all instruments, should they want to use it --- scripts/Diffraction/isis_powder/abstract_inst.py | 2 ++ .../isis_powder/hrpd_routines/hrpd_param_mapping.py | 1 + scripts/Diffraction/isis_powder/polaris.py | 6 ------ scripts/Diffraction/isis_powder/routines/run_details.py | 8 ++++++-- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/scripts/Diffraction/isis_powder/abstract_inst.py b/scripts/Diffraction/isis_powder/abstract_inst.py index b854c139a1f..5a2d4b6f9b9 100644 --- a/scripts/Diffraction/isis_powder/abstract_inst.py +++ b/scripts/Diffraction/isis_powder/abstract_inst.py @@ -218,6 +218,8 @@ class AbstractInst(object): # Prepend the file extension used if it was set, this groups the files nicely in the file browser # Also remove the dot at the start so we don't make hidden files in *nix systems file_name = run_details.file_extension[1:] + file_name if run_details.file_extension else file_name + file_name += run_details.output_suffix if run_details.output_suffix is not None else "" + nxs_file = os.path.join(output_directory, (file_name + ".nxs")) gss_file = os.path.join(output_directory, (file_name + ".gsas")) tof_xye_file = os.path.join(output_directory, (file_name + "_tof_xye.dat")) diff --git a/scripts/Diffraction/isis_powder/hrpd_routines/hrpd_param_mapping.py b/scripts/Diffraction/isis_powder/hrpd_routines/hrpd_param_mapping.py index 0c8324b049b..2f7b09410ca 100644 --- a/scripts/Diffraction/isis_powder/hrpd_routines/hrpd_param_mapping.py +++ b/scripts/Diffraction/isis_powder/hrpd_routines/hrpd_param_mapping.py @@ -21,6 +21,7 @@ attr_mapping = \ ParamMapEntry(ext_name="run_number", int_name="run_number"), ParamMapEntry(ext_name="sample_empty", int_name="sample_empty", optional=True), ParamMapEntry(ext_name="sample_empty_scale", int_name="sample_empty_scale"), + ParamMapEntry(ext_name="suffix", int_name="suffix", optional=True), ParamMapEntry(ext_name="user_name", int_name="user_name"), ParamMapEntry(ext_name="vanadium_normalisation", int_name="do_van_norm"), ParamMapEntry(ext_name="vanadium_tof_cropping", int_name="van_tof_cropping"), diff --git a/scripts/Diffraction/isis_powder/polaris.py b/scripts/Diffraction/isis_powder/polaris.py index c720dfcd86c..4ebf8aaee45 100644 --- a/scripts/Diffraction/isis_powder/polaris.py +++ b/scripts/Diffraction/isis_powder/polaris.py @@ -99,12 +99,6 @@ class Polaris(AbstractInst): return prefix + str(run_number) - def _generate_output_file_name(self, run_number_string): - suffix = self._inst_settings.suffix - if suffix is None: - suffix = "" - return Polaris._generate_input_file_name(run_number_string) + suffix - def _get_input_batching_mode(self): return self._inst_settings.input_mode diff --git a/scripts/Diffraction/isis_powder/routines/run_details.py b/scripts/Diffraction/isis_powder/routines/run_details.py index 1e87f551f22..6891f89311f 100644 --- a/scripts/Diffraction/isis_powder/routines/run_details.py +++ b/scripts/Diffraction/isis_powder/routines/run_details.py @@ -59,6 +59,9 @@ def create_run_details_object(run_number_string, inst_settings, is_vanadium_run, # Prefix dot if user has forgotten to file_extension = file_extension if file_extension.startswith('.') else '.' + file_extension + # Get the output name suffix if set + suffix = getattr(inst_settings, "suffix") + # Sample empty if there is one as this is instrument specific sample_empty = getattr(inst_settings, "sample_empty", None) @@ -75,7 +78,7 @@ def create_run_details_object(run_number_string, inst_settings, is_vanadium_run, offset_file_path=offset_file_path, grouping_file_path=grouping_file_path, splined_vanadium_path=splined_van_path, vanadium_run_number=vanadium_run_string, sample_empty=sample_empty, vanadium_abs_path=van_absorb_path, - unsplined_vanadium_path=unsplined_van_path) + unsplined_vanadium_path=unsplined_van_path, output_suffix=suffix) def _get_customisable_attributes(cal_dict, inst_settings, empty_run_call, grouping_name_call, vanadium_run_call, @@ -183,7 +186,7 @@ class _RunDetails(object): def __init__(self, empty_run_number, file_extension, run_number, output_run_string, label, offset_file_path, grouping_file_path, splined_vanadium_path, vanadium_run_number, - sample_empty, vanadium_abs_path, unsplined_vanadium_path): + sample_empty, vanadium_abs_path, unsplined_vanadium_path, output_suffix): # Essential attribute self.empty_runs = empty_run_number @@ -203,3 +206,4 @@ class _RunDetails(object): self.file_extension = str(file_extension) if file_extension else None self.sample_empty = sample_empty self.vanadium_absorption_path = vanadium_abs_path + self.output_suffix = output_suffix -- GitLab