Friday, 7 October 2016

PyTango: Setting Attribute Config from a DeviceProxy

Setting Attribute Config



for dev in ['a/dev/name',]:

    dp = PyTango.DeviceProxy(dev)

    #Check if contains the attribute pressure
    attrs = dp.get_attribute_list()
    if 'pressure' not in [a.lower() for a in attrs]: continue

    #Override attribute configuration
    conf = dp.get_attribute_config('pressure')
    conf.format = "%1.1e" 
    conf.unit = "mbar" 
    conf.label = "%s-Pressure"%dev
    print 'setting config for %s/%s' % (dev,conf.name)
    dp.set_attribute_config(conf)

No comments:

Post a Comment