FioAdditions, example from P10

In order to reduce the overhead time during scans, P10 uses the FioAdditions feature to write only selected motors to the .fio files. Here is a code template, authors: Michael Sprung, Teresa Nunez:

#!/usr/bin/env python
# this script returns output to be filled into the header of a .fio file. 
# allowed combinations: list, dict, [list], [dict], [list, dict], [dict, list]
import PyTango

def get_motpos( mot):
    """Get the current position of a motor using the sardananame"""

    position = -1000000000 # --- Define a dummy default position
        pool_proxy = PyTango.DeviceProxy(mot)
        position    = pool_proxy.Position

    return position

def main():

    motlist = [ 'd1_mot01', 'd1_mot02', 'd1_mot03', 'd1_mot04']
    dct = dict(zip(motlist,map(get_motpos, motlist)))
    for motor, value in dct.items():
        if value == -1000000000:
            del dct[motor]        

    lst = []

    return [ dct, lst]

if __name__ == '__main__':