""" Submit TableScan from Table widget to scan server @author: Kay Kasemir """ from errors import showException from tablescan_ui import getTableFromWidget from beamline_setup import scan_client try: table_scan = getTableFromWidget(display) name = display.getWidget("TableFile").getValue().strip() if name: table_scan.name = name if table_scan: commands = table_scan.createScan() id = scan_client.submit(commands, name=name) except: showException("Table Scan")
start = float(display.getWidget("start1").getValue()) end = float(display.getWidget("end1").getValue()) step = float(display.getWidget("step1").getValue()) condition_device = str( display.getWidget("cond_device_1").getValue()).strip() condition_value = float(display.getWidget("cond_value").getValue()) log = str(display.getWidget("log_device_1").getValue()).strip() method = str(display.getWidget("method").getValue()).strip() normalize = bool(display.getWidget("normalize").getValue()) if method == "Gauss": find_command = "FindPeak" name = "Gauss Scan of %s over %s" % (log, device) else: find_command = None name = "Range Scan of %s over %s" % (log, device) align = AlignmentScan(device, start, end, step, condition_device, condition_value, log, start=[Set('pcharge', 0)], find_command=find_command, normalize=normalize) scan_client.submit(align.createScan(), name=name) except: showException("Alignment Scan")
#from org.eclipse.jface.dialogs import MessageDialog #MessageDialog.openWarning( # None, "Type", "Type is " + neutrons.__class__.__name__) # Create scan cmds =[ Loop('xpos', min(x0, x1), max(x0, x1), max(0.1, abs(dx)), Loop('ypos', min(y0, y1), max(y0, y1), toggle * max(0.1, abs(dy)), [ Wait('neutrons', neutrons, comparison='increase by'), Log('xpos', 'ypos', 'readback') ] ) ) ] if simu: simulation = scan_client.simulate(cmds) SimulationDisplay.show(SimulationResult(simulation['seconds'], simulation['simulation'])) else: # Submit scan id = scan_client.submit(cmds, "XY Scan") workbench = PlatformUI.getWorkbench() window = workbench.getActiveWorkbenchWindow() page = window.getActivePage() plot = page.showView("org.csstudio.scan.ui.plot.view") plot.selectScan("XY Scan", id) plot.selectDevices("xpos", "ypos") except: showException("XY Scan")
#from org.eclipse.jface.dialogs import MessageDialog #MessageDialog.openWarning( # None, "Type", "Type is " + neutrons.__class__.__name__) # Create scan cmds = [ Loop( 'xpos', min(x0, x1), max(x0, x1), max(0.1, abs(dx)), Loop('ypos', min(y0, y1), max(y0, y1), toggle * max(0.1, abs(dy)), [ Wait('neutrons', neutrons, comparison='increase by'), Log('xpos', 'ypos', 'readback') ])) ] if simu: simulation = scan_client.simulate(cmds) SimulationDisplay.show( SimulationResult(simulation['seconds'], simulation['simulation'])) else: # Submit scan id = scan_client.submit(cmds, "XY Scan") workbench = PlatformUI.getWorkbench() window = workbench.getActiveWorkbenchWindow() page = window.getActivePage() plot = page.showView("org.csstudio.scan.ui.plot.view") plot.selectScan("XY Scan", id) plot.selectDevices("xpos", "ypos") except: showException("XY Scan")
from beamline_setup import scan_client from scan.commands.set import Set from scan.alignment import AlignmentScan from errors import showException try: device = str(display.getWidget("device1_1").getValue()).strip() start = float(display.getWidget("start1").getValue()) end = float(display.getWidget("end1").getValue()) step = float(display.getWidget("step1").getValue()) condition_device = str(display.getWidget("cond_device_1").getValue()).strip() condition_value = float(display.getWidget("cond_value").getValue()) log = str(display.getWidget("log_device_1").getValue()).strip() method = str(display.getWidget("method").getValue()).strip() normalize = bool(display.getWidget("normalize").getValue()) if method=="Gauss": find_command = "FindPeak" name = "Gauss Scan of %s over %s" % (log, device) else: find_command = None name = "Range Scan of %s over %s" % (log, device) align = AlignmentScan(device, start, end, step, condition_device, condition_value, log, start=[ Set('pcharge', 0) ], find_command=find_command, normalize=normalize) scan_client.submit(align.createScan(), name=name) except: showException("Alignment Scan")