Skip to content

Instantly share code, notes, and snippets.

@cpascual
Created May 4, 2020 18:12
Show Gist options
  • Save cpascual/e89a1002bd1eb9feaecc15c2f146d01c to your computer and use it in GitHub Desktop.
Save cpascual/e89a1002bd1eb9feaecc15c2f146d01c to your computer and use it in GitHub Desktop.
Tango recipe: obtain all device names of a given class (using tango)
# Inspired in https://tango-controls.readthedocs.io/en/latest/tutorials-and-howtos/how-tos/how-to-pytango.html#using-database-object
import tango
class_name = 'TangoTest'
db = tango.Database()
devnames = []
for name in db.get_instance_name_list(class_name):
server_name = '/'.join((class_name, name))
for devname in db.get_device_class_list(server_name)[::2]:
if not devname.lower().startswith('dserver/'):
devnames.append(devname)
print(devnames)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment