Newer
Older
#pylint: disable=no-init,invalid-name,attribute-defined-outside-init
import stresstesting
from mantid.simpleapi import *
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
class CompressEventsTesting(stresstesting.MantidStressTest):
event_files = ["PG3_4844_event.nxs"] # /SNS/PG3/IPTS-2767/0/ for 2.5 hours
def requiredFiles(self):
return self.event_files
def runTest(self):
for filename in self.event_files:
wkspname = filename.split('.')[0]
outname = wkspname + '_out'
LoadEventNexus(Filename=filename, OutputWorkspace=wkspname, LoadMonitors=False)
totalEvents = mtd[wkspname].getNumberEvents()
SumSpectra(InputWorkspace=wkspname, OutputWorkspace=wkspname)
# max for Integration algorithm is not inclusive
for name in (outname, wkspname): # first out of place, then in place
CompressEvents(InputWorkspace=wkspname, OutputWorkspace=name,
WallClockTolerance=10.)
integral = Integration(InputWorkspace=name, RangeUpper=20000.)
compress10s = integral.readY(0)[0]
CompressEvents(InputWorkspace=wkspname, OutputWorkspace=name,
WallClockTolerance=3600.)
integral = Integration(InputWorkspace=name, RangeUpper=20000.)
compress1h = integral.readY(0)[0]
CompressEvents(InputWorkspace=wkspname, OutputWorkspace=name)
integral = Integration(InputWorkspace=name, RangeUpper=20000.)
compressfull = integral.readY(0)[0]
if not (totalEvents == compress10s == compress1h == compressfull):
# TODO use new style formatting
msg = '%s - total=%f 10s=%f 1h=%f full=%f' % (name, totalEvents, compress10s, compress1h, compressfull)
raise RuntimeError(msg)