Commit 581cd06f authored by Jan Kotanski's avatar Jan Kotanski
Browse files

New upstream version 2021.3.15.16.30

parent 68b66812
recursive-include python *.py
global-exclude *.pyc .gitignore
exclude setup.cfg
Metadata-Version: 1.2
Name: sardana_tango
Version: 2020.11.5.20.18
Version: 2021.3.15.16.30
Summary: UNKNOWN
Home-page: https://github.com/jkotan/sardana_tango
Home-page: https://github.com/ALBA-Synchrotron/sardana-tango
Author: Sardana Controller Developers
Author-email: fs-ec@desy.de
Maintainer: DESY
Maintainer-email: fs-ec@desy.de
Author-email: sardana-devel@lists.sourceforge.net
Maintainer: ALBA
Maintainer-email: sardana-devel@lists.sourceforge.net
License: UNKNOWN
Description: UNKNOWN
Platform: UNKNOWN
......
# sardana-tango
DESY Repository for the Sardana Tango plugins (TangoAttributeCtrls, etc)
Repository for the Sardana Tango plugins (TangoAttributeCtrls, etc)
Metadata-Version: 1.2
Name: sardana-tango
Version: 2020.11.5.20.18
Version: 2021.3.15.16.30
Summary: UNKNOWN
Home-page: https://github.com/jkotan/sardana_tango
Home-page: https://github.com/ALBA-Synchrotron/sardana-tango
Author: Sardana Controller Developers
Author-email: fs-ec@desy.de
Maintainer: DESY
Maintainer-email: fs-ec@desy.de
Author-email: sardana-devel@lists.sourceforge.net
Maintainer: ALBA
Maintainer-email: sardana-devel@lists.sourceforge.net
License: UNKNOWN
Description: UNKNOWN
Platform: UNKNOWN
......
......@@ -87,28 +87,31 @@ class ReadTangoAttributes:
self._log.error(
'Exception reading attributes:%s.%s' % (
dev, str(attributes)))
for attr in attributes:
axies = []
for axis, dic in self.devsExtraAttributes.items():
if dic[TANGO_ATTR] == dev + '/' + attr:
axies.append(axis)
for axis in axies:
if len(values) > 0:
dev_attr_value = values[attr]
if dev_attr_value.has_failed:
# In case of Attribute error
VALUE = tango.DevFailed(
*dev_attr_value.get_err_stack())
self.devsExtraAttributes[axis][EVALUATED_VALUE] = \
VALUE
else:
formula = self.devsExtraAttributes[axis][FORMULA]
VALUE = float(dev_attr_value.value)
# just in case 'VALUE' has been written
# in lowercase...
value = VALUE # noqa: F841
v = eval(formula)
self.devsExtraAttributes[axis][EVALUATED_VALUE] = v
for attr in attributes:
axies = []
for axis, dic in self.devsExtraAttributes.items():
if dic[TANGO_ATTR] == dev + '/' + attr:
axies.append(axis)
for axis in axies:
extra_attribute_axis = self.devsExtraAttributes[axis]
if len(values) > 0:
dev_attr_value = values[attr]
self._log.debug("For attribute %s axis %d [%s]"
% (str(attr), axis,
str(dev_attr_value)))
if dev_attr_value.has_failed:
# In case of Attribute error
VALUE = tango.DevFailed(
*dev_attr_value.get_err_stack())
extra_attribute_axis[EVALUATED_VALUE] = VALUE
else:
formula = extra_attribute_axis[FORMULA]
VALUE = float(dev_attr_value.value)
# just in case 'VALUE' has been written
# in lowercase...
value = VALUE # noqa: F841
v = eval(formula)
extra_attribute_axis[EVALUATED_VALUE] = v
except Exception as e:
self._log.error('Exception on read_all: %r' % e)
......@@ -123,7 +126,7 @@ class ReadTangoAttributes:
def set_extra_attribute_par(self, axis, name, value):
value = value.lower()
self._log.debug('SetExtraAttributePar [%d] %s = %s' % (
self._log.debug('SetAxisExtraPar [%d] %s = %s' % (
axis, name, value))
self.devsExtraAttributes[axis][name] = value
if name == TANGO_ATTR:
......
......@@ -226,10 +226,10 @@ class TangoAttrMotorController(MotorController):
def StopOne(self, axis):
pass
def SetPar(self, axis, name, value):
def SetAxisPar(self, axis, name, value):
self.axisAttributes[axis][name] = value
def GetPar(self, axis, name):
def GetAxisPar(self, axis, name):
return self.axisAttributes[axis][name]
def GetAxisExtraPar(self, axis, name):
......@@ -238,7 +238,7 @@ class TangoAttrMotorController(MotorController):
def SetAxisExtraPar(self, axis, name, value):
try:
self._log.debug(
"SetExtraAttributePar [%d] %s = %s" % (axis, name, value))
"SetAxisExtraPar [%d] %s = %s" % (axis, name, value))
self.axisAttributes[axis][name] = value
if name in [TANGO_ATTR, TANGO_ATTR_ENC]:
key = TAU_ATTR
......
......@@ -67,33 +67,54 @@ class ReadTangoAttributes():
index = self.devices_to_read[dev].index(attr)
self.devsExtraAttributes[axis][INDEX_READ_ALL] = index
# TODO create a base clase for the ZeroD and CT controllers
def read_all(self):
for dev in list(self.devices_to_read.keys()):
attributes = self.devices_to_read[dev]
dev_proxy = PoolUtil().get_device(self.inst_name, dev)
try:
values = dev_proxy.read_attributes(attributes)
except tango.DevFailed as e:
for attr in attributes:
axis = self.axis_by_tango_attribute[dev + '/' + attr]
self.devsExtraAttributes[axis][EVALUATED_VALUE] = e
except Exception:
self._log.error('Exception reading attributes:%s.%s' %
(dev, str(attributes)))
try:
for dev in list(self.devices_to_read.keys()):
attributes = self.devices_to_read[dev]
values = {}
try:
dev_proxy = PoolUtil().get_device(self.GetName(), dev)
# Set the list to prevent duplicated attr names
# Tango raise exception on read_attributes if there are
# duplicated attributes
attrs = list(set(attributes))
r_values = dev_proxy.read_attributes(attrs)
values = dict(list(zip(attrs, r_values)))
except tango.DevFailed as e:
# In case of DeviceServer error
for attr in attributes:
axis = self.axis_by_tango_attribute[dev + '/' + attr]
self.devsExtraAttributes[axis][EVALUATED_VALUE] = e
self._log.debug("Exception on read the attribute:%r", e)
except Exception:
self._log.error('Exception reading attributes:%s.%s',
dev, str(attributes))
for attr in attributes:
axis = self.axis_by_tango_attribute[dev + '/' + attr]
formula = self.devsExtraAttributes[axis][FORMULA]
index = attributes.index(attr)
dev_attr_value = values[index]
if dev_attr_value.has_failed:
VALUE = tango.DevFailed(*dev_attr_value.get_err_stack())
self.devsExtraAttributes[axis][EVALUATED_VALUE] = VALUE
else:
VALUE = float(dev_attr_value.value)
# just in case 'VALUE' has been written in lowercase...
value = VALUE # noqa: F841
self.devsExtraAttributes[axis][
EVALUATED_VALUE] = eval(formula)
axies = []
for axis, dic in self.devsExtraAttributes.items():
if dic[TANGO_ATTR] == dev+'/'+attr:
axies.append(axis)
for axis in axies:
if len(values) > 0:
dev_attr_value = values[attr]
if dev_attr_value.has_failed:
# In case of Attribute error
VALUE = tango.DevFailed(
*dev_attr_value.get_err_stack())
self.devsExtraAttributes[axis][EVALUATED_VALUE] = \
VALUE
else:
formula = self.devsExtraAttributes[axis][FORMULA]
VALUE = float(dev_attr_value.value)
# just in case 'VALUE' has been
# written in lowercase...
value = VALUE # noqa: F841
v = eval(formula)
self.devsExtraAttributes[axis][EVALUATED_VALUE] = v
except Exception as e:
self._log.error('Exception on read_all: %r', e)
def read_one(self, axis):
value = self.devsExtraAttributes[axis][EVALUATED_VALUE]
......@@ -105,6 +126,7 @@ class ReadTangoAttributes():
return self.devsExtraAttributes[axis][name]
def set_axis_extra_par(self, axis, name, value):
value = value.lower()
self._log.debug(
'set_axis_extra_par [%d] %s = %s' % (axis, name, value))
self.devsExtraAttributes[axis][name] = value
......@@ -117,7 +139,7 @@ class ReadTangoAttributes():
self.axis_by_tango_attribute[value] = axis
class TangoAttrZeroDController(ZeroDController, ReadTangoAttributes):
class TangoAttrZeroDController(ReadTangoAttributes, ZeroDController):
"""This controller offers as many channels as the user wants.
Each channel has two _MUST_HAVE_ extra attributes:
......@@ -142,11 +164,9 @@ class TangoAttrZeroDController(ZeroDController, ReadTangoAttributes):
MaxDevice = 1024
axis_attributes = ReadTangoAttributes.axis_attributes
def __init__(self, inst, props, *args, **kwargs):
ZeroDController.__init__(self, inst, props, *args, **kwargs)
ReadTangoAttributes.__init__(self)
ZeroDController.__init__(self, inst, props, *args, **kwargs)
def AddDevice(self, axis):
self.add_device(axis)
......@@ -177,3 +197,18 @@ class TangoAttrZeroDController(ZeroDController, ReadTangoAttributes):
def SendToCtrl(self, in_data):
return ""
def AbortOne(self, axis):
pass
def PreStartAll(self):
pass
def StartOne(self, axis):
pass
def StartAll(self):
pass
def LoadOne(self, axis, value, repetitions, latency):
pass
#!/usr/bin/env python
# import os
# import imp
from setuptools import setup
from datetime import datetime
......@@ -17,10 +15,10 @@ provides = ['sardana_tango']
setup(name='sardana_tango',
version=release,
author="Sardana Controller Developers",
author_email="fs-ec@desy.de",
maintainer="DESY",
maintainer_email="fs-ec@desy.de",
url="https://github.com/jkotan/sardana_tango",
author_email="sardana-devel@lists.sourceforge.net",
maintainer="ALBA",
maintainer_email="sardana-devel@lists.sourceforge.net",
url="https://github.com/ALBA-Synchrotron/sardana-tango",
packages=packages,
package_dir=package_dir,
include_package_data=True,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment