diff --git a/scripts/Diffraction/isis_powder/abstract_inst.py b/scripts/Diffraction/isis_powder/abstract_inst.py index 52fe4478c9dfa4b77dfd48d9b5d0d782e2a96494..ad37679d1256f4b005881663225a0dad5a78773e 100644 --- a/scripts/Diffraction/isis_powder/abstract_inst.py +++ b/scripts/Diffraction/isis_powder/abstract_inst.py @@ -1,12 +1,12 @@ from __future__ import (absolute_import, division, print_function) +import os from abc import ABCMeta, abstractmethod + from six import add_metaclass -import os -from isis_powder import common -from isis_powder import focus -from isis_powder import calibrate +from isis_powder.routines import calibrate, focus, common + # This class provides common hooks for instruments to override # if they want to define the behaviour of the hook. Otherwise it @@ -224,9 +224,6 @@ class AbstractInst(object): return True # TODO set this to False if they just dump their raw files in one folder - def _mask_noisy_detectors(self, vanadium_run): - pass - def _calculate_solid_angle_efficiency_corrections(self, vanadium_ws): return _empty_hook_return_none() diff --git a/scripts/Diffraction/isis_powder/pearl.py b/scripts/Diffraction/isis_powder/pearl.py index e20fcc0777629397fd2817c5c2d9576f759b4939..b7a42798a89f3a3dd94abf2995d4288424ce1722 100644 --- a/scripts/Diffraction/isis_powder/pearl.py +++ b/scripts/Diffraction/isis_powder/pearl.py @@ -1,20 +1,16 @@ from __future__ import (absolute_import, division, print_function) -import mantid.simpleapi as mantid -from mantid import config +import os +import mantid.simpleapi as mantid import numpy as numpy +from mantid import config -import os - +import isis_powder.routines.common as common from isis_powder.abstract_inst import AbstractInst -import isis_powder.common as common +from isis_powder.pearl_routines import fmode_output, pearl_calib_factory, pearl_cycle_factory +from isis_powder.routines.RunDetails import RunDetails -from isis_powder import pearl_calib_factory -from isis_powder import pearl_cycle_factory -from isis_powder.RunDetails import RunDetails - -from isis_powder.pearl_routines import fmode_output class Pearl(AbstractInst): @@ -50,7 +46,6 @@ class Pearl(AbstractInst): pearl_mc_absorption_file_name = "PRL112_DC25_10MM_FF.OUT" # TODO self._attenuation_full_path = os.path.join(calibration_dir, pearl_mc_absorption_file_name) - # --- Abstract Implementation ---- # # Params # diff --git a/scripts/Diffraction/isis_powder/pearl_routines/fmode_output.py b/scripts/Diffraction/isis_powder/pearl_routines/fmode_output.py index c91bb1cfc4eccba0955e7c98bc3cc40333b93b20..16dd8da3c47a53c8e7bf14e96943b2f0494f14f4 100644 --- a/scripts/Diffraction/isis_powder/pearl_routines/fmode_output.py +++ b/scripts/Diffraction/isis_powder/pearl_routines/fmode_output.py @@ -2,7 +2,7 @@ from __future__ import (absolute_import, division, print_function) import mantid.simpleapi as mantid -import isis_powder.common as common +import isis_powder.routines.common as common # This file generates the various outputs for the PEARL instruments and saves them to their respective files @@ -138,7 +138,7 @@ def _focus_mode_all(output_file_paths, calibrated_spectra): first_spectrum = calibrated_spectra[0] summed_spectra = mantid.CloneWorkspace(InputWorkspace=first_spectrum) - for i in range(1, 9): # TODO why is this 1-8 + for i in range(1, 9): summed_spectra = mantid.Plus(LHSWorkspace=summed_spectra, RHSWorkspace=calibrated_spectra[i]) summed_spectra_name = output_file_paths["output_name"] + "_mods1-9" diff --git a/scripts/Diffraction/isis_powder/pearl_calib_factory.py b/scripts/Diffraction/isis_powder/pearl_routines/pearl_calib_factory.py similarity index 100% rename from scripts/Diffraction/isis_powder/pearl_calib_factory.py rename to scripts/Diffraction/isis_powder/pearl_routines/pearl_calib_factory.py diff --git a/scripts/Diffraction/isis_powder/pearl_cycle_factory.py b/scripts/Diffraction/isis_powder/pearl_routines/pearl_cycle_factory.py similarity index 100% rename from scripts/Diffraction/isis_powder/pearl_cycle_factory.py rename to scripts/Diffraction/isis_powder/pearl_routines/pearl_cycle_factory.py diff --git a/scripts/Diffraction/isis_powder/polaris.py b/scripts/Diffraction/isis_powder/polaris.py index a486731e52beed47edec786dd66a315a2c20b95a..570f0f909079e7cc5e899e8101dea91044938cce 100644 --- a/scripts/Diffraction/isis_powder/polaris.py +++ b/scripts/Diffraction/isis_powder/polaris.py @@ -1,14 +1,13 @@ from __future__ import (absolute_import, division, print_function) -import math import os + import mantid.simpleapi as mantid +import isis_powder.routines.common as common from isis_powder.abstract_inst import AbstractInst from isis_powder.polaris_routines import polaris_calib_parser - -import isis_powder.common as common -from isis_powder.RunDetails import RunDetails +from isis_powder.routines.RunDetails import RunDetails class Polaris(AbstractInst): @@ -100,12 +99,6 @@ class Polaris(AbstractInst): normalised_ws = mantid.NormaliseByCurrent(InputWorkspace=ws_to_correct) return normalised_ws - def _mask_noisy_detectors(self, vanadium_ws): - summed_van_ws = mantid.Integration(InputWorkspace=vanadium_ws) - # TODO do they want this masking detectors with too high a contribution? - mantid.MaskDetectorsIf(InputWorkspace=summed_van_ws, InputCalFile=self._grouping_file_path, - OutputCalFile=self._cal_file_path, Mode="DeselectIf", Operator="LessEqual", Value=10) - def _calculate_solid_angle_efficiency_corrections(self, vanadium_ws): solid_angle_ws = mantid.SolidAngle(InputWorkspace=vanadium_ws) solid_angle_multiplicand = mantid.CreateSingleValuedWorkspace(DataValue=str(100)) diff --git a/scripts/Diffraction/isis_powder/polaris_routines/polaris_calib_factory.py b/scripts/Diffraction/isis_powder/polaris_routines/polaris_calib_factory.py deleted file mode 100644 index 0c62c4afbd1f54ebdda918e5e7558ff0fe2c538f..0000000000000000000000000000000000000000 --- a/scripts/Diffraction/isis_powder/polaris_routines/polaris_calib_factory.py +++ /dev/null @@ -1,10 +0,0 @@ -from __future__ import (absolute_import, division, print_function) - - -def get_calibration_file(cycle): - - # TODO setup this - offset_file_name = "offsets_2011_cycle111b.cal" - grouping_file_name = "offsets_2011_cycle111b.cal" - vanadium_file_name = "POL78338.raw" - return offset_file_name, grouping_file_name, vanadium_file_name \ No newline at end of file diff --git a/scripts/Diffraction/isis_powder/polaris_routines/polaris_calib_parser.py b/scripts/Diffraction/isis_powder/polaris_routines/polaris_calib_parser.py index 61bec441c3f5efcfaca7bd50ba641e9deec116d3..48680fca5acdd3c61842dc66a9de5b7ad455cce0 100644 --- a/scripts/Diffraction/isis_powder/polaris_routines/polaris_calib_parser.py +++ b/scripts/Diffraction/isis_powder/polaris_routines/polaris_calib_parser.py @@ -1,9 +1,11 @@ from __future__ import (absolute_import, division, print_function) -import isis_powder.common import os + import yaml +import isis_powder.routines.common + def get_calibration_dict(run_number): config_file = _open_yaml_file() @@ -52,7 +54,7 @@ def _check_if_run_is_exception(config_handle, run_number): def _find_dictionary_key(dict_to_search, run_number): for key in dict_to_search: - generated_runs = isis_powder.common.generate_run_numbers(run_number_string=key) + generated_runs = isis_powder.routines.common.generate_run_numbers(run_number_string=key) if run_number in generated_runs: return key diff --git a/scripts/Diffraction/isis_powder/RunDetails.py b/scripts/Diffraction/isis_powder/routines/RunDetails.py similarity index 100% rename from scripts/Diffraction/isis_powder/RunDetails.py rename to scripts/Diffraction/isis_powder/routines/RunDetails.py diff --git a/scripts/Diffraction/isis_powder/routines/__init__.py b/scripts/Diffraction/isis_powder/routines/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/scripts/Diffraction/isis_powder/routines/__init__.py @@ -0,0 +1 @@ + diff --git a/scripts/Diffraction/isis_powder/calibrate.py b/scripts/Diffraction/isis_powder/routines/calibrate.py similarity index 98% rename from scripts/Diffraction/isis_powder/calibrate.py rename to scripts/Diffraction/isis_powder/routines/calibrate.py index a6132e9dd91e62595e38dd0d624e07d354c8f9cd..5757e75a46e99477cf540c9341b06bf5b9119587 100644 --- a/scripts/Diffraction/isis_powder/calibrate.py +++ b/scripts/Diffraction/isis_powder/routines/calibrate.py @@ -1,9 +1,10 @@ from __future__ import (absolute_import, division, print_function) import os + import mantid.simpleapi as mantid -import isis_powder.common as common +import isis_powder.routines.common as common def create_van(instrument, van, empty, output_van_file_name, num_of_splines, absorb, gen_absorb): diff --git a/scripts/Diffraction/isis_powder/common.py b/scripts/Diffraction/isis_powder/routines/common.py similarity index 100% rename from scripts/Diffraction/isis_powder/common.py rename to scripts/Diffraction/isis_powder/routines/common.py diff --git a/scripts/Diffraction/isis_powder/focus.py b/scripts/Diffraction/isis_powder/routines/focus.py similarity index 98% rename from scripts/Diffraction/isis_powder/focus.py rename to scripts/Diffraction/isis_powder/routines/focus.py index 98e79741316d1d3115a0a2a86bc42e85907f8a7f..49fc5f41440ba9225676aeb6c887e2148ef87c0a 100644 --- a/scripts/Diffraction/isis_powder/focus.py +++ b/scripts/Diffraction/isis_powder/routines/focus.py @@ -1,7 +1,8 @@ from __future__ import (absolute_import, division, print_function) import mantid.simpleapi as mantid -import isis_powder.common as common + +import isis_powder.routines.common as common def focus(number, instrument, attenuate=True, van_norm=True):