Exemple #1
0
"""
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")
Exemple #2
0
"""
Save TableScan from widget to file
@author: Kay Kasemir
"""
from tablescan_ui import saveTableFromWidget
from errors import showException

path = display.getWidget("TableFile").getValue()
try:
    saveTableFromWidget(display, path)
except:
    showException("Table Save Error")       
Exemple #3
0
    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")
"""
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")
@author: Kay Kasemir
"""
from errors import showException

try:
    from org.csstudio.opibuilder.scriptUtil import PVUtil
    from scan.table.table_scan import TableScan
    from tablescan_ui import getTableFromPath, displayTableInWidget

    # Try to load table from file
    path = PVUtil.getString(pvs[1])
    table_scan = None
    try:
        table_scan = getTableFromPath(path)
    except:
        table_scan = None
        pvs[1].setValue("")
    
    # Create default table if nothing loaded
    if not table_scan:
        table_scan = TableScan(
        [ "motor_x", TableScan.WAITFOR, TableScan.VALUE, TableScan.OR_TIME ],
        [
          [ "1",            TableScan.SECONDS, "00:05:00",      "" ],
        ])
        
    displayTableInWidget(display, table_scan)
except:
    showException("Sorry...")

Exemple #6
0
    #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")
Exemple #7
0
"""
Load TableScan from file into Table widget
@author: Kay Kasemir
"""
from errors import showException
from tablescan_ui import getTableFromPath, displayTableInWidget

try:
    path = display.getWidget("TableFile").getValue()
    table_scan = getTableFromPath(path)
    displayTableInWidget(display, table_scan)
except:
    showException("Sorry...")

Exemple #8
0
    #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")