# Module OpUtils # Usefull function for operation ############################################################################### # FUNCTIONS ON DEVICE PROXY ############################################################################### def searchattr(prx, attr, ignorecase=True): """ Search in a tango device proxy for an attribute name. PARAMETERS ---------- prx: tango.DeviceProxy Proxy to the device. attr: string String to search for. ignorecase: bool Case insensitive. """ if ignorecase: return [a for a in prx.get_attribute_list() if attr.lower() in a.lower()] else: return [a for a in prx.get_attribute_list() if attr in a] def captureattr(prx): """ Capture all attributes in the device, return a python dict. PARAMETERS ---------- prx: tango.DeviceProxy Proxy to the device. RETURN ------ attrs: dict keys are attributes names, values are values. """ attrs=dict() attrlist=prx.get_attribute_list() R= prx.read_attributes(attrlist, wait=True) for r in R: attrs[r.name.lower()]=r.value return attrs ############################################################################### # FUNCTIONS ON TANGO DATABASE ############################################################################### ############################################################################### # FUNCTIONS ON ARCHIVER ###############################################################################