Created
May 4, 2020 18:12
-
-
Save cpascual/e89a1002bd1eb9feaecc15c2f146d01c to your computer and use it in GitHub Desktop.
Tango recipe: obtain all device names of a given class (using tango)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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