diff --git a/scripts/Diffraction/isis_powder/abstract_inst.py b/scripts/Diffraction/isis_powder/abstract_inst.py index b5d0c81cd5e791f0e24256767236d0a94f8aed7d..6117735019b9b04bafcb81ff91e3708a9ca2d145 100644 --- a/scripts/Diffraction/isis_powder/abstract_inst.py +++ b/scripts/Diffraction/isis_powder/abstract_inst.py @@ -337,10 +337,7 @@ class AbstractInst(object): return [self._generate_inst_filename(run, file_ext) for run in run_number] else: # Individual entry - runfile = self._inst_prefix + str(run_number) - if file_ext is not None: - runfile += file_ext - return runfile + return self._inst_prefix + str(run_number) + file_ext def _add_formatting_options(self, format_options): """ diff --git a/scripts/Diffraction/isis_powder/gem.py b/scripts/Diffraction/isis_powder/gem.py index 262a7c18ad5caafe7203ecb3b90413d294ef0d86..3eda16937c5cd5d2ce420c86241660524807f582 100644 --- a/scripts/Diffraction/isis_powder/gem.py +++ b/scripts/Diffraction/isis_powder/gem.py @@ -179,8 +179,8 @@ class Gem(AbstractInst): raise_warning=raise_warning) @staticmethod - def _generate_input_file_name(run_number): - return _gem_generate_inst_name(run_number=run_number) + def _generate_input_file_name(run_number, file_ext=""): + return _gem_generate_inst_name(run_number=run_number) + file_ext def _apply_absorb_corrections(self, run_details, ws_to_correct): if self._is_vanadium: diff --git a/scripts/Diffraction/isis_powder/hrpd.py b/scripts/Diffraction/isis_powder/hrpd.py index ee7dbaf0b64371515d5c75c0b563a2dbdbd7e602..f7b291af02777f9f19444707156bec5acf24ba12 100644 --- a/scripts/Diffraction/isis_powder/hrpd.py +++ b/scripts/Diffraction/isis_powder/hrpd.py @@ -14,11 +14,11 @@ from isis_powder.hrpd_routines import hrpd_advanced_config, hrpd_algs, hrpd_para import mantid.simpleapi as mantid -# Force using raw files -# A bug in loading old NeXus files prevents using NeXus. +# A bug on the instrument when recording historic NeXus files (< 2015) caused +# corrupted data. Use raw files for now until sufficient time has past and old +# data is unlikely to be reanalysed. RAW_DATA_EXT = '.raw' - # Constants PROMPT_PULSE_INTERVAL = 20000.0 PROMPT_PULSE_RIGHT_WIDTH = 140.0 @@ -106,14 +106,16 @@ class HRPD(AbstractInst): raise RuntimeError("Could not find " + os.path.join(path, name)+" please run create_vanadium with " "\"do_solid_angle_corrections=True\"") - def _generate_input_file_name(self, run_number, file_ext=None): + def _generate_input_file_name(self, run_number, file_ext=""): """ Generates a name which Mantid uses within Load to find the file. :param run_number: The run number to convert into a valid format for Mantid :param file_ext: An optional file extension to add to force a particular format :return: A filename that will allow Mantid to find the correct run for that instrument. """ - return self._generate_inst_filename(run_number=run_number, file_ext=RAW_DATA_EXT) + if not file_ext: + file_ext = RAW_DATA_EXT + return self._generate_inst_filename(run_number=run_number, file_ext=file_ext) def _apply_absorb_corrections(self, run_details, ws_to_correct): if self._is_vanadium: diff --git a/scripts/Diffraction/isis_powder/polaris.py b/scripts/Diffraction/isis_powder/polaris.py index 04b15eb7105acc0acc98247f7931dfe247ce1802..71b9d40ab17eac5c7c00f623508af26bdf634f3c 100644 --- a/scripts/Diffraction/isis_powder/polaris.py +++ b/scripts/Diffraction/isis_powder/polaris.py @@ -92,7 +92,7 @@ class Polaris(AbstractInst): return cropped_ws @staticmethod - def _generate_input_file_name(run_number): + def _generate_input_file_name(run_number, file_ext=""): polaris_old_name = "POL" polaris_new_name = "POLARIS" first_run_new_name = 96912 @@ -114,7 +114,7 @@ class Polaris(AbstractInst): prefix = polaris_new_name if use_new_name else polaris_old_name - return prefix + str(run_number) + return prefix + str(run_number) + file_ext def _get_input_batching_mode(self): return self._inst_settings.input_mode diff --git a/scripts/Diffraction/isis_powder/routines/common.py b/scripts/Diffraction/isis_powder/routines/common.py index 113b6cbe6d4a38b3cb989a7ba032ac83084c4006..356ba007629a67201064e6a2c8093815b0e30628 100644 --- a/scripts/Diffraction/isis_powder/routines/common.py +++ b/scripts/Diffraction/isis_powder/routines/common.py @@ -596,6 +596,7 @@ def _load_raw_files(run_number_string, instrument, file_ext=None): :return: A list of loaded workspaces """ run_number_list = generate_run_numbers(run_number_string=run_number_string) + file_ext = "" if file_ext is None else file_ext load_raw_ws = _load_list_of_files(run_number_list, instrument, file_ext=file_ext) return load_raw_ws @@ -613,8 +614,7 @@ def _load_list_of_files(run_numbers_list, instrument, file_ext=None): _check_load_range(list_of_runs_to_load=run_numbers_list) for run_number in run_numbers_list: - file_name = instrument._generate_input_file_name(run_number=run_number) - file_name = file_name + str(file_ext) if file_ext else file_name + file_name = instrument._generate_input_file_name(run_number=run_number, file_ext=file_ext) read_ws = mantid.Load(Filename=file_name) read_ws_list.append(mantid.RenameWorkspace(InputWorkspace=read_ws, OutputWorkspace=file_name)) diff --git a/scripts/Diffraction/isis_powder/test/ISISPowderCommonTest.py b/scripts/Diffraction/isis_powder/test/ISISPowderCommonTest.py index 6344f40b9bfcccb49840def5532758924d24f355..51f714a0ade14526ba9b4355d61a035c243297f5 100644 --- a/scripts/Diffraction/isis_powder/test/ISISPowderCommonTest.py +++ b/scripts/Diffraction/isis_powder/test/ISISPowderCommonTest.py @@ -571,9 +571,9 @@ class ISISPowderMockInst(object): return ISISPowderMockRunDetails(file_ext=self._file_ext) @staticmethod - def _generate_input_file_name(run_number): + def _generate_input_file_name(run_number, file_ext=""): # Mantid will automatically convert this into either POL or POLARIS - return "POL" + str(run_number) + return "POL" + str(run_number) + file_ext @staticmethod def _normalise_ws_current(ws_to_correct, **_):