Ticket #4680: TestScript.py

File TestScript.py, 1.1 KB (added by Owen Arnold, 9 years ago)
Line 
1from mantidsimple import *
2
3PIX=1.1E-3 #m
4RunNo=4699
5RIO=[69,80]
6DB=[26,31]
7Theta=0.49
8SC=175
9
10
11Load(Filename='POLREF00004699.raw',OutputWorkspace='X')
12X=mtd['X']
13ConvertUnits(InputWorkspace=X,OutputWorkspace=X,Target="Wavelength",AlignBins="1")
14CropWorkspace(InputWorkspace=X,OutputWorkspace='Io',XMin=0.8,XMax=14.5,StartWorkspaceIndex=2,EndWorkspaceIndex=2)
15CropWorkspace(InputWorkspace=X,OutputWorkspace='D',XMin=0.8,XMax=14.5,StartWorkspaceIndex=3)
16Io=mtd['Io']
17D=mtd['D']
18
19Divide(D,Io,'I','1','1')
20I=mtd['I']
21
22ConvertSpectrumAxis(InputWorkspace=I,OutputWorkspace='tl1',Target='signed_theta')
23
24inst=I[0].getInstrument()
25sampleLocation=inst.getComponentByName('some-surface-holder').getPos()
26detLocation=inst.getComponentByName('pointdetector').getPos()
27sample2detector=detLocation-sampleLocation    # meters
28
29
30# Move the detector so that the detector channel matching the reflected beam is at 0,0
31MoveInstrumentComponent(Workspace=I,ComponentName="lineardetector",X=0,Y=0,Z=-PIX*(SC))
32
33
34#CloneWorkspace(I,'I2')
35ConvertSpectrumAxis(InputWorkspace=I,OutputWorkspace='tl2',Target='signed_theta')