['', 2, 'Seconds', 1], ['', 3, 'Seconds', 1], [5, 1, 'Seconds', 1], ['', 2, 'Seconds', 1], ['', 3, 'Seconds', 1], ], pre=Set('motor_x', 1, completion=True), post=[ Set('motor_x', orig_motor_x, completion=True), Set('motor_y', orig_motor_y, completion=True), ], log_always=('neutrons', 'setpoint')) cmds = table.createScan() try: client = ScanClient('localhost', 4810) scid = client.submit(cmds, name="2D table scan example") client.waitUntilDone(scid) print "Number of log calls: %d" % client.lastSerial(scid) # get raw data back as a Python dict data = client.getData(scid) print data # Create table for motor_x, motor_y and neutrons table = createTable(data, 'motor_x', 'motor_y', 'neutrons', 'setpoint') print "Position X: ", table[0] print "Position Y: ", table[1] print "Counts : ", table[2] print "Setpoint : ", table[3] # Remove specific scan task
if __name__ == '__main__': orig_motor = 0 try: client = ScanClient('localhost', 4810) cmds = [Comment("Example"), Set('motor_x', 1, completion=True), Loop('motor_x', 1, 10, 1, [ Delay(1.0), Log("motor_x","neutrons") ], completion=True), Set('motor_x', orig_motor, completion=True) ] scid = client.submit(cmds, name="1D scan example") client.waitUntilDone(scid) data = client.getData(scid) # Create table for motor_x and neutrons table = createTable(data, 'motor_x', 'neutrons') print "Positions: ", table[0] print "Counts : ", table[1] # Remove specific scan task client.delete(scid) # or Remove information for all completed scans client.clear() except: raise
# use function to generate scan range table = TableScan(['Comment', 'motor_x', 'motor_y', 'Wait For', 'Value'], [['Example', '', '', '', ''], ['', 'range(1, 6, 1)', 'range(1, 4, 1)', 'Seconds', 1], ['', 1, 1, '', '']], pre=Set('motor_x', 1, completion=True), post=[Set('motor_x', orig_motor_x, completion=True), Set('motor_y', orig_motor_y, completion=True),], start=Set("neutrons", 0, completion=True, timeout=10), log_always=('neutrons', 'setpoint') ) cmds = table.createScan() try: client = ScanClient('localhost', 4810) scid = client.submit(cmds, name="2D table scan example") client.waitUntilDone(scid) print "Number of log calls: %d" % client.lastSerial(scid) # get raw data back as a Python dict data = client.getData(scid) print data # Create table for motor_x, motor_y and neutrons table = createTable(data, 'motor_x', 'motor_y', 'neutrons', 'setpoint') print "Position X: ", table[0] print "Position Y: ", table[1] print "Counts : ", table[2] print "Setpoint : ", table[3] # Remove specific scan task
orig_motor_y = 0 cmds = ndim(Comment("Example"), Set('motor_x', 1), ('motor_x', 1, 5, 1), ('motor_y', 1, 3, 1), ('loc://i(0)', 1, 2, 1), Set('neutrons', 0, completion=True, readback=False), Delay(1), 'neutrons', 'setpoint') for cmd in cmds: print cmd exit() try: client = ScanClient('localhost', 4810) scid = client.submit(cmds, name="2D ndim scan example") client.waitUntilDone(scid) print "Number of log calls: %d" % client.lastSerial(scid) # get raw data back as a Python dict data = client.getData(scid) print data # Create table for motor_x, motor_y and neutrons table = createTable(data, 'motor_x', 'motor_y', 'neutrons', 'setpoint') print "Position X: ", table[0] print "Position Y: ", table[1] print "Counts : ", table[2] print "Setpoint : ", table[3] # Remove specific scan task
from scan.client.scanclient import ScanClient from scan.commands.delay import Delay client = ScanClient() cmds = [Delay(1.0)] client.submit(cmds, "Test")
if __name__ == '__main__': orig_motor = 0 try: client = ScanClient('localhost', 4810) cmds = [ Comment("Example"), Set('motor_x', 1, completion=True), Loop('motor_x', 1, 10, 1, [Delay(1.0), Log("motor_x", "neutrons")], completion=True), Set('motor_x', orig_motor, completion=True) ] scid = client.submit(cmds, name="1D scan example") client.waitUntilDone(scid) data = client.getData(scid) # Create table for motor_x and neutrons table = createTable(data, 'motor_x', 'neutrons') print "Positions: ", table[0] print "Counts : ", table[1] # Remove specific scan task client.delete(scid) # or Remove information for all completed scans client.clear() except: raise
from scan.client.logdata import createTable if __name__ == '__main__': orig_motor_x = 0 orig_motor_y = 0 cmds = ndim(Comment("Example"), Set('motor_x', 1), ('motor_x', 1, 5, 1), ('motor_y', 1, 3, 1), ('loc://i(0)', 1, 2, 1), Set('neutrons', 0, completion=True, readback=False), Delay(1), 'neutrons', 'setpoint') for cmd in cmds: print cmd exit() try: client = ScanClient('localhost', 4810) scid = client.submit(cmds, name="2D ndim scan example") client.waitUntilDone(scid) print "Number of log calls: %d" % client.lastSerial(scid) # get raw data back as a Python dict data = client.getData(scid) print data # Create table for motor_x, motor_y and neutrons table = createTable(data, 'motor_x', 'motor_y', 'neutrons', 'setpoint') print "Position X: ", table[0] print "Position Y: ", table[1] print "Counts : ", table[2] print "Setpoint : ", table[3] # Remove specific scan task