diff --git a/Code/Mantid/Framework/PythonInterface/plugins/algorithms/SortDetectors.py b/Code/Mantid/Framework/PythonInterface/plugins/algorithms/SortDetectors.py index d5a388c7d857..12798d8df9d8 100644 --- a/Code/Mantid/Framework/PythonInterface/plugins/algorithms/SortDetectors.py +++ b/Code/Mantid/Framework/PythonInterface/plugins/algorithms/SortDetectors.py @@ -25,9 +25,9 @@ def summary(self): def PyInit(self): """ Declare properties """ - self.declareProperty(mantid.api.WorkspaceProperty("Workspace", "", - direction=mantid.kernel.Direction.Input, - validator=mantid.api.InstrumentValidator()), + self.declareProperty(mantid.api.WorkspaceProperty( "Workspace", "", + direction=mantid.kernel.Direction.Input, + validator=mantid.api.InstrumentValidator()), "Input workspace") self.declareProperty(IntArrayProperty("UpstreamSpectra", Direction.Output)) diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/ARCSReductionTest.py b/Code/Mantid/Testing/SystemTests/tests/analysis/ARCSReductionTest.py index bca0a9fd1572..e92eb2ce790a 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/ARCSReductionTest.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/ARCSReductionTest.py @@ -31,8 +31,7 @@ def runTest(self): self.vanFile0=os.path.join(config.getString('defaultsave.directory'),'ARCSvan_0.nxs') self.nxspeFile=os.path.join(config.getString('defaultsave.directory'),'ARCSsystemtest.nxspe') config['default.facility']="SNS" - DgsReduction( - SampleInputFile="ARCS_23961_event.nxs", + DgsReduction( SampleInputFile="ARCS_23961_event.nxs", OutputWorkspace="reduced", IncidentBeamNormalisation="ByCurrent", DetectorVanadiumInputFile="WBARCS.nxs", @@ -42,8 +41,7 @@ def runTest(self): DetVanIntRangeUnits="Wavelength", SaveProcessedDetVan=True, SaveProcDetVanFilename=self.vanFile0) - DgsReduction( - SampleInputFile="ARCS_23961_event.nxs", + DgsReduction( SampleInputFile="ARCS_23961_event.nxs", OutputWorkspace="reduced", IncidentBeamNormalisation="ByCurrent", DetectorVanadiumInputFile="WBARCS.nxs", diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/CNCSReductionTest.py b/Code/Mantid/Testing/SystemTests/tests/analysis/CNCSReductionTest.py index fed01a40dcdb..b81c988db7b2 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/CNCSReductionTest.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/CNCSReductionTest.py @@ -39,8 +39,7 @@ def runTest(self): Ei=mtd['sum'].getRun()['EnergyRequest'].firstValue() tib=SuggestTibCNCS(Ei) - DgsReduction( - SampleInputWorkspace="sum", + DgsReduction( SampleInputWorkspace="sum", OutputWorkspace="reduced", EnergyTransferRange="-0.2,0.05,2.2", GroupingFile=self.groupingFile, diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/ISISLoadingEventData.py b/Code/Mantid/Testing/SystemTests/tests/analysis/ISISLoadingEventData.py index 5f44184d902a..7992f5c17804 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/ISISLoadingEventData.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/ISISLoadingEventData.py @@ -12,6 +12,7 @@ def runTest(self): # isis_vms_compat/SPB[2] self.assertEqual(ev_ws.sample().getGeometryFlag(), 1, "It does not read correctly the vms compat (check ") # Isis correct the tof using loadTimeOfFlight method. - self.assertDelta(ev_ws.getEventList(10).getTofs()[1], 1041.89,0.01, "The ISIS event correction is incorrect (check LoadEventNexus::loadTimeOfFlight") + self.assertDelta( ev_ws.getEventList(10).getTofs()[1], 1041.89,0.01, + "The ISIS event correction is incorrect (check LoadEventNexus::loadTimeOfFlight") def validate(self): return True diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/OffspecSESANS.py b/Code/Mantid/Testing/SystemTests/tests/analysis/OffspecSESANS.py index bdfdd55239a7..44fb2fd8250b 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/OffspecSESANS.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/OffspecSESANS.py @@ -1,6 +1,6 @@ -#pylint: disable=no-init +#pylint: disable=no-init,unused-import from stresstesting import MantidStressTest -from mantid.simpleapi import mtd, config +from mantid.simpleapi import config class OffspecSESANS(MantidStressTest): diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/POLDITruncateDataTest.py b/Code/Mantid/Testing/SystemTests/tests/analysis/POLDITruncateDataTest.py index f3268f6a7b21..43b53153f6ea 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/POLDITruncateDataTest.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/POLDITruncateDataTest.py @@ -2,7 +2,7 @@ import stresstesting from mantid.simpleapi import * -'''This test checks that the results of PoldiAutoCorrelation match the expected outcome.''' +# This test checks that the results of PoldiAutoCorrelation match the expected outcome. class POLDITruncateDataTest(stresstesting.MantidStressTest): def runTest(self): self.dataFileName = "poldi2013n006903" diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/PowderDiffProfileCalibrateTest.py b/Code/Mantid/Testing/SystemTests/tests/analysis/PowderDiffProfileCalibrateTest.py index fccac5738ae2..bd6148ee6421 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/PowderDiffProfileCalibrateTest.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/PowderDiffProfileCalibrateTest.py @@ -12,10 +12,6 @@ import mantid.simpleapi as api from mantid.simpleapi import * -def getSaveDir(): - """determine where to save - the current working directory""" - import os - return os.path.abspath(os.path.curdir) class VulcanExamineProfile(stresstesting.MantidStressTest): irf_file = 'arg_powder.irf' @@ -27,28 +23,25 @@ def requiredFiles(self): return files def runTest(self): - savedir = getSaveDir() - LoadAscii(Filename=self.dat_file, OutputWorkspace='arg_si',Unit='TOF') LoadNexusProcessed(Filename=self.bkgd_file, OutputWorkspace='Arg_Si_Bkgd_Parameter') - CreateLeBailFitInput(FullprofParameterFile=self.irf_file, - GenerateBraggReflections='1',LatticeConstant='5.4313640', - InstrumentParameterWorkspace='Arg_Bank1', BraggPeakParameterWorkspace='ReflectionTable') + CreateLeBailFitInput( FullprofParameterFile=self.irf_file, + GenerateBraggReflections='1',LatticeConstant='5.4313640', + InstrumentParameterWorkspace='Arg_Bank1', BraggPeakParameterWorkspace='ReflectionTable') # run the actual code - ExaminePowderDiffProfile( - InputWorkspace = 'arg_si', - StartX = 1990., - EndX = 29100., - ProfileType = 'Back-to-back exponential convoluted with PseudoVoigt', - ProfileWorkspace = 'Arg_Bank1', - BraggPeakWorkspace = 'ReflectionTable', - BackgroundParameterWorkspace = 'Arg_Si_Bkgd_Parameter', - BackgroundType = 'Polynomial', - BackgroundWorkspace = 'Arg_Si_Background', - OutputWorkspace = 'Arg_Si_Calculated') + ExaminePowderDiffProfile( InputWorkspace = 'arg_si', + StartX = 1990., + EndX = 29100., + ProfileType = 'Back-to-back exponential convoluted with PseudoVoigt', + ProfileWorkspace = 'Arg_Bank1', + BraggPeakWorkspace = 'ReflectionTable', + BackgroundParameterWorkspace = 'Arg_Si_Bkgd_Parameter', + BackgroundType = 'Polynomial', + BackgroundWorkspace = 'Arg_Si_Background', + OutputWorkspace = 'Arg_Si_Calculated') # load output gsas file and the golden one @@ -73,16 +66,14 @@ def requiredFiles(self): return files def runTest(self): - savedir = getSaveDir() - # Data LoadAscii(Filename=self.dat_file, OutputWorkspace='VULCAN_22946_NOM',Unit='TOF') # Reflections and starting profile parameters - CreateLeBailFitInput(FullprofParameterFile=self.irf_file, - GenerateBraggReflections='1',LatticeConstant='5.431364000', - InstrumentParameterWorkspace='Vulcan_B270_Profile', - BraggPeakParameterWorkspace='GeneralReflectionTable') + CreateLeBailFitInput( FullprofParameterFile=self.irf_file, + GenerateBraggReflections='1',LatticeConstant='5.431364000', + InstrumentParameterWorkspace='Vulcan_B270_Profile', + BraggPeakParameterWorkspace='GeneralReflectionTable') # Pre-refined background paramnames = ["Bkpos", "A0", "A1", "A2", "A3", "A4", "A5"] @@ -96,94 +87,87 @@ def runTest(self): ws.addRow([paramnames[i], paramvalues[i]]) # Examine profile - ExaminePowderDiffProfile( - InputWorkspace = "VULCAN_22946_NOM", - LoadData = False, - StartX = 7000., - EndX = 33000., - ProfileType = "Back-to-back exponential convoluted with PseudoVoigt", - ProfileWorkspace = "Vulcan_B270_Profile", - BraggPeakWorkspace = "GeneralReflectionTable", - GenerateInformationWS = False, - BackgroundParameterWorkspace = "VULCAN_22946_Bkgd_Parameter", - ProcessBackground = False, - BackgroundType = "FullprofPolynomial", - BackgroundWorkspace = "Dummy", - OutputWorkspace = "VULCAN_22946_Calculated") + ExaminePowderDiffProfile( InputWorkspace = "VULCAN_22946_NOM", + LoadData = False, + StartX = 7000., + EndX = 33000., + ProfileType = "Back-to-back exponential convoluted with PseudoVoigt", + ProfileWorkspace = "Vulcan_B270_Profile", + BraggPeakWorkspace = "GeneralReflectionTable", + GenerateInformationWS = False, + BackgroundParameterWorkspace = "VULCAN_22946_Bkgd_Parameter", + ProcessBackground = False, + BackgroundType = "FullprofPolynomial", + BackgroundWorkspace = "Dummy", + OutputWorkspace = "VULCAN_22946_Calculated") # Set up sequential refinement - api.RefinePowderDiffProfileSeq( - InputWorkspace = "VULCAN_22946_NOM", - SeqControlInfoWorkspace = "", - InputProfileWorkspace = "Vulcan_B270_Profile", - InputBraggPeaksWorkspace = "GeneralReflectionTable", - InputBackgroundParameterWorkspace = "VULCAN_22946_Bkgd_Parameter", - StartX = 7000., - EndX = 33000., - FunctionOption = "Setup", # or "Refine" - RefinementOption = "Random Walk", - ParametersToRefine = "Alph0", - NumRefineCycles = 1000, - ProfileType = "Neutron Back-to-back exponential convoluted with pseudo-voigt", - BackgroundType = "FullprofPolynomial", - ProjectID = "IDx890") + api.RefinePowderDiffProfileSeq( InputWorkspace = "VULCAN_22946_NOM", + SeqControlInfoWorkspace = "", + InputProfileWorkspace = "Vulcan_B270_Profile", + InputBraggPeaksWorkspace = "GeneralReflectionTable", + InputBackgroundParameterWorkspace = "VULCAN_22946_Bkgd_Parameter", + StartX = 7000., + EndX = 33000., + FunctionOption = "Setup", # or "Refine" + RefinementOption = "Random Walk", + ParametersToRefine = "Alph0", + NumRefineCycles = 1000, + ProfileType = "Neutron Back-to-back exponential convoluted with pseudo-voigt", + BackgroundType = "FullprofPolynomial", + ProjectID = "IDx890") # Refine step 1 - api.RefinePowderDiffProfileSeq( - InputWorkspace = "VULCAN_22946_NOM", - SeqControlInfoWorkspace = "RecordIDx890Table", - InputProfileWorkspace = "Vulcan_B270_Profile", - InputBraggPeaksWorkspace = "GeneralReflectionTable", - InputBackgroundParameterWorkspace = "VULCAN_22946_Bkgd_Parameter", - StartX = 7000., - EndX = 33000., - FunctionOption = "Refine", # or "Refine" - RefinementOption = "Random Walk", - ParametersToRefine = "Alph0", - NumRefineCycles = 1000, - ProfileType = "Neutron Back-to-back exponential convoluted with pseudo-voigt", - BackgroundType = "FullprofPolynomial", - ProjectID = "IDx890") + api.RefinePowderDiffProfileSeq( InputWorkspace = "VULCAN_22946_NOM", + SeqControlInfoWorkspace = "RecordIDx890Table", + InputProfileWorkspace = "Vulcan_B270_Profile", + InputBraggPeaksWorkspace = "GeneralReflectionTable", + InputBackgroundParameterWorkspace = "VULCAN_22946_Bkgd_Parameter", + StartX = 7000., + EndX = 33000., + FunctionOption = "Refine", # or "Refine" + RefinementOption = "Random Walk", + ParametersToRefine = "Alph0", + NumRefineCycles = 1000, + ProfileType = "Neutron Back-to-back exponential convoluted with pseudo-voigt", + BackgroundType = "FullprofPolynomial", + ProjectID = "IDx890") # Refine step 2 - api.RefinePowderDiffProfileSeq( - InputWorkspace = "VULCAN_22946_NOM", - SeqControlInfoWorkspace = "RecordIDx890Table", - # InputProfileWorkspace = "Vulcan_B270_Profile", - # InputBraggPeaksWorkspace = "GeneralReflectionTable", - # InputBackgroundParameterWorkspace = "VULCAN_22946_Bkgd_Parameter", - StartX = 7000., - EndX = 33000., - FunctionOption = "Refine", # or "Refine" - RefinementOption = "Random Walk", - ParametersToRefine = "Beta0, Beta1", - NumRefineCycles = 100, - # ProfileType = "Neutron Back-to-back exponential convoluted with psuedo-voigt", - # BackgroundType = "FullprofPolynomial" - ProjectID = "IDx890") - + api.RefinePowderDiffProfileSeq( InputWorkspace = "VULCAN_22946_NOM", + SeqControlInfoWorkspace = "RecordIDx890Table", + # InputProfileWorkspace = "Vulcan_B270_Profile", + # InputBraggPeaksWorkspace = "GeneralReflectionTable", + # InputBackgroundParameterWorkspace = "VULCAN_22946_Bkgd_Parameter", + StartX = 7000., + EndX = 33000., + FunctionOption = "Refine", # or "Refine" + RefinementOption = "Random Walk", + ParametersToRefine = "Beta0, Beta1", + NumRefineCycles = 100, + # ProfileType = "Neutron Back-to-back exponential convoluted with psuedo-voigt", + # BackgroundType = "FullprofPolynomial" + ProjectID = "IDx890") # Refine step 3 (not from previous cycle) - api.RefinePowderDiffProfileSeq( - InputWorkspace = "VULCAN_22946_NOM", - SeqControlInfoWorkspace = "RecordIDx890Table", - StartX = 7000., - EndX = 33000., - FunctionOption = "Refine", # or "Refine" - RefinementOption = "Random Walk", - ParametersToRefine = "Beta0, Beta1", - NumRefineCycles = 100, - FromStep = 1, - ProjectID = "IDx890") + api.RefinePowderDiffProfileSeq( InputWorkspace = "VULCAN_22946_NOM", + SeqControlInfoWorkspace = "RecordIDx890Table", + StartX = 7000., + EndX = 33000., + FunctionOption = "Refine", # or "Refine" + RefinementOption = "Random Walk", + ParametersToRefine = "Beta0, Beta1", + NumRefineCycles = 100, + FromStep = 1, + ProjectID = "IDx890") # Save - api.RefinePowderDiffProfileSeq( - InputWorkspace = "VULCAN_22946_NOM", - SeqControlInfoWorkspace = "RecordIDx890Table", - FunctionOption = "Save", - OutputProjectFilename = "temp991.nxs", - ProjectID = "IDx890") + api.RefinePowderDiffProfileSeq( InputWorkspace = "VULCAN_22946_NOM", + SeqControlInfoWorkspace = "RecordIDx890Table", + FunctionOption = "Save", + OutputProjectFilename = "temp991.nxs", + ProjectID = "IDx890") return @@ -206,25 +190,21 @@ def requiredFiles(self): return files def runTest(self): - savedir = getSaveDir() - # Load - api.RefinePowderDiffProfileSeq( - FunctionOption = "Load", - InputProjectFilename = self.seqfile, - ProjectID = "IDx890") + api.RefinePowderDiffProfileSeq( FunctionOption = "Load", + InputProjectFilename = self.seqfile, + ProjectID = "IDx890") # Refine step 4 - api.RefinePowderDiffProfileSeq( - InputWorkspace = "VULCAN_22946_NOM", - SeqControlInfoWorkspace = "RecordIDx890Table", - startx = 7000., - EndX = 33000., - FunctionOption = "Refine", # or "Refine" - RefinementOption = "Random Walk", - ParametersToRefine = "Alph1", - NumRefineCycles = 200, - ProjectID = "IDx890") + api.RefinePowderDiffProfileSeq( InputWorkspace = "VULCAN_22946_NOM", + SeqControlInfoWorkspace = "RecordIDx890Table", + startx = 7000., + EndX = 33000., + FunctionOption = "Refine", # or "Refine" + RefinementOption = "Random Walk", + ParametersToRefine = "Alph1", + NumRefineCycles = 200, + ProjectID = "IDx890") def validateMethod(self): diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/TobyFitResolutionSimulationTest.py b/Code/Mantid/Testing/SystemTests/tests/analysis/TobyFitResolutionSimulationTest.py index 31b94f857cd1..0c24b3cc234d 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/TobyFitResolutionSimulationTest.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/TobyFitResolutionSimulationTest.py @@ -39,11 +39,6 @@ def runTest(self): uvec = [9.700000e-03,9.800000e-03,9.996000e-01] vvec = [9.992000e-01,-3.460000e-02,-4.580000e-02] - omega = 0.0 - alpha = 0.0 - beta = 0.0 - gamma = 0.0 - # sample dimensions sx = 0.05 # Perp sy = 0.025 # Up direction @@ -93,24 +88,25 @@ def runTest(self): # Create the MD workspace qscale = 'Q in A^-1' - fake_md = ConvertToMD(InputWorkspace=fake_data, QDimensions="Q3D", QConversionScales=qscale, - SplitInto=[3], SplitThreshold=100, - MinValues="-15,-15,-15,-30", MaxValues="25,25,25,279",OverwriteExisting=True) + fake_md = ConvertToMD( InputWorkspace=fake_data, QDimensions="Q3D", QConversionScales=qscale, + SplitInto=[3], SplitThreshold=100, + MinValues="-15,-15,-15,-30", MaxValues="25,25,25,279",OverwriteExisting=True) # Run the simulation. resol_model = "TobyFitResolutionModel" xsec_model = "Strontium122" - parameters = "Seff=0.7,J1a=38.7,J1b=-5.0,J2=27.3,SJc=10.0,GammaSlope=0.08,MultEps=0,TwinType=0,MCLoopMin=10,MCLoopMax=10,MCType=1" # Use sobol & restart each pixel to ensure reproducible result + # Use sobol & restart each pixel to ensure reproducible result + parameters = "Seff=0.7,J1a=38.7,J1b=-5.0,J2=27.3,SJc=10.0,GammaSlope=0.08,MultEps=0,TwinType=0,MCLoopMin=10,MCLoopMax=10,MCType=1" simulated = SimulateResolutionConvolvedModel(InputWorkspace=fake_md, ResolutionFunction=resol_model, ForegroundModel=xsec_model, Parameters=parameters) # Take a slice - slice_ws = BinMD(InputWorkspace=simulated, - AlignedDim0='[H,0,0], -12.000000, 9.000000, 100', - AlignedDim1='[0,K,0], -6.000000, 7.000000, 100', - AlignedDim2='[0,0,L], 0.000000, 6.000000, 1', - AlignedDim3='DeltaE, 100.000000, 150.000000, 1') + slice_ws = BinMD( InputWorkspace=simulated, + AlignedDim0='[H,0,0], -12.000000, 9.000000, 100', + AlignedDim1='[0,K,0], -6.000000, 7.000000, 100', + AlignedDim2='[0,0,L], 0.000000, 6.000000, 1', + AlignedDim3='DeltaE, 100.000000, 150.000000, 1') # Check ref_file = LoadMD(Filename='TobyFitResolutionSimulationTest.nxs') diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/ValidateFacilitiesFile.py b/Code/Mantid/Testing/SystemTests/tests/analysis/ValidateFacilitiesFile.py index 9307e98abdee..e382f19b3220 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/ValidateFacilitiesFile.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/ValidateFacilitiesFile.py @@ -1,9 +1,7 @@ #pylint: disable=no-init,invalid-name from mantid import config import os -import re import stresstesting -import glob EXPECTED_EXT = '.expected'