Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BCU-Vercors
ID26
id26
Commits
e268dc1c
Commit
e268dc1c
authored
Oct 06, 2021
by
bliss administrator
Browse files
attenuator setup channels for factor and thickness to be displayed in daiquiri
parent
e0832e21
Pipeline
#56133
failed
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
id26/controllers/attenuator.py
View file @
e268dc1c
from
bliss.scanning.scan_meta
import
get_user_scan_meta
from
bliss.config.channels
import
Cache
'''
class: ID26attenuator
package: id26.controllers.attenuator
...
...
@@ -27,6 +27,12 @@ class ID26Attenuator:
self
.
wkey
=
config_dict
[
'wago_logical_name'
]
self
.
unit
=
float
(
config_dict
[
'attenuation_unit'
])
self
.
filters
=
config_dict
[
'filters'
]
self
.
__factor
=
Cache
(
self
,
"factor"
,
default_value
=
0
)
self
.
__thickness
=
Cache
(
self
,
"thickness"
,
default_value
=
0
)
self
.
factor
()
self
.
thickness
()
self
.
_init_meta_data_publishing
()
...
...
@@ -69,22 +75,22 @@ class ID26Attenuator:
return
(
msg
)
def
factor
(
self
,
value
=
None
):
if
value
!=
None
:
register
=
list
(
map
(
int
,
' '
.
join
(
bin
(
value
)[
2
:].
rjust
(
len
(
self
.
filters
),
'0'
)[::
-
1
]).
split
()))
self
.
wago
.
set
(
self
.
wkey
,
register
)
register
=
self
.
wago
.
get
(
self
.
wkey
)
factor
=
int
(
''
.
join
(
list
(
map
(
str
,
register
)))[::
-
1
],
base
=
2
)
self
.
__factor
.
value
=
factor
return
factor
def
thickness
(
self
,
value
=
None
):
if
value
!=
None
:
newvalue
=
int
(
value
/
self
.
unit
)
self
.
factor
(
newvalue
)
value
=
self
.
unit
*
self
.
factor
()
value
=
self
.
unit
*
self
.
factor
()
self
.
__thickness
.
value
=
value
return
value
def
insert
(
self
,
*
channel
):
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment