diff --git a/RefRed/sf_calculator/reduction_sf_calculator.py b/RefRed/sf_calculator/reduction_sf_calculator.py index 5649325a..c5b7aacd 100644 --- a/RefRed/sf_calculator/reduction_sf_calculator.py +++ b/RefRed/sf_calculator/reduction_sf_calculator.py @@ -205,22 +205,24 @@ def generate_script( script += "from lr_reduction.scaling_factors import LRScalingFactors\n" script += "from lr_reduction.utils import mantid_algorithm_exec\n\n" - script += "mantid_algorithm_exec(\n" - script += " LRScalingFactors.LRScalingFactors,\n" - script += f" DirectBeamRuns={run_list},\n" - script += f" IncidentMedium='{incident_medium}',\n" - script += f" TOFRange={tof_range},\n" - script += f" TOFSteps={self.sf_gui.deadtime_tof_step},\n" - script += f" SignalPeakPixelRange={peak_ranges},\n" - script += f" SignalBackgroundPixelRange={bck_ranges},\n" - script += f" LowResolutionPixelRange={low_res_ranges},\n" - script += f" ScalingFactorFile='{output_file_name}',\n" - script += f" UseDeadTimeCorrection={self.sf_gui.apply_deadtime},\n" - script += f" ParalyzableDeadTime={self.sf_gui.paralyzable_deadtime},\n" - script += f" DeadTime={self.sf_gui.deadtime_value},\n" - script += f" DeadTimeTOFStep={self.sf_gui.deadtime_tof_step},\n" - script += ")\n" - + mantid_call = [ + r"mantid_algorithm_exec(", + r" LRScalingFactors.LRScalingFactors,", + r" DirectBeamRuns={0},".format(run_list), + r" IncidentMedium='{0}',".format(incident_medium), + r" TOFRange={0},".format(tof_range), + r" TOFSteps={0},".format(self.sf_gui.deadtime_tof_step), + r" SignalPeakPixelRange={0},".format(peak_ranges), + r" SignalBackgroundPixelRange={0},".format(bck_ranges), + r" LowResolutionPixelRange={0},".format(low_res_ranges), + r" ScalingFactorFile='{0}',".format(output_file_name), + r" UseDeadTimeCorrection={0},".format(self.sf_gui.apply_deadtime), + r" ParalyzableDeadTime={0},".format(self.sf_gui.paralyzable_deadtime), + r" DeadTime={0},".format(self.sf_gui.deadtime_value), + r" DeadTimeTOFStep={0},".format(self.sf_gui.deadtime_tof_step), + r")", + ] + script += "\n".join(mantid_call) + "\n" return script def refreshOutputFileContainPreview(self, output_file_name): diff --git a/test/conftest.py b/test/conftest.py index 087495c6..b8d7f0d0 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -35,8 +35,8 @@ def directory(self): def path_to(self, basename): r"""Absolute path to a data file""" file_path = os.path.join(self._directory, basename) - if not os.path.isfile(file_path): - raise IOError(f'File {basename} not found in data directory {self._directory}') + if os.path.isfile(file_path) is False: + raise FileNotFoundError(f"File {basename} not found in data directory {self._directory}") # noqa E713 return file_path yield _DataServe()