diff --git a/OpUtils.py b/OpUtils.py new file mode 100644 index 0000000000000000000000000000000000000000..302aae66720101b9f6c11c25c4574b81e6c40f32 --- /dev/null +++ b/OpUtils.py @@ -0,0 +1,36 @@ +# 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] + +############################################################################### +# FUNCTIONS ON TANGO DATABASE +############################################################################### + +############################################################################### +# FUNCTIONS ON ARCHIVER +############################################################################### diff --git a/pyprompt.ipy b/pyprompt.ipy new file mode 100644 index 0000000000000000000000000000000000000000..58b649c8d476abe93edc237578cad3d1d1f6d00c --- /dev/null +++ b/pyprompt.ipy @@ -0,0 +1,17 @@ +# IPython prompt initialization for operation + +# Turn automagic on +# This gives the possibility to use magic command without '%'. +# i.e. cd, pwd, ... +%automagic on + + +# Import usefull packages +import PyTango as tango +import numpy as np +import OpUtils as OU +print("Imported: tango, np, OU") + +# Create a database object +DB = tango.Database() +print("Object DB created: tango database")