Skip to content
Snippets Groups Projects
Commit 28a7a185 authored by Savici, Andrei T.'s avatar Savici, Andrei T.
Browse files

A few more. Refs #11293

parent a38ba81a
No related merge requests found
Showing
with 120 additions and 148 deletions
......@@ -25,9 +25,9 @@ class SortDetectors(PythonAlgorithm):
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))
......
......@@ -31,8 +31,7 @@ class ARCSReductionTest(stresstesting.MantidStressTest):
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 @@ class ARCSReductionTest(stresstesting.MantidStressTest):
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",
......
......@@ -39,8 +39,7 @@ class CNCSReductionTest(stresstesting.MantidStressTest):
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,
......
......@@ -12,6 +12,7 @@ class ISISLoadingEventData(stresstesting.MantidStressTest):
# 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
#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):
......
......@@ -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"
......
......@@ -12,10 +12,6 @@ import stresstesting
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 @@ class VulcanExamineProfile(stresstesting.MantidStressTest):
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 @@ class VulcanSeqRefineProfileFromScratch(stresstesting.MantidStressTest):
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 @@ class VulcanSeqRefineProfileFromScratch(stresstesting.MantidStressTest):
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 @@ class VulcanSeqRefineProfileLoadPlus(stresstesting.MantidStressTest):
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):
......
......@@ -39,11 +39,6 @@ class TobyFitResolutionSimulationTest(MantidStressTest):
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 @@ class TobyFitResolutionSimulationTest(MantidStressTest):
# 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')
......
#pylint: disable=no-init,invalid-name
from mantid import config
import os
import re
import stresstesting
import glob
EXPECTED_EXT = '.expected'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment