Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PETRA III Debian Packages
python-sardana-tango-controllers
Commits
581cd06f
Commit
581cd06f
authored
Mar 15, 2021
by
Jan Kotanski
Browse files
New upstream version 2021.3.15.16.30
parent
68b66812
Changes
8
Hide whitespace changes
Inline
Side-by-side
MANIFEST.in
View file @
581cd06f
recursive-include python *.py
global-exclude *.pyc .gitignore
exclude setup.cfg
PKG-INFO
View file @
581cd06f
Metadata-Version: 1.2
Name: sardana_tango
Version: 202
0.11.5.20.18
Version: 202
1.3.15.16.30
Summary: UNKNOWN
Home-page: https://github.com/
jkota
n/sardana
_
tango
Home-page: https://github.com/
ALBA-Synchrotro
n/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
...
...
README.md
View file @
581cd06f
# sardana-tango
DESY
Repository for the Sardana Tango plugins (TangoAttributeCtrls, etc)
Repository for the Sardana Tango plugins (TangoAttributeCtrls, etc)
sardana_tango.egg-info/PKG-INFO
View file @
581cd06f
Metadata-Version: 1.2
Name: sardana-tango
Version: 202
0.11.5.20.18
Version: 202
1.3.15.16.30
Summary: UNKNOWN
Home-page: https://github.com/
jkota
n/sardana
_
tango
Home-page: https://github.com/
ALBA-Synchrotro
n/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/ctrl/TangoAttrCTCtrl.py
View file @
581cd06f
...
...
@@ -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
(
'SetExtra
Attribute
Par [%d] %s = %s'
%
(
self
.
_log
.
debug
(
'Set
Axis
ExtraPar [%d] %s = %s'
%
(
axis
,
name
,
value
))
self
.
devsExtraAttributes
[
axis
][
name
]
=
value
if
name
==
TANGO_ATTR
:
...
...
sardana_tango/ctrl/TangoAttrMotorCtrl.py
View file @
581cd06f
...
...
@@ -226,10 +226,10 @@ class TangoAttrMotorController(MotorController):
def
StopOne
(
self
,
axis
):
pass
def
SetPar
(
self
,
axis
,
name
,
value
):
def
Set
Axis
Par
(
self
,
axis
,
name
,
value
):
self
.
axisAttributes
[
axis
][
name
]
=
value
def
GetPar
(
self
,
axis
,
name
):
def
Get
Axis
Par
(
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
(
"SetExtra
Attribute
Par [%d] %s = %s"
%
(
axis
,
name
,
value
))
"Set
Axis
ExtraPar [%d] %s = %s"
%
(
axis
,
name
,
value
))
self
.
axisAttributes
[
axis
][
name
]
=
value
if
name
in
[
TANGO_ATTR
,
TANGO_ATTR_ENC
]:
key
=
TAU_ATTR
...
...
sardana_tango/ctrl/TangoAttrZeroDCtrl.py
View file @
581cd06f
...
...
@@ -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
setup.py
View file @
581cd06f
#!/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/
jkota
n/sardana
_
tango"
,
author_email
=
"
sardana-devel@lists.sourceforge.net
"
,
maintainer
=
"
ALBA
"
,
maintainer_email
=
"
sardana-devel@lists.sourceforge.net
"
,
url
=
"https://github.com/
ALBA-Synchrotro
n/sardana
-
tango"
,
packages
=
packages
,
package_dir
=
package_dir
,
include_package_data
=
True
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment