Skip to content

Commit

Permalink
A few more. Refs #11293
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreiSavici committed Mar 9, 2015
1 parent a38ba81 commit 28a7a18
Show file tree
Hide file tree
Showing 9 changed files with 120 additions and 148 deletions.
Expand Up @@ -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))
Expand Down
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
Expand Up @@ -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,
Expand Down
Expand Up @@ -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
@@ -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):

Expand Down
Expand Up @@ -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"
Expand Down
Expand Up @@ -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'
Expand All @@ -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
Expand All @@ -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"]
Expand All @@ -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

Expand All @@ -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):
Expand Down

0 comments on commit 28a7a18

Please sign in to comment.