Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
tango
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira issues
Open Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LOFAR2.0
tango
Merge requests
!78
Resolve
L2SS-247
"2021 07 06 branched from master attribute testing"
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Resolve
L2SS-247
"2021 07 06 branched from master attribute testing"
L2SS-247_2021-07-06-Branched_from_master-attribute_testing
into
master
Overview
22
Commits
29
Pipelines
0
Changes
9
Merged
Corné Lukken
requested to merge
L2SS-247_2021-07-06-Branched_from_master-attribute_testing
into
master
3 years ago
Overview
22
Commits
29
Pipelines
0
Changes
9
Expand
Closes
L2SS-247
Edited
3 years ago
by
Taya Snijder
0
0
Merge request reports
Compare
master
version 14
f5cac74b
3 years ago
version 13
2eecc182
3 years ago
version 12
c2dd875c
3 years ago
version 11
3b2f8976
3 years ago
version 10
de58c195
3 years ago
version 9
4de0968b
3 years ago
version 8
78befe64
3 years ago
version 7
999ec5b5
3 years ago
version 6
4662191a
3 years ago
version 5
e41b96b2
3 years ago
version 4
658e6e66
3 years ago
version 3
a22b2521
3 years ago
version 2
2ece1d48
3 years ago
version 1
7a2226a0
3 years ago
master (base)
and
latest version
latest version
784891c7
29 commits,
3 years ago
version 14
f5cac74b
28 commits,
3 years ago
version 13
2eecc182
27 commits,
3 years ago
version 12
c2dd875c
26 commits,
3 years ago
version 11
3b2f8976
25 commits,
3 years ago
version 10
de58c195
24 commits,
3 years ago
version 9
4de0968b
23 commits,
3 years ago
version 8
78befe64
21 commits,
3 years ago
version 7
999ec5b5
20 commits,
3 years ago
version 6
4662191a
19 commits,
3 years ago
version 5
e41b96b2
18 commits,
3 years ago
version 4
658e6e66
17 commits,
3 years ago
version 3
a22b2521
16 commits,
3 years ago
version 2
2ece1d48
15 commits,
3 years ago
version 1
7a2226a0
14 commits,
3 years ago
9 files
+
625
−
116
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
9
Search (e.g. *.vue) (Ctrl+P)
devices/clients/attribute_wrapper.py
+
13
−
5
Options
from
tango.server
import
attribute
from
tango
import
AttrWriteType
import
numpy
from
devices.device_decorators
import
only_when_on
,
fault_on_error
@@ -27,23 +26,24 @@ class attribute_wrapper(attribute):
"""
# ensure the type is a numpy array.
# see also https://pytango.readthedocs.io/en/stable/server_api/server.html?highlight=devlong#module-tango.server for
# see also https://pytango.readthedocs.io/en/stable/server_api/server.html?highlight=devlong#module-tango.server for
# more details about type conversion Python/numpy -> PyTango
if
"
numpy
"
not
in
str
(
datatype
)
and
datatype
!=
str
:
raise
TypeError
(
"
Attribute needs to be a Tango-supported numpy or str type, but has type
\"
%s
\"
"
%
(
datatype
,))
self
.
comms_id
=
comms_id
# store data that can be used to identify the comms interface to use. not used by the wrapper itself
self
.
comms_annotation
=
comms_annotation
# store data that can be used by the comms interface. not used by the wrapper itself
self
.
numpy_type
=
datatype
# tango changes our attribute to their representation (E.g numpy.int64 becomes "DevLong64")
self
.
init_value
=
init_value
is_scalar
=
dims
==
(
1
,)
# tango doesn't recognise numpy.str_, for consistencies sake we convert it here and hide this from the top level
# NOTE: discuss, idk if this is an important detail somewhere else
if
datatype
is
numpy
.
str_
:
if
datatype
is
numpy
.
str_
or
datatype
is
numpy
.
str
:
datatype
=
str
self
.
numpy_type
=
datatype
# tango changes our attribute to their representation (E.g numpy.int64 becomes "DevLong64")
# check if not scalar
if
is_scalar
:
# scalar, just set the single dimension.
@@ -131,7 +131,15 @@ class attribute_wrapper(attribute):
else
:
numpy_dims
=
dims
value
=
numpy
.
zeros
(
numpy_dims
,
dtype
=
self
.
numpy_type
)
if
self
.
dim_x
==
1
:
if
self
.
numpy_type
==
str
:
value
=
''
else
:
value
=
self
.
numpy_type
(
0
)
else
:
value
=
numpy
.
zeros
(
numpy_dims
,
dtype
=
self
.
numpy_type
)
return
value
def
set_comm_client
(
self
,
client
):
Loading