Example #1
0
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
Example #2
0
                      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
        client.delete(scid)
        # or Remove information for all completed scans
        client.clear()
    except:
        raise