Ticket #5016: 6017Reduction.py

File 6017Reduction.py, 2.1 KB (added by Owen Arnold, 8 years ago)
Line 
1from mantidsimple import *
2
3######################################################################
4Load(Filename=r'POLREF00006017.nxs',OutputWorkspace='POLREF00006017')
5
6PIX=1.1E-3 #
7SC=96 #Reflected line
8avgDB=27 #Transmission
9
10X=mtd['POLREF00006017']
11ConvertUnits(InputWorkspace=X,OutputWorkspace=X,Target="Wavelength",AlignBins="1")
12CropWorkspace(InputWorkspace=X,OutputWorkspace='Io',XMin=1,XMax=14.5,StartWorkspaceIndex=2,EndWorkspaceIndex=2) #Monitor
13CropWorkspace(InputWorkspace=X,OutputWorkspace='D',XMin=1,XMax=14.5,StartWorkspaceIndex=3) #Start detectors
14Io=mtd['Io']
15D=mtd['D']
16
17Divide(D,Io,'I','1','1')
18I=mtd['I']
19
20# Move the detector so that the detector channel matching the reflected beam is at 0,0
21MoveInstrumentComponent(Workspace=I,ComponentName="lineardetector",X=0,Y=0,Z=-PIX*( (SC-avgDB)/2.0 +avgDB) )
22
23#CloneWorkspace(I,'I2')
24ConvertSpectrumAxis(InputWorkspace=I,OutputWorkspace='SignedTheta_vs_Wavelength',Target='signed_theta')
25
26#  Run MD Conversions
27ConvertToReflectometryQ(InputWorkspace='SignedTheta_vs_Wavelength',OutputWorkspace='QxQy',OutputDimensions='Q (lab frame)', Extents='-0.0005,0.0005,0,0.12')
28ConvertToReflectometryQ(InputWorkspace='SignedTheta_vs_Wavelength',OutputWorkspace='KiKf',OutputDimensions='K (incident, final)', Extents='0,0.05,0,0.05')
29ConvertToReflectometryQ(InputWorkspace='SignedTheta_vs_Wavelength',OutputWorkspace='PiPf',OutputDimensions='P (lab frame)', Extents='0,0.1,-0.02,0.15')
30
31# Bin Outputs to MD Histogam Workspaces
32BinMD(InputWorkspace='QxQy',AxisAligned='0',BasisVector0='Qx,(Ang^-1),1,0',BasisVector1='Qz,(Ang^-1),0,1',OutputExtents='-0.0005,0.0005,0,0.12',OutputBins='100,100',Parallel='1',OutputWorkspace='QxQy_rebinned')
33BinMD(InputWorkspace='KiKf',AxisAligned='0',BasisVector0='Ki,(Ang^-1),1,0',BasisVector1='Kf,(Ang^-1),0,1',OutputExtents='0,0.05,0,0.05',OutputBins='200,200',Parallel='1',OutputWorkspace='KiKf__rebinned')
34BinMD(InputWorkspace='PiPf',AxisAligned='0',BasisVector0='Pz_i + Pz_f,(Ang^-1),1,0',BasisVector1='Pz_i - Pz_f,(Ang^-1),0,1',OutputExtents='0,0.1,-0.02,0.15',OutputBins='50,50',Parallel='1',OutputWorkspace='PiPf_rebinned')