-
Notifications
You must be signed in to change notification settings - Fork 122
/
LiquidsReflectometryReductionWithBackgroundTest.py
173 lines (156 loc) · 9.26 KB
/
LiquidsReflectometryReductionWithBackgroundTest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
#pylint: disable=no-init
import stresstesting
from mantid import *
from mantid.simpleapi import *
class LiquidsReflectometryReductionWithBackgroundTest(stresstesting.MantidStressTest):
"""
This test checks that the new liquids reflectometer reduction produces
the same results as the old code. It's more tolerant than the test below.
"""
def runTest(self):
#TODO: The reduction algorithm should not require an absolute path
scaling_factor_file = FileFinder.getFullPath("directBeamDatabaseFall2014_IPTS_11601_2.cfg")
LiquidsReflectometryReduction(RunNumbers=[119816],
NormalizationRunNumber=119692,
SignalPeakPixelRange=[155, 165],
SubtractSignalBackground=True,
SignalBackgroundPixelRange=[146, 165],
NormFlag=True,
NormPeakPixelRange=[154, 162],
NormBackgroundPixelRange=[151, 165],
SubtractNormBackground=True,
LowResDataAxisPixelRangeFlag=True,
LowResDataAxisPixelRange=[99, 158],
LowResNormAxisPixelRangeFlag=True,
LowResNormAxisPixelRange=[118, 137],
TOFRange=[9610, 22425],
IncidentMediumSelected='2InDiamSi',
GeometryCorrectionFlag=False,
QMin=0.005,
QStep=0.01,
AngleOffset=0.009,
AngleOffsetError=0.001,
ScalingFactorFile=scaling_factor_file,
SlitsWidthFlag=True,
CropFirstAndLastPoints=False,
OutputWorkspace='reflectivity_119816')
def validate(self):
# Be more tolerant with the output.
self.tolerance = 0.0002
# Skip the first point so we don't have to have a big tolerance
data_y = mtd["reflectivity_119816"].dataY(0)
data_y[1] = 0.00499601750282373
self.disableChecking.append('Instrument')
self.disableChecking.append('Sample')
self.disableChecking.append('SpectraMap')
self.disableChecking.append('Axes')
return "reflectivity_119816", 'REFL_119816.nxs'
class LiquidsReflectometryReductionWithBackgroundPreciseTest(stresstesting.MantidStressTest):
"""
This test checks that the new liquids reflectometer reduction code
always produces the same results.
"""
def runTest(self):
#TODO: The reduction algorithm should not require an absolute path
scaling_factor_file = FileFinder.getFullPath("directBeamDatabaseFall2014_IPTS_11601_2.cfg")
LiquidsReflectometryReduction(RunNumbers=[119816],
NormalizationRunNumber=119692,
SignalPeakPixelRange=[155, 165],
SubtractSignalBackground=True,
SignalBackgroundPixelRange=[146, 165],
NormFlag=True,
NormPeakPixelRange=[154, 162],
NormBackgroundPixelRange=[151, 165],
SubtractNormBackground=True,
LowResDataAxisPixelRangeFlag=True,
LowResDataAxisPixelRange=[99, 158],
LowResNormAxisPixelRangeFlag=True,
LowResNormAxisPixelRange=[118, 137],
TOFRange=[9610, 22425],
IncidentMediumSelected='2InDiamSi',
GeometryCorrectionFlag=False,
QMin=0.005,
QStep=0.01,
AngleOffset=0.009,
AngleOffsetError=0.001,
ScalingFactorFile=scaling_factor_file,
SlitsWidthFlag=True,
CropFirstAndLastPoints=False,
OutputWorkspace='reflectivity_precise_119816')
def validate(self):
self.disableChecking.append('Instrument')
self.disableChecking.append('Sample')
self.disableChecking.append('SpectraMap')
self.disableChecking.append('Axes')
return "reflectivity_precise_119816", 'LiquidsReflectometryReductionTestWithBackground.nxs'
class NoNormalizationTest(stresstesting.MantidStressTest):
def runTest(self):
#TODO: The reduction algorithm should not require an absolute path
scaling_factor_file = FileFinder.getFullPath("directBeamDatabaseFall2014_IPTS_11601_2.cfg")
LiquidsReflectometryReduction(RunNumbers=[119816],
NormalizationRunNumber=119692,
SignalPeakPixelRange=[155, 165],
SubtractSignalBackground=True,
SignalBackgroundPixelRange=[146, 165],
NormFlag=False,
NormPeakPixelRange=[154, 162],
NormBackgroundPixelRange=[151, 165],
SubtractNormBackground=True,
LowResDataAxisPixelRangeFlag=True,
LowResDataAxisPixelRange=[99, 158],
LowResNormAxisPixelRangeFlag=True,
LowResNormAxisPixelRange=[118, 137],
TOFRange=[9610, 22425],
IncidentMediumSelected='2InDiamSi',
GeometryCorrectionFlag=False,
QMin=0.005,
QStep=0.01,
AngleOffset=0.009,
AngleOffsetError=0.001,
ScalingFactorFile=scaling_factor_file,
SlitsWidthFlag=True,
CropFirstAndLastPoints=False,
OutputWorkspace='reflectivity_119816')
def validate(self):
self.disableChecking.append('Instrument')
self.disableChecking.append('Sample')
self.disableChecking.append('SpectraMap')
self.disableChecking.append('Axes')
return "reflectivity_119816", 'REFL_NoNormalizationTest.nxs'
class TOFRangeOFFTest(stresstesting.MantidStressTest):
def runTest(self):
#TODO: The reduction algorithm should not require an absolute path
scaling_factor_file = FileFinder.getFullPath("directBeamDatabaseFall2014_IPTS_11601_2.cfg")
LiquidsReflectometryReduction(RunNumbers=[119816],
NormalizationRunNumber=119692,
SignalPeakPixelRange=[155, 165],
SubtractSignalBackground=True,
SignalBackgroundPixelRange=[146, 165],
NormFlag=True,
NormPeakPixelRange=[154, 162],
NormBackgroundPixelRange=[151, 165],
SubtractNormBackground=True,
LowResDataAxisPixelRangeFlag=True,
LowResDataAxisPixelRange=[99, 158],
LowResNormAxisPixelRangeFlag=True,
LowResNormAxisPixelRange=[118, 137],
TOFRange=[9610, 22425],
TofRangeFlag=False,
IncidentMediumSelected='2InDiamSi',
GeometryCorrectionFlag=False,
QMin=0.005,
QStep=0.01,
AngleOffset=0.009,
AngleOffsetError=0.001,
ScalingFactorFile=scaling_factor_file,
SlitsWidthFlag=True,
CropFirstAndLastPoints=False,
OutputWorkspace='reflectivity_119816')
def validate(self):
self.disableChecking.append('Instrument')
self.disableChecking.append('Sample')
self.disableChecking.append('SpectraMap')
self.disableChecking.append('Axes')
return "reflectivity_119816", ' TOFRangeOFFTest.nxs'
#TESTS to do:
# - TOF mismatch btw data and norm