From 4c54a5cec948fe88e17f6398f6c2a3e6308b654a Mon Sep 17 00:00:00 2001 From: MialLewis <95620982+MialLewis@users.noreply.github.com> Date: Tue, 2 May 2023 11:08:22 +0100 Subject: [PATCH] respond to pr review comments --- .../calibrate_vesuvio_analysis.py | 16 +++++----------- .../calibration_scripts/calibrate_vesuvio_fit.py | 9 +++------ .../load_calibration_algorithms.py | 5 ++--- .../tests/system/test_system_analysis.py | 2 +- .../tests/system/test_system_fit.py | 2 +- 5 files changed, 12 insertions(+), 22 deletions(-) diff --git a/unpackaged/vesuvio_calibration/calibration_scripts/calibrate_vesuvio_analysis.py b/unpackaged/vesuvio_calibration/calibration_scripts/calibrate_vesuvio_analysis.py index acf9ab24..ed1ee5e8 100644 --- a/unpackaged/vesuvio_calibration/calibration_scripts/calibrate_vesuvio_analysis.py +++ b/unpackaged/vesuvio_calibration/calibration_scripts/calibrate_vesuvio_analysis.py @@ -1,13 +1,8 @@ -from mantid.kernel import StringArrayProperty, Direction, StringListValidator, IntArrayBoundedValidator, IntArrayProperty,\ - FloatArrayBoundedValidator, FloatArrayMandatoryValidator, StringMandatoryValidator, IntBoundedValidator,\ - FloatArrayProperty -from mantid.api import FileProperty, FileAction, ITableWorkspaceProperty, PropertyMode, Progress, TextAxis, PythonAlgorithm,\ - AlgorithmManager -from mantid.simpleapi import CreateEmptyTableWorkspace, DeleteWorkspace, CropWorkspace, RebinToWorkspace, Divide,\ - ReplaceSpecialValues, FindPeaks, GroupWorkspaces, mtd, Plus, LoadVesuvio, LoadRaw, ConvertToDistribution,\ - FindPeakBackground, ExtractSingleSpectrum, SumSpectra, AppendSpectra, ConvertTableToMatrixWorkspace,\ - ConjoinWorkspaces, Transpose, PlotPeakByLogValue, CloneWorkspace, MaskDetectors,\ - ExtractUnmaskedSpectra, CreateWorkspace, RenameWorkspace +from mantid.kernel import StringArrayProperty, Direction, StringListValidator, FloatArrayBoundedValidator, StringMandatoryValidator,\ + IntBoundedValidator, FloatArrayProperty +from mantid.api import FileProperty, FileAction, PythonAlgorithm,AlgorithmManager +from mantid.simpleapi import CreateEmptyTableWorkspace, DeleteWorkspace, ReplaceSpecialValues, GroupWorkspaces, mtd,\ + ConvertTableToMatrixWorkspace, ConjoinWorkspaces, Transpose, PlotPeakByLogValue,RenameWorkspace from unpackaged.vesuvio_calibration.calibration_scripts.calibrate_vesuvio_helper_functions import EVSGlobals, EVSMiscFunctions import os @@ -280,7 +275,6 @@ def _calculate_scattering_angle(self, table_name, spec_list): L0 = EVSMiscFunctions.read_table_column(self._current_workspace, 'L0', spec_list) L1 = EVSMiscFunctions.read_table_column(self._param_table, 'L1', spec_list) L1_nan_to_num = np.nan_to_num(L1) - spec = EVSMiscFunctions.read_table_column(self._current_workspace, 'Spectrum', spec_list) t0 /= 1e+6 diff --git a/unpackaged/vesuvio_calibration/calibration_scripts/calibrate_vesuvio_fit.py b/unpackaged/vesuvio_calibration/calibration_scripts/calibrate_vesuvio_fit.py index 439fb671..d6c37b24 100644 --- a/unpackaged/vesuvio_calibration/calibration_scripts/calibrate_vesuvio_fit.py +++ b/unpackaged/vesuvio_calibration/calibration_scripts/calibrate_vesuvio_fit.py @@ -1,13 +1,10 @@ from mantid.kernel import StringArrayProperty, Direction, StringListValidator, IntArrayBoundedValidator, IntArrayProperty,\ - FloatArrayBoundedValidator, FloatArrayMandatoryValidator, StringMandatoryValidator, IntBoundedValidator,\ - FloatArrayProperty, logger + FloatArrayBoundedValidator, FloatArrayMandatoryValidator, StringMandatoryValidator, FloatArrayProperty, logger from mantid.api import FileProperty, FileAction, ITableWorkspaceProperty, PropertyMode, Progress, TextAxis, PythonAlgorithm,\ WorkspaceFactory, AnalysisDataService from mantid.simpleapi import CreateEmptyTableWorkspace, DeleteWorkspace, CropWorkspace, RebinToWorkspace, Divide,\ - ReplaceSpecialValues, FindPeaks, GroupWorkspaces, mtd, Plus, LoadVesuvio, LoadRaw, ConvertToDistribution,\ - FindPeakBackground, ExtractSingleSpectrum, SumSpectra, AppendSpectra, ConvertTableToMatrixWorkspace,\ - ConjoinWorkspaces, Transpose, PlotPeakByLogValue, CloneWorkspace, Fit, MaskDetectors,\ - ExtractUnmaskedSpectra, CreateWorkspace + ReplaceSpecialValues, FindPeaks, GroupWorkspaces, mtd, Plus, LoadVesuvio, LoadRaw, ConvertToDistribution, FindPeakBackground,\ + ExtractSingleSpectrum, SumSpectra, AppendSpectra, CloneWorkspace, Fit, MaskDetectors, ExtractUnmaskedSpectra, CreateWorkspace from functools import partial from unpackaged.vesuvio_calibration.calibration_scripts.calibrate_vesuvio_helper_functions import EVSGlobals, EVSMiscFunctions diff --git a/unpackaged/vesuvio_calibration/load_calibration_algorithms.py b/unpackaged/vesuvio_calibration/load_calibration_algorithms.py index cd7fa434..1c982c5e 100644 --- a/unpackaged/vesuvio_calibration/load_calibration_algorithms.py +++ b/unpackaged/vesuvio_calibration/load_calibration_algorithms.py @@ -6,10 +6,9 @@ EVSCalibrationFit is used to fit m peaks to n spectra. The positions of the peaks are esitmated using the supplied instrument parameter file and the d-spacings of the sample (if provided). Support is provided for both Voigt and Gaussian functions. - EVSCalibrationAnalysis uses EVSCalibrationFit to calculate instrument parameters using the output of the fitting and the and an existing - instrument parameter file. + EVSCalibrationAnalysis uses the output from EVSCalibrationFit to calculate instrument parameters. - The procedures used here are based upon those descibed in: Calibration of an electron volt neutron spectrometer, Nuclear Instruments and + The procedures used here are based upon those described in: Calibration of an electron volt neutron spectrometer, Nuclear Instruments and Methods in Physics Research A (15 October 2010), doi:10.1016/j.nima.2010.09.079 by J. Mayers, M. A. Adams """ diff --git a/unpackaged/vesuvio_calibration/tests/system/test_system_analysis.py b/unpackaged/vesuvio_calibration/tests/system/test_system_analysis.py index 59c0b88c..5165d1e2 100644 --- a/unpackaged/vesuvio_calibration/tests/system/test_system_analysis.py +++ b/unpackaged/vesuvio_calibration/tests/system/test_system_analysis.py @@ -2,7 +2,7 @@ import numpy as np from mantid.api import AlgorithmFactory -from mantid.simpleapi import LoadVesuvio, LoadRaw, mtd, ConvertToDistribution +from mantid.simpleapi import mtd from mock import patch from unpackaged.vesuvio_calibration.tests.testhelpers.algorithms import create_algorithm from unpackaged.vesuvio_calibration.tests.testhelpers.system_test_base import EVSCalibrationTest, TestConstants diff --git a/unpackaged/vesuvio_calibration/tests/system/test_system_fit.py b/unpackaged/vesuvio_calibration/tests/system/test_system_fit.py index 7e0648c9..cc9343bc 100644 --- a/unpackaged/vesuvio_calibration/tests/system/test_system_fit.py +++ b/unpackaged/vesuvio_calibration/tests/system/test_system_fit.py @@ -4,7 +4,7 @@ import scipy.stats from mantid.api import WorkspaceGroup, AlgorithmFactory -from mantid.simpleapi import LoadVesuvio, LoadRaw, mtd, ConvertToDistribution +from mantid.simpleapi import mtd from mock import patch from unpackaged.vesuvio_calibration.tests.testhelpers.algorithms import create_algorithm from unpackaged.vesuvio_calibration.tests.testhelpers.system_test_base import EVSCalibrationTest, TestConstants