Table of Contents
from threading import Thread
import time
import sys
import PyQt4
import mantid.simpleapi as simpleapi
import mantidqtpython as mpy
ConfigService = simpleapi.ConfigService
def startFakeEventDAE():
# This will generate 2000 events roughly every 20ms, so about 50,000 events/sec
# They will be randomly shared across the 100 spectra
# and have a time of flight between 10,000 and 20,000
try:
simpleapi.FakeISISEventDAE(NPeriods=1,NSpectra=100,Rate=20,NEvents=1000)
except RuntimeError:
pass
def captureLive():
ConfigService.setFacility("TEST_LIVE")
# start a Live data listener updating every second, that rebins the data
# and replaces the results each time with those of the last second.
simpleapi.StartLiveData(Instrument='ISIS_Event', OutputWorkspace='wsOut', UpdateEvery=0.5,
ProcessingAlgorithm='Rebin', ProcessingProperties='Params=10000,1000,20000;PreserveEvents=1',
AccumulationMethod='Add', PreserveEvents=True)
#--------------------------------------------------------------------------------------------------
InstrumentWidget = mpy.MantidQt.MantidWidgets.InstrumentWidget
app = PyQt4.QtGui.QApplication(sys.argv)
eventThread = Thread(target = startFakeEventDAE)
eventThread.start()
while not eventThread.is_alive():
time.sleep(2) # give it a small amount of time to get ready
facility = ConfigService.getFacility()
try:
captureLive()
iw = InstrumentWidget("wsOut")
iw.show()
app.exec_()
finally:
# put back the facility
ConfigService.setFacility(facility)
Full list of GUI and Documentation changes on GitHub