1 | """ |
---|
2 | These system tests are to verify the behaviour of the ISIS reflectometry reduction scripts |
---|
3 | """ |
---|
4 | |
---|
5 | from mantid.simpleapi import * |
---|
6 | |
---|
7 | |
---|
8 | |
---|
9 | class 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 | |
---|
21 | Load(Filename=workspace_nexus_file,OutputWorkspace=workspace_name) |
---|
22 | X=mtd[workspace_name] |
---|
23 | |
---|
24 | # Run once to get a lambda workspace for alignment-calibration |
---|
25 | results = ReflectometryReductionOneAuto(InputWorkspace=X, ThetaIn=0.4903, I0MonitorIndex=2, AnalysisMode='MultiDetectorAnalysis',CorrectDetectorPositions=False, |
---|
26 | ProcessingInstructions='3:245', OutputWorkspaceWavelength='reduced_lam', WavelengthMin=0.8, WavelengthMax=14.5, |
---|
27 | MonitorBackgroundWavelengthMin=13, MonitorBackgroundWavelengthMax=14.5, MonitorIntegrationWavelengthMin=4, MonitorIntegrationWavelengthMax=10 |
---|
28 | ) |
---|
29 | |
---|
30 | |
---|
31 | reduced_lam_for_calibration = mtd['reduced_lam'][0] |
---|
32 | |
---|
33 | # Automatically determine the spectrum of interest. |
---|
34 | FindReflectometryLines(InputWorkspace=reduced_lam_for_calibration, StartWavelength=10, OutputWorkspace='spectrum_numbers') |
---|
35 | spectrum_table = mtd['spectrum_numbers'] |
---|
36 | SC = spectrum_table.cell(0, 0) |
---|
37 | avgDB = spectrum_table.cell(0, 1) |
---|
38 | |
---|
39 | |
---|
40 | # Move the detector so that the detector channel matching the reflected beam is at 0,0 |
---|
41 | MoveInstrumentComponent(Workspace=X,ComponentName="lineardetector",X=0,Y=0,Z=-PIX*( (SC-avgDB)/2.0 +avgDB) ) |
---|
42 | |
---|
43 | # Now re-do the reduction with the components in the correct positions. |
---|
44 | results = ReflectometryReductionOneAuto(InputWorkspace=X, ThetaIn=0.4903, I0MonitorIndex=2, AnalysisMode='MultiDetectorAnalysis',CorrectDetectorPositions=False, |
---|
45 | ProcessingInstructions='3:245', OutputWorkspaceWavelength='reduced_lam', WavelengthMin=0.8, WavelengthMax=14.5, |
---|
46 | MonitorBackgroundWavelengthMin=13, MonitorBackgroundWavelengthMax=14.5, MonitorIntegrationWavelengthMin=4, MonitorIntegrationWavelengthMax=10 |
---|
47 | ) |
---|
48 | |
---|
49 | |
---|
50 | # Should now have signed theta vs Lambda |
---|
51 | reduced_lam = mtd['reduced_lam'] |
---|
52 | reduced_lam_signed_theta =ConvertSpectrumAxis(InputWorkspace=reduced_lam,Target='signed_theta') |
---|
53 | |
---|
54 | # MD transformations |
---|
55 | ConvertToReflectometryQ(InputWorkspace=reduced_lam_signed_theta,OutputWorkspace='QxQy',OutputDimensions='Q (lab frame)', Extents='-0.0005,0.0005,0,0.12') |
---|
56 | |
---|
57 | plotSlice('QxQy',colorscalelog=True, colormax=1e9, colormin=1e1) |
---|
58 | |
---|
59 | test = ReflectometryISIS() |
---|
60 | test.runTest() |
---|