Skip to content

Commit

Permalink
Refs #8590. Changed the way the check happens
Browse files Browse the repository at this point in the history
The LoadInstrumentData script has been repurposed as load_live_data and doen't do a zero check when you ask for live data.
  • Loading branch information
keithnbrown committed Jan 10, 2014
1 parent f05ee9e commit afd9570
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 36 deletions.
35 changes: 19 additions & 16 deletions Code/Mantid/scripts/Interface/ui/reflectometer/refl_gui.py
Expand Up @@ -7,7 +7,7 @@
from mantid.simpleapi import *
from isis_reflectometry.quick import *
from isis_reflectometry.combineMulti import *
from isis_reflectometry.LoadInstrumentRuns import *
import isis_reflectometry.load_live_runs
from isis_reflgui.latest_isis_runs import *
from mantid.api import Workspace, WorkspaceGroup

Expand Down Expand Up @@ -241,15 +241,14 @@ def process(self):
overlapHigh.append(float(ovHigh))
print len(runno), "runs: ", runno
# Determine resolution
# if (runno[0] != ''):
for run in runno:
if self.zeroCheck(run):
StartLiveData(Instrument=config['default.instrument'],UpdateEvery='0',Outputworkspace='_LiveOut')
loadedRuns.append(mtd['_LiveOut'])
else:
loadedRuns.append(Load(Filename=run, outputWorkspace=run))
if (self.tableMain.item(row, 15).text() == ''):
dqq = calcRes(loadedRuns[0])
loadedRun = None
if load_live_runs.is_live_run(runno[0]):
loadedRun = load_live_runs.get_live_data(config['default.instrument'])
else:
Load(Filename=run, outputWorkspace="run")
loadedRun = mtd["run"]
dqq = calcRes(loadedRun)
item = QtGui.QTableWidgetItem()
item.setText(str(dqq))
self.tableMain.setItem(row, 15, item)
Expand Down Expand Up @@ -347,16 +346,19 @@ def dorun(self, runno, row, which):
g = ['g1', 'g2', 'g3']
transrun = str(self.tableMain.item(row, which * 5 + 2).text())
angle = str(self.tableMain.item(row, which * 5 + 1).text())
names = mtd.getObjectNames()
if self.zeroCheck(runno):
StartLiveData(Instrument=config['default.instrument'],UpdateEvery='0',Outputworkspace='_LiveOut')
runno = '_LiveOut'
[wlam, wq, th] = quick(runno, trans=transrun, theta=angle)
#names = mtd.getObjectNames()
#if self.zeroCheck(runno):
# StartLiveData(Instrument=config['default.instrument'],UpdateEvery='0',Outputworkspace='_LiveOut')
# runno = '_LiveOut'
#[wlam, wq, th] = quick(runno, trans=transrun, theta=angle)
loadedRun = runno
if load_live_runs.is_live_run(runno):
loadedRun = load_live_runs.get_live_data(config['default.instrument'])
[wlam, wq, th] = quick(loadedRun, trans=transrun, theta=angle)
if ':' in runno:
runno = runno.split(':')[0]
if ',' in runno:
runno = runno.split(',')[0]

ws_name = str(runno) + '_IvsQ'
inst = groupGet(ws_name, 'inst')
lmin = inst.getNumberParameter('LambdaMin')[0] + 1
Expand Down Expand Up @@ -481,7 +483,8 @@ def showHelp(self):
import webbrowser
webbrowser.open('http://www.mantidproject.org/ISIS_Reflectometry_GUI')

def calcRes(run, runno = ''):
def calcRes(run):
runno = None
if not type(run) == type(Workspace):
runno = '_' + str(run) + 'temp'
if type(run) == type(int()):
Expand Down

This file was deleted.

@@ -0,0 +1,11 @@
from mantid.simpleapi import *
def get_live_data(InstrumentName, Accumulation = "Add", OutputName = "live"):
StartLiveData(Instrument=str(InstrumentName), Outputworkspace=str(OutputName), AccumulationMethod = Accumulation)
ws = mtd[OutputName]
return ws
def is_live_run(run):
try:
return (int(run) is 0)
except:
return False

0 comments on commit afd9570

Please sign in to comment.