Ticket #8656: benchmark.py

File benchmark.py, 1.7 KB (added by Owen Arnold, 7 years ago)
Line 
1"""
2These system tests are to verify the behaviour of the ISIS reflectometry reduction scripts
3"""
4
5from mantid.simpleapi import *
6
7
8
9class ReflectometryISIS(object):
10
11    def get_workspace_name(self):
12            return "POLREF4699"
13     
14    def runTest(self):
15       
16        workspace_name = self.get_workspace_name()
17        workspace_nexus_file = workspace_name + ".nxs"
18       
19        PIX=1.1E-3 #m
20        SC=75
21        avgDB=29
22        Load(Filename=workspace_nexus_file,OutputWorkspace=workspace_name)
23        X=mtd[workspace_name]
24        X = ConvertUnits(InputWorkspace=X,Target="Wavelength",AlignBins="1")
25        # Reference intensity to normalise by
26        CropWorkspace(InputWorkspace=X,OutputWorkspace='Io',XMin=0.8,XMax=14.5,StartWorkspaceIndex=2,EndWorkspaceIndex=2)
27        # Crop out transmission and noisy data
28        CropWorkspace(InputWorkspace=X,OutputWorkspace='D',XMin=0.8,XMax=14.5,StartWorkspaceIndex=3)
29        Io=mtd['Io']
30        D=mtd['D']
31   
32        # Peform the normaisation step
33        I = D/Io
34       
35        # Move the detector so that the detector channel matching the reflected beam is at 0,0
36        MoveInstrumentComponent(Workspace=I,ComponentName="lineardetector",X=0,Y=0,Z=-PIX*( (SC-avgDB)/2.0 +avgDB) )
37       
38        # Should now have signed theta vs Lambda
39        ConvertSpectrumAxis(InputWorkspace=I,OutputWorkspace='SignedTheta_vs_Wavelength',Target='signed_theta')
40       
41        # MD transformations
42        ConvertToReflectometryQ(InputWorkspace='SignedTheta_vs_Wavelength',OutputWorkspace='QxQy',OutputDimensions='Q (lab frame)', Extents='-0.0005,0.0005,0,0.12')
43       
44        plotSlice('QxQy',colorscalelog=True, colormax=1e9, colormin=1e1)
45       
46test = ReflectometryISIS()
47test.runTest()