Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DynamicAttributes
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
spe
ds
DynamicAttributes
Commits
e75d1e58
Commit
e75d1e58
authored
Dec 17, 2021
by
Martin Scarcia
Browse files
Options
Downloads
Patches
Plain Diff
indentation fix
parent
0b4f3b94
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/dynamic-srv.py
+69
-75
69 additions, 75 deletions
src/dynamic-srv.py
with
69 additions
and
75 deletions
src/dynamic-srv.py
+
69
−
75
View file @
e75d1e58
...
@@ -46,7 +46,6 @@ import PyTango
...
@@ -46,7 +46,6 @@ import PyTango
import
time
import
time
import
numpy
as
np
import
numpy
as
np
import
signal
import
signal
def
fromPyTango2NumpyType
(
pytango_type
):
def
fromPyTango2NumpyType
(
pytango_type
):
...
@@ -262,7 +261,7 @@ class Dynamic(PyTango.Device_4Impl):
...
@@ -262,7 +261,7 @@ class Dynamic(PyTango.Device_4Impl):
module_name
=
aux
[
-
1
].
replace
(
'
.py
'
,
''
)
module_name
=
aux
[
-
1
].
replace
(
'
.py
'
,
''
)
try
:
try
:
self
.
module
=
__import__
(
module_name
)
self
.
module
=
__import__
(
module_name
)
except
ImportError
,
ex
:
except
ImportError
as
ex
:
sys
.
stderr
.
write
(
str
(
ex
)
+
"
\n
"
)
sys
.
stderr
.
write
(
str
(
ex
)
+
"
\n
"
)
self
.
module
=
None
self
.
module
=
None
self
.
set_state
(
PyTango
.
DevState
.
FAULT
)
self
.
set_state
(
PyTango
.
DevState
.
FAULT
)
...
@@ -275,7 +274,7 @@ class Dynamic(PyTango.Device_4Impl):
...
@@ -275,7 +274,7 @@ class Dynamic(PyTango.Device_4Impl):
#creation of dynamic attributes.
#creation of dynamic attributes.
try
:
try
:
xml_file
=
ScriptXmlConfig
(
self
.
XmlConfigurator
)
xml_file
=
ScriptXmlConfig
(
self
.
XmlConfigurator
)
except
InvalidFileError
,
ex
:
except
InvalidFileError
as
ex
:
self
.
warn_stream
(
"
Invalid xml file
\n
"
)
self
.
warn_stream
(
"
Invalid xml file
\n
"
)
self
.
set_state
(
PyTango
.
DevState
.
OFF
)
self
.
set_state
(
PyTango
.
DevState
.
OFF
)
return
return
...
@@ -294,10 +293,9 @@ class Dynamic(PyTango.Device_4Impl):
...
@@ -294,10 +293,9 @@ class Dynamic(PyTango.Device_4Impl):
attr
=
PyTango
.
SpectrumAttr
(
str
(
value
.
name
),
attr_config
.
data_type
,
attr_config
.
writable
,
attr_config
.
max_dim_x
)
attr
=
PyTango
.
SpectrumAttr
(
str
(
value
.
name
),
attr_config
.
data_type
,
attr_config
.
writable
,
attr_config
.
max_dim_x
)
elif
str
(
attr_config
.
data_format
)
==
"
IMAGE
"
:
elif
str
(
attr_config
.
data_format
)
==
"
IMAGE
"
:
attr
=
PyTango
.
ImageAttr
(
str
(
value
.
name
),
attr_config
.
data_type
,
attr_config
.
writable
,
attr_config
.
max_dim_x
,
attr_config
.
max_dim_y
)
attr
=
PyTango
.
ImageAttr
(
str
(
value
.
name
),
attr_config
.
data_type
,
attr_config
.
writable
,
attr_config
.
max_dim_x
,
attr_config
.
max_dim_y
)
#
self
.
add_attribute
(
attr
,
self
.
read_proxy
,
self
.
write_proxy
)
self
.
add_attribute
(
attr
,
self
.
read_proxy
,
self
.
write_proxy
)
self
.
myattrs
[
value
.
name
]
=
attr_proxy
self
.
myattrs
[
value
.
name
]
=
attr_proxy
except
PyTango
.
DevFailed
,
ex
:
except
PyTango
.
DevFailed
as
ex
:
self
.
warn_stream
(
"
%s
"
%
str
(
ex
))
self
.
warn_stream
(
"
%s
"
%
str
(
ex
))
continue
continue
if
self
.
myattrs
.
has_key
(
value
.
name
):
if
self
.
myattrs
.
has_key
(
value
.
name
):
...
@@ -363,7 +361,7 @@ class Dynamic(PyTango.Device_4Impl):
...
@@ -363,7 +361,7 @@ class Dynamic(PyTango.Device_4Impl):
self
.
myattrs
[
value
.
name
]
=
[]
self
.
myattrs
[
value
.
name
]
=
[]
else
:
else
:
self
.
myattrs
[
value
.
name
]
=
np
.
zeros
(
value
.
dimension
,
fromPyTango2NumpyType
(
tango_type
))
self
.
myattrs
[
value
.
name
]
=
np
.
zeros
(
value
.
dimension
,
fromPyTango2NumpyType
(
tango_type
))
#
self
.
set_state
(
PyTango
.
DevState
.
ON
)
self
.
set_state
(
PyTango
.
DevState
.
ON
)
...
@@ -416,7 +414,6 @@ class Dynamic(PyTango.Device_4Impl):
...
@@ -416,7 +414,6 @@ class Dynamic(PyTango.Device_4Impl):
# Add your own code here
# Add your own code here
data
=
self
.
read_dynamic_attribute
(
attr
.
get_name
())
data
=
self
.
read_dynamic_attribute
(
attr
.
get_name
())
#
attr
.
set_value
(
data
,
len
(
data
))
attr
.
set_value
(
data
,
len
(
data
))
...
@@ -427,7 +424,6 @@ class Dynamic(PyTango.Device_4Impl):
...
@@ -427,7 +424,6 @@ class Dynamic(PyTango.Device_4Impl):
#print "In ", self.get_name(), "::write_Spectrum()"
#print "In ", self.get_name(), "::write_Spectrum()"
# Add your own code here
# Add your own code here
value_in
=
attr
.
get_write_value
(
PyTango
.
ExtractAs
.
Numpy
)
value_in
=
attr
.
get_write_value
(
PyTango
.
ExtractAs
.
Numpy
)
#
self
.
write_dynamic_attribute
(
attr
.
get_name
(),
value_in
)
self
.
write_dynamic_attribute
(
attr
.
get_name
(),
value_in
)
...
@@ -466,8 +462,6 @@ class Dynamic(PyTango.Device_4Impl):
...
@@ -466,8 +462,6 @@ class Dynamic(PyTango.Device_4Impl):
val
=
attr
.
get_write_value
(
PyTango
.
ExtractAs
.
Numpy
)
val
=
attr
.
get_write_value
(
PyTango
.
ExtractAs
.
Numpy
)
self
.
myattrs
[
attr
.
get_name
()].
write
(
val
)
self
.
myattrs
[
attr
.
get_name
()].
write
(
val
)
#==================================================================
#==================================================================
#
#
# Dynamic command methods
# Dynamic command methods
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment