1 | from mantidsimple import * |
---|
2 | |
---|
3 | ###################################################################### |
---|
4 | Load(Filename=r'POLREF00006017.nxs',OutputWorkspace='POLREF00006017') |
---|
5 | |
---|
6 | PIX=1.1E-3 # |
---|
7 | SC=96 #Reflected line |
---|
8 | avgDB=27 #Transmission |
---|
9 | |
---|
10 | X=mtd['POLREF00006017'] |
---|
11 | ConvertUnits(InputWorkspace=X,OutputWorkspace=X,Target="Wavelength",AlignBins="1") |
---|
12 | CropWorkspace(InputWorkspace=X,OutputWorkspace='Io',XMin=1,XMax=14.5,StartWorkspaceIndex=2,EndWorkspaceIndex=2) #Monitor |
---|
13 | CropWorkspace(InputWorkspace=X,OutputWorkspace='D',XMin=1,XMax=14.5,StartWorkspaceIndex=3) #Start detectors |
---|
14 | Io=mtd['Io'] |
---|
15 | D=mtd['D'] |
---|
16 | |
---|
17 | Divide(D,Io,'I','1','1') |
---|
18 | I=mtd['I'] |
---|
19 | |
---|
20 | # Move the detector so that the detector channel matching the reflected beam is at 0,0 |
---|
21 | MoveInstrumentComponent(Workspace=I,ComponentName="lineardetector",X=0,Y=0,Z=-PIX*( (SC-avgDB)/2.0 +avgDB) ) |
---|
22 | |
---|
23 | #CloneWorkspace(I,'I2') |
---|
24 | ConvertSpectrumAxis(InputWorkspace=I,OutputWorkspace='SignedTheta_vs_Wavelength',Target='signed_theta') |
---|
25 | |
---|
26 | # Run MD Conversions |
---|
27 | ConvertToReflectometryQ(InputWorkspace='SignedTheta_vs_Wavelength',OutputWorkspace='QxQy',OutputDimensions='Q (lab frame)', Extents='-0.0005,0.0005,0,0.12') |
---|
28 | ConvertToReflectometryQ(InputWorkspace='SignedTheta_vs_Wavelength',OutputWorkspace='KiKf',OutputDimensions='K (incident, final)', Extents='0,0.05,0,0.05') |
---|
29 | ConvertToReflectometryQ(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 |
---|
32 | BinMD(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') |
---|
33 | BinMD(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') |
---|
34 | BinMD(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') |
---|