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
LimaGroup
Lima-camera-eiger
Commits
74fab309
Commit
74fab309
authored
Dec 07, 2021
by
Laurent Claustre
Browse files
fixed some bugs. Tested on ID10
parent
14d1ef3b
Pipeline
#62000
passed with stages
in 5 minutes and 11 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
tango/Eiger.py
View file @
74fab309
...
...
@@ -115,17 +115,17 @@ class Eiger(PyTango.LatestDeviceImpl):
# Put in cache some hardware parameters to avoid cumulative deadtime
# That means only attribute reading return the cache value.
# for client reading them regulary. Each hw param. reading takes ~100ms
for
attr
in
[
"auto_summation"
,
"countrate_correction"
,
"flatfield_correction"
,
"pixel_mask"
,
"retrigger"
,
"threshold_energy"
,
"threshold_energy2"
,
"threshold_diff_mode"
,
"virtual_pixel_correction"
,
for
attr
in
[
"
read_
auto_summation"
,
"
read_
countrate_correction"
,
"
read_
flatfield_correction"
,
"
read_
pixel_mask"
,
"
read_
retrigger"
,
"
read_
threshold_energy"
,
"
read_
threshold_energy2"
,
"
read_
threshold_diff_mode"
,
"
read_
virtual_pixel_correction"
,
]:
init_attr_4u_with_cache
(
attr
,
_EigerCamera
)
init_attr_4u_with_cache
(
self
,
attr
,
_EigerCamera
)
#------------------------------------------------------------------
# getAttrStringValueList command:
...
...
@@ -416,20 +416,19 @@ def get_attr_4u_objs(obj, name):
return
attr_name
,
AttrName
,
d
,
cache
def
init_attr_4u_with_cache
(
obj
,
name
,
interface
):
attr_name
,
AttrName
,
d
,
cache
=
get_attr_4u_objs
(
obj
,
name
)
functName
=
'get'
+
AttrName
funct
=
getattr
(
interface
,
functName
)
if
cache
:
data
=
funct
()
if
d
:
data
=
getDictKey
(
d
,
data
)
attr_name
,
AttrName
,
d
,
cache
=
get_attr_4u_objs
(
obj
,
name
)
functName
=
'get'
+
AttrName
funct
=
getattr
(
interface
,
functName
)
if
cache
:
data
=
funct
()
if
d
:
data
=
getDictKey
(
d
,
data
)
cache
[
attr_name
]
=
data
def
get_attr_4u_with_cache
(
obj
,
name
,
interface
,
update_dict
=
True
)
:
if
name
.
startswith
(
'read_'
)
or
name
.
startswith
(
'write_'
)
:
attr_name
,
AttrName
,
d
,
cache
=
get_attr_4u_objs
(
obj
,
name
)
if
d
:
if
name
.
startswith
(
'read_'
)
:
functionName
=
'get'
+
AttrName
...
...
@@ -451,7 +450,6 @@ def get_attr_4u_with_cache(obj, name, interface, update_dict=True) :
function2Call
=
getattr
(
interface
,
functionName
)
callable_obj
=
CallableWriteWithCache
(
attr_name
,
function2Call
,
cache
)
if
update_dict
:
obj
.
__dict__
[
name
]
=
callable_obj
callable_obj
.
__name__
=
name
return
callable_obj
...
...
@@ -471,11 +469,11 @@ class CallableReadEnumWithCache:
if
self
.
__cache
:
data
=
self
.
__cache
[
self
.
__attr_name
]
else
:
data
=
self
.
__func2Call
()
)
data
=
self
.
__func2Call
()
attr
.
set_value
(
getDictKey
(
self
.
__dict
,
data
))
## @brief Class for genenic write_<attribute> with enum value
class
CallableWriteEnum
m
WithCache
:
class
CallableWriteEnumWithCache
:
def
__init__
(
self
,
attr_name
,
dictionary
,
func2Call
,
cache
)
:
self
.
__attr_name
=
attr_name
self
.
__dict
=
dictionary
...
...
@@ -495,7 +493,7 @@ class CallableWriteEnummWithCache:
self
.
__cache
[
self
.
__attr_name
]
=
value
## @brief Class for genenic read_<attribute> with simple value
class
CallableRead
m
WithCache
:
class
CallableReadWithCache
:
def
__init__
(
self
,
attr_name
,
func2Call
,
cache
)
:
self
.
__attr_name
=
attr_name
self
.
__func2Call
=
func2Call
...
...
@@ -503,13 +501,13 @@ class CallableReadmWithCache:
def
__call__
(
self
,
attr
)
:
if
self
.
__cache
:
value
=
self
.
__cache
[
self
.
_attr_name
]
value
=
self
.
__cache
[
self
.
_
_
attr_name
]
else
:
value
=
self
.
__func2Call
()
attr
.
set_value
(
value
)
## @brief Class for genenic write_<attribute> with simple value
class
CallableWrite
m
WithCache
:
class
CallableWriteWithCache
:
def
__init__
(
self
,
attr_name
,
func2Call
,
cache
)
:
self
.
__attr_name
=
attr_name
self
.
__func2Call
=
func2Call
...
...
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