diff --git a/scripts/Diffraction/isis_powder/abstract_inst.py b/scripts/Diffraction/isis_powder/abstract_inst.py index 1c024864a0a82fa7295cd6d239c145ab0ab90f5e..62748c1bbc608e4d26b09413a8a49c714f2c7c82 100644 --- a/scripts/Diffraction/isis_powder/abstract_inst.py +++ b/scripts/Diffraction/isis_powder/abstract_inst.py @@ -178,7 +178,7 @@ class AbstractInst(object): by default for instruments who do not with to specify it :return: The current input batching type from the InputBatchingEnum """ - return common_enums.InputBatchingEnum.Summed + return common_enums.INPUT_BATCHING.Summed def _get_monitor_spectra_index(self, run_number): """ diff --git a/scripts/Diffraction/isis_powder/gem_routines/gem_enums.py b/scripts/Diffraction/isis_powder/gem_routines/gem_enums.py index e19fe3cf688bdfd1597be1da7676bac29229c62a..3d8fa738beca230bb887f14c608f97d4d3d6c5e5 100644 --- a/scripts/Diffraction/isis_powder/gem_routines/gem_enums.py +++ b/scripts/Diffraction/isis_powder/gem_routines/gem_enums.py @@ -1,6 +1,6 @@ from __future__ import (absolute_import, division, print_function) -class ChopperModes(object): +class GEM_CHOPPER_MODES(object): PDF = "PDF" Rietveld = "Rietveld" diff --git a/scripts/Diffraction/isis_powder/gem_routines/gem_param_mapping.py b/scripts/Diffraction/isis_powder/gem_routines/gem_param_mapping.py index 00a5acaaf912e8810083f634c5afb2028026200f..0d23b3a0874b13507e10d140628cea7a6052749c 100644 --- a/scripts/Diffraction/isis_powder/gem_routines/gem_param_mapping.py +++ b/scripts/Diffraction/isis_powder/gem_routines/gem_param_mapping.py @@ -1,8 +1,8 @@ from __future__ import (absolute_import, division, print_function) from isis_powder.routines.ParamMapEntry import ParamMapEntry -from isis_powder.gem_routines.gem_enums import ChopperModes -from isis_powder.routines.common_enums import InputBatchingEnum, WorkspaceUnits +from isis_powder.gem_routines.gem_enums import GEM_CHOPPER_MODES +from isis_powder.routines.common_enums import INPUT_BATCHING, WORKSPACE_UNITS # Maps friendly user name (ext_name) -> script name (int_name) attr_mapping = \ @@ -13,8 +13,8 @@ attr_mapping = \ ParamMapEntry(ext_name="do_absorb_corrections", int_name="do_absorb_corrections"), ParamMapEntry(ext_name="focused_cropping_values", int_name="focused_cropping_values"), ParamMapEntry(ext_name="grouping_file_name", int_name="grouping_file_name"), - ParamMapEntry(ext_name="input_mode", int_name="input_batching", enum_class=InputBatchingEnum), - ParamMapEntry(ext_name="mode", int_name="mode", enum_class=ChopperModes), + ParamMapEntry(ext_name="input_mode", int_name="input_batching", enum_class=INPUT_BATCHING), + ParamMapEntry(ext_name="mode", int_name="mode", enum_class=GEM_CHOPPER_MODES), ParamMapEntry(ext_name="multiple_scattering", int_name="multiple_scattering"), ParamMapEntry(ext_name="raw_tof_cropping_values", int_name="raw_tof_cropping_values"), ParamMapEntry(ext_name="run_in_range", int_name="run_in_range"), @@ -22,9 +22,9 @@ attr_mapping = \ ParamMapEntry(ext_name="sample_empty", int_name="sample_empty", optional=True), ParamMapEntry(ext_name="spline_coefficient", int_name="spline_coeff"), ParamMapEntry(ext_name="output_directory", int_name="output_dir"), - ParamMapEntry(ext_name="unit_to_keep", int_name="unit_to_keep", - enum_class=WorkspaceUnits, optional=True), + ParamMapEntry(ext_name="unit_to_keep", int_name="unit_to_keep", + enum_class=WORKSPACE_UNITS, optional=True), ParamMapEntry(ext_name="user_name", int_name="user_name"), ParamMapEntry(ext_name="vanadium_cropping_values", int_name="vanadium_cropping_values"), ParamMapEntry(ext_name="vanadium_normalisation", int_name="do_van_norm") - ] \ No newline at end of file + ] diff --git a/scripts/Diffraction/isis_powder/pearl_routines/pearl_calibration_algs.py b/scripts/Diffraction/isis_powder/pearl_routines/pearl_calibration_algs.py index 79907fa9eee9c4d50da968e929e1f184e8d0900a..39d0f90d2734f79dee6a1e60bf71413c9ea220f1 100644 --- a/scripts/Diffraction/isis_powder/pearl_routines/pearl_calibration_algs.py +++ b/scripts/Diffraction/isis_powder/pearl_routines/pearl_calibration_algs.py @@ -3,14 +3,14 @@ from __future__ import (absolute_import, division, print_function) import os import mantid.simpleapi as mantid import isis_powder.routines.common as common -from isis_powder.routines.common_enums import InputBatchingEnum +from isis_powder.routines.common_enums import INPUT_BATCHING # TODO this entire file needs cleaning and refactoring def create_calibration(self, calibration_runs, offset_file_name, grouping_file_name): input_ws_list = common.load_current_normalised_ws_list(run_number_string=calibration_runs, instrument=self, - input_batching=InputBatchingEnum.Summed) + input_batching=INPUT_BATCHING.Summed) input_ws = input_ws_list[0] run_details = self._get_run_details(calibration_runs) diff --git a/scripts/Diffraction/isis_powder/pearl_routines/pearl_enums.py b/scripts/Diffraction/isis_powder/pearl_routines/pearl_enums.py index d274633b8371ed6858c52d4c22f4be5580b4534a..6ac69a37400dac8c39f42f9b09bf1df107f85880 100644 --- a/scripts/Diffraction/isis_powder/pearl_routines/pearl_enums.py +++ b/scripts/Diffraction/isis_powder/pearl_routines/pearl_enums.py @@ -1,7 +1,7 @@ from __future__ import (absolute_import, division, print_function) -class PearlFocusModes(object): +class PEARL_FOCUS_MODES(object): enum_friendly_name = "focus modes" all = "all" groups = "groups" @@ -9,7 +9,7 @@ class PearlFocusModes(object): mods = "mods" -class PearlTTModes(object): +class PEARL_TT_MODES(object): enum_friendly_name = "tt_modes" all = "all" tt_35 = "tt35" diff --git a/scripts/Diffraction/isis_powder/pearl_routines/pearl_param_mapping.py b/scripts/Diffraction/isis_powder/pearl_routines/pearl_param_mapping.py index 4189a8f2f0c456fee1d273935da39d030f8090d3..8f12c7a7924fe5f8a97b07f7137f133792762b2e 100644 --- a/scripts/Diffraction/isis_powder/pearl_routines/pearl_param_mapping.py +++ b/scripts/Diffraction/isis_powder/pearl_routines/pearl_param_mapping.py @@ -1,7 +1,7 @@ from __future__ import (absolute_import, division, print_function) from isis_powder.routines.ParamMapEntry import ParamMapEntry -from isis_powder.pearl_routines.pearl_enums import PearlFocusModes, PearlTTModes +from isis_powder.pearl_routines.pearl_enums import PEARL_FOCUS_MODES, PEARL_TT_MODES # Maps friendly user name (ext_name) -> script name (int_name) attr_mapping = \ @@ -11,7 +11,7 @@ attr_mapping = \ ParamMapEntry(ext_name="calibration_config_path", int_name="cal_map_path"), ParamMapEntry(ext_name="calibration_directory", int_name="calibration_dir"), ParamMapEntry(ext_name="do_absorb_corrections", int_name="absorb_corrections"), - ParamMapEntry(ext_name="focus_mode", int_name="focus_mode", enum_class=PearlFocusModes), + ParamMapEntry(ext_name="focus_mode", int_name="focus_mode", enum_class=PEARL_FOCUS_MODES), ParamMapEntry(ext_name="long_mode", int_name="long_mode"), ParamMapEntry(ext_name="monitor_lambda_crop_range", int_name="monitor_lambda"), ParamMapEntry(ext_name="monitor_integration_range", int_name="monitor_integration_range"), @@ -27,7 +27,7 @@ attr_mapping = \ ParamMapEntry(ext_name="tt88_grouping", int_name="tt88_grouping"), ParamMapEntry(ext_name="tt70_grouping", int_name="tt70_grouping"), ParamMapEntry(ext_name="tt35_grouping", int_name="tt35_grouping"), - ParamMapEntry(ext_name="tt_mode", int_name="tt_mode", enum_class=PearlTTModes), + ParamMapEntry(ext_name="tt_mode", int_name="tt_mode", enum_class=PEARL_TT_MODES), ParamMapEntry(ext_name="user_name", int_name="user_name"), ParamMapEntry(ext_name="vanadium_absorb_file", int_name="van_absorb_file"), ParamMapEntry(ext_name="vanadium_tof_cropping", int_name="van_tof_cropping"), diff --git a/scripts/Diffraction/isis_powder/polaris_routines/polaris_param_mapping.py b/scripts/Diffraction/isis_powder/polaris_routines/polaris_param_mapping.py index a446705ba01abff6fbbd52abe0c5f25242240ffb..e7b9be85d85a2ab865c96a17fa6d7ea9821a409a 100644 --- a/scripts/Diffraction/isis_powder/polaris_routines/polaris_param_mapping.py +++ b/scripts/Diffraction/isis_powder/polaris_routines/polaris_param_mapping.py @@ -1,7 +1,7 @@ from __future__ import (absolute_import, division, print_function) from isis_powder.routines.ParamMapEntry import ParamMapEntry -from isis_powder.routines.common_enums import InputBatchingEnum +from isis_powder.routines.common_enums import INPUT_BATCHING # Maps friendly user name (ext_name) -> script name (int_name) attr_mapping = \ @@ -14,7 +14,7 @@ attr_mapping = \ ParamMapEntry(ext_name="do_van_normalisation", int_name="do_van_normalisation"), ParamMapEntry(ext_name="focused_cropping_values", int_name="focused_cropping_values"), ParamMapEntry(ext_name="grouping_file_name", int_name="grouping_file_name"), - ParamMapEntry(ext_name="input_mode", int_name="input_mode", enum_class=InputBatchingEnum), + ParamMapEntry(ext_name="input_mode", int_name="input_mode", enum_class=INPUT_BATCHING), ParamMapEntry(ext_name="masking_file_name", int_name="masking_file_name"), ParamMapEntry(ext_name="multiple_scattering", int_name="multiple_scattering"), ParamMapEntry(ext_name="raw_data_cropping_values", int_name="raw_data_crop_values"), diff --git a/scripts/Diffraction/isis_powder/routines/calibrate.py b/scripts/Diffraction/isis_powder/routines/calibrate.py index b0c4f903054eb1e1b6a1ab9b478e839f336834b4..d8a5c22712ecd08c270958e3e33eaecef743e413 100644 --- a/scripts/Diffraction/isis_powder/routines/calibrate.py +++ b/scripts/Diffraction/isis_powder/routines/calibrate.py @@ -3,14 +3,14 @@ from __future__ import (absolute_import, division, print_function) import mantid.simpleapi as mantid import isis_powder.routines.common as common -from isis_powder.routines.common_enums import InputBatchingEnum +from isis_powder.routines.common_enums import INPUT_BATCHING def create_van(instrument, run_details, absorb): van = run_details.vanadium_run_numbers # Always sum a range of inputs as its a vanadium run over multiple captures input_van_ws_list = common.load_current_normalised_ws_list(run_number_string=van, instrument=instrument, - input_batching=InputBatchingEnum.Summed) + input_batching=INPUT_BATCHING.Summed) input_van_ws = input_van_ws_list[0] # As we asked for a summed ws there should only be one returned # TODO where do we subtract empty can on GEM ? diff --git a/scripts/Diffraction/isis_powder/routines/common.py b/scripts/Diffraction/isis_powder/routines/common.py index d0b64e54e99011dfc482b4127141822019a575c7..0b63491be934cea0b730d945f924377dad9dd1c0 100644 --- a/scripts/Diffraction/isis_powder/routines/common.py +++ b/scripts/Diffraction/isis_powder/routines/common.py @@ -2,7 +2,7 @@ from __future__ import (absolute_import, division, print_function) import mantid.kernel as kernel import mantid.simpleapi as mantid -from isis_powder.routines.common_enums import InputBatchingEnum, WorkspaceUnits +from isis_powder.routines.common_enums import INPUT_BATCHING, WORKSPACE_UNITS def cal_map_dictionary_key_helper(dictionary, key, append_to_error_message=None): @@ -188,11 +188,11 @@ def keep_single_ws_unit(d_spacing_group, tof_group, unit_to_keep): # If they do not specify which unit to keep don't do anything return - if unit_to_keep == WorkspaceUnits.d_spacing: + if unit_to_keep == WORKSPACE_UNITS.d_spacing: remove_intermediate_workspace(tof_group) del tof_group - elif unit_to_keep == WorkspaceUnits.tof: + elif unit_to_keep == WORKSPACE_UNITS.tof: remove_intermediate_workspace(d_spacing_group) del d_spacing_group @@ -218,7 +218,7 @@ def load_current_normalised_ws_list(run_number_string, instrument, input_batchin run_information = instrument._get_run_details(run_number_string=run_number_string) raw_ws_list = _load_raw_files(run_number_string=run_number_string, instrument=instrument) - if input_batching.lower() == InputBatchingEnum.Summed.lower() and len(raw_ws_list) > 1: + if input_batching.lower() == INPUT_BATCHING.Summed.lower() and len(raw_ws_list) > 1: summed_ws = _sum_ws_range(ws_list=raw_ws_list) remove_intermediate_workspace(raw_ws_list) raw_ws_list = [summed_ws] @@ -302,7 +302,7 @@ def subtract_sample_empty(ws_to_correct, empty_sample_ws_string, instrument): """ if empty_sample_ws_string: empty_sample = load_current_normalised_ws_list(run_number_string=empty_sample_ws_string, instrument=instrument, - input_batching=InputBatchingEnum.Summed) + input_batching=INPUT_BATCHING.Summed) mantid.Minus(LHSWorkspace=ws_to_correct, RHSWorkspace=empty_sample[0], OutputWorkspace=ws_to_correct) remove_intermediate_workspace(empty_sample) diff --git a/scripts/Diffraction/isis_powder/routines/common_enums.py b/scripts/Diffraction/isis_powder/routines/common_enums.py index d311e1737343314c422158704b71579fda7138db..649fb8aafd0e62f5cd0f430a48a86cf69e677015 100644 --- a/scripts/Diffraction/isis_powder/routines/common_enums.py +++ b/scripts/Diffraction/isis_powder/routines/common_enums.py @@ -3,16 +3,13 @@ from __future__ import (absolute_import, division, print_function) # Holds enumeration classes for common values -class InputBatchingEnum(object): +class INPUT_BATCHING(object): enum_friendly_name = "batching modes" Individual = "Individual" Summed = "Summed" -class WorkspaceUnits(object): +class WORKSPACE_UNITS(object): enum_friendly_name = "workspace units" d_spacing = "dSpacing" tof = "TOF" - - - diff --git a/scripts/Diffraction/isis_powder/routines/focus.py b/scripts/Diffraction/isis_powder/routines/focus.py index dd0d700071603728af23e5ae54b61f8bb928dfc7..4a6ea3ca31554740f3732f18f0100cc14e1db1cb 100644 --- a/scripts/Diffraction/isis_powder/routines/focus.py +++ b/scripts/Diffraction/isis_powder/routines/focus.py @@ -3,16 +3,16 @@ from __future__ import (absolute_import, division, print_function) import mantid.simpleapi as mantid import isis_powder.routines.common as common -from isis_powder.routines.common_enums import InputBatchingEnum +from isis_powder.routines.common_enums import INPUT_BATCHING import os import warnings def focus(run_number_string, instrument, perform_vanadium_norm=True): input_batching = instrument._get_input_batching_mode() - if input_batching == InputBatchingEnum.Individual: + if input_batching == INPUT_BATCHING.Individual: return _individual_run_focusing(instrument, perform_vanadium_norm, run_number_string) - elif input_batching == InputBatchingEnum.Summed: + elif input_batching == INPUT_BATCHING.Summed: return _batched_run_focusing(instrument, perform_vanadium_norm, run_number_string) else: raise ValueError("Input batching not passed through. Please contact development team.")