Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

list of Channel names in active Measurement Group #1688

Open
kklmn opened this issue Sep 10, 2021 · 5 comments · May be fixed by #1691
Open

list of Channel names in active Measurement Group #1688

kklmn opened this issue Sep 10, 2021 · 5 comments · May be fixed by #1691
Labels

Comments

@kklmn
Copy link

kklmn commented Sep 10, 2021

Hello,

I want to get the subj to display it in a qt gui. I see the method getExperimentConfiguration() of BaseDoor that would probably give it.

But in our beamline's door this method does not exist:

Probably, the Turus Extention's door is something different from the beamline's door, Cthulhu knows why...

In going with the taurus door:
import taurus
door = taurus.Device('Balder/Door/01')
both door.getExperimentConfiguration() and door.getExperimentConfigurationObj() result in
AttributeError: configurationChanged (For more detailed information type: python_error)
where configurationChanged is a qt signal. So the methods do not work, which I consider a bug.

How would you get the subj, with or without taurus?
Thanks!

@reszelaz
Copy link
Collaborator

reszelaz commented Sep 15, 2021

Hi @kklmn,

The door.getExperimentConfiguration() method works for me.

All the following ways work for me:

from pprint import pprint
from taurus import Device
from sardana.taurus.core.tango.sardana import registerExtensions

registerExtensions()

door = Device("door/zreszela/1")
exp_conf = door.getExperimentConfiguration()
pprint(exp_conf)
mnt_grp = Device(exp_conf["ActiveMntGrp"])
# this contains all channels' configuration parameters
channels = mnt_grp.getChannels()
pprint(channels)
# this contains channels enabled configuration only
enabled = mnt_grp.getEnabled()
pprint(enabled)

If you just need the channel names, then maybe the last method is the easiest to you to process later one.

Also, you can avoid getting the whole experiment configuration by directly getting the ActiveMntGrp from the environment. This should perform better.

from pprint import pprint
from taurus import Device
from sardana.taurus.core.tango.sardana import registerExtensions

registerExtensions()

door = Device("door/zreszela/1")
mnt_grp = Device(door.getEnvironment("ActiveMntGrp"))
# this contains all channels' configuration parameters
channels = mnt_grp.getChannels()
pprint(channels)
# this contains channels' enabled configuration only
enabled = mnt_grp.getEnabled()
pprint(enabled)

Hope this helps:)

@reszelaz
Copy link
Collaborator

I just realized that yesterday I posted twice the same code snippet. I just corrected it directly in #1688 (comment).

@kklmn
Copy link
Author

kklmn commented Sep 20, 2021

Thank you @reszelaz!

Unfortunately, something is different in our (MAX IV) world.
I get mntGrp in either way you've given, and it is:

QMeasurementGroup(mntgrp/pool_balder/aem-01-02)

Then I try channels = mntGrp.getChannels() and get AttributeError.

I print dir(mntGrp) with this output:
['Console', 'Critical', 'Debug', 'DftLogFormat', 'DftLogLevel', 'DftLogMessageFormat', 'Error', 'Fatal', 'Info', 'RegularEvent', 'Trace', 'Warning', '_QMeasurementGroup__configuration', '_TangoDevice__decode', '_TangoDevice__pollAsynch', '_TangoDevice__pollReply', '_TangoDevice__pollResult', '__class__', '__contains__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattr__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__str__name__', '__subclasshook__', '__weakref__', '_config', '_configurationChanged', '_createHWObject', '_description', '_deviceObj', '_deviceState', '_deviceStateObj', '_factory', '_format_stack', '_format_trace', '_full_name', '_getCallableRef', '_getLogger', '_listenerDied', '_listeners', '_lock_info', '_norm_name', '_parentObj', '_repr_html_', '_scheme', '_serialization_mode', '_simp_name', 'addChild', 'addLevelName', 'addListener', 'addLogHandler', 'addRootLogHandler', 'blockSignals', 'buildModelName', 'call__init__', 'call__init__wo_kw', 'changeLogName', 'childEvent', 'children', 'cleanUp', 'configurationChanged', 'connectNotify', 'copyLogHandlers', 'critical', 'customEvent', 'debug', 'deleteLater', 'deleteListener', 'deprecated', 'description', 'destroyed', 'disableLogOutput', 'disconnect', 'disconnectNotify', 'dumpObjectInfo', 'dumpObjectTree', 'dynamicPropertyNames', 'enableLogOutput', 'error', 'event', 'eventFilter', 'eventReceived', 'exception', 'factory', 'fatal', 'findChild', 'findChildren', 'fireEvent', 'flushOutput', 'forceListening', 'fullname', 'getAttrDict', 'getAttribute', 'getChildObj', 'getChildren', 'getConfiguration', 'getDescription', 'getDeviceProxy', 'getDisplayDescrObj', 'getDisplayName', 'getDisplayValue', 'getFragmentObj', 'getFullName', 'getHWObj', 'getLockInfo', 'getLogFormat', 'getLogFullName', 'getLogLevel', 'getLogName', 'getLogObj', 'getLogger', 'getNameValidator', 'getNormalName', 'getParent', 'getParentObj', 'getRootLog', 'getSWState', 'getSerializationMode', 'getSimpleName', 'getState', 'getStateObj', 'getTaurusElementType', 'getValueObj', 'hasListeners', 'info', 'inherits', 'initRoot', 'inited_class_list', 'installEventFilter', 'isSignalConnected', 'isValid', 'isValidDev', 'isWidgetType', 'isWindowType', 'isWritable', 'killTimer', 'lock', 'log', 'log_children', 'log_format', 'log_full_name', 'log_handlers', 'log_level', 'log_name', 'log_obj', 'log_parent', 'metaObject', 'moveToThread', 'name', 'objectName', 'objectNameChanged', 'parent', 'parentObj', 'poll', 'property', 'pyqtConfigure', 'receivers', 'removeEventFilter', 'removeListener', 'removeLogHandler', 'removeRootLogHandler', 'resetLogFormat', 'resetLogLevel', 'root_init_lock', 'root_inited', 'sender', 'senderSignalIndex', 'setConfiguration', 'setLogFormat', 'setLogLevel', 'setObjectName', 'setParent', 'setProperty', 'setSerializationMode', 'signalsBlocked', 'stack', 'startTimer', 'state', 'stateObj', 'staticMetaObject', 'stream_handler', 'syncLog', 'thread', 'timerEvent', 'tr', 'trace', 'traceback', 'unforceListening', 'unlock', 'updateAttrDict', 'warning']

This device is then something else. Does it look familiar to you?

This output I get from within a GUI application instantiated by Taurus. If I start a python session, get a door device (and it is TangoDdevice(Balder/Door/01)) then door.getEnvironment() or door.getExperimentConfiguration() result in AttributeError, as in OP.

Could it be version problem?

@kklmn
Copy link
Author

kklmn commented Sep 21, 2021

Hi!

I was missing registerExtensions(), sorry for this! With it, I can do getEnvironment() and door.getExperimentConfiguration() and even can do mntGrp.getChannels(). But only in a separate python session.

In a Taurus application, mntGrp.getChannels() throws AttributeError.

Taurus application seem to do a similar magic command but in the other direction, like unregisterExtensions().

@reszelaz
Copy link
Collaborator

Thanks for the further feedback. This is a bug in QMeasurementGroup class. I'm already working on a solution here. Sorry for the inconvenience.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants