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
Bliss
bliss
Commits
9a936a0a
Commit
9a936a0a
authored
May 04, 2021
by
Valentin Valls
Browse files
Add metadata type for MCAs and Lima detectors
parent
deba5562
Changes
3
Hide whitespace changes
Inline
Side-by-side
bliss/controllers/lima/lima_base.py
View file @
9a936a0a
...
...
@@ -15,6 +15,7 @@ from bliss.common.tango import DeviceProxy, DevFailed, Database, DevState
from
bliss.config
import
settings
from
bliss.config.beacon_object
import
BeaconObject
from
bliss.common.logtools
import
log_debug
from
bliss.common.protocols
import
HasMetadataForScan
from
bliss.controllers.counter
import
CounterController
,
counter_namespace
from
bliss
import
current_session
...
...
@@ -80,7 +81,7 @@ class ChangeTangoTimeout(object):
self
.
__device
.
set_timeout_millis
(
self
.
__back_timeout
)
class
Lima
(
CounterController
):
class
Lima
(
CounterController
,
HasMetadataForScan
):
"""
Lima controller.
Basic configuration:
...
...
@@ -155,6 +156,9 @@ class Lima(CounterController):
self
,
parents_list
=
[
"lima"
,
"controllers"
],
children_list
=
[
self
.
_proxy
]
)
def
metadata_when_prepared
(
self
)
->
dict
:
return
{
"type"
:
"lima"
}
@
property
def
disable_bpm
(
self
):
return
self
.
_disable_bpm
...
...
bliss/controllers/mca/base.py
View file @
9a936a0a
...
...
@@ -21,6 +21,7 @@ import gevent
from
bliss.controllers.mca.roi
import
RoiConfig
from
bliss.common.logtools
import
log_debug
from
bliss.common.protocols
import
HasMetadataForScan
from
bliss.common.utils
import
autocomplete_property
from
bliss.config.beacon_object
import
BeaconObject
from
bliss.controllers.counter
import
CounterController
...
...
@@ -91,7 +92,7 @@ class MCABeaconObject(BeaconObject):
# Base class
class
BaseMCA
(
CounterController
):
class
BaseMCA
(
CounterController
,
HasMetadataForScan
):
"""Generic MCA controller."""
# Life cycle
...
...
@@ -107,6 +108,9 @@ class BaseMCA(CounterController):
self
.
initialize_attributes
()
self
.
initialize_hardware
()
def
metadata_when_prepared
(
self
)
->
dict
:
return
{
"type"
:
"mca"
}
def
get_acquisition_object
(
self
,
acq_params
,
ctrl_params
,
parent_acq_params
):
from
bliss.scanning.acquisition.mca
import
(
...
...
tests/scans/test_data_watch.py
View file @
9a936a0a
...
...
@@ -144,6 +144,12 @@ def test_mca_with_watcher(session, test_observer):
test_observer
.
on_ndim_data_received
.
assert_called
()
test_observer
.
on_scan_finished
.
assert_called_once
()
sf
=
ScanInfo
()
device_key
=
sf
.
_get_key_from_acq_obj
(
mca_device
)
scan_info
=
test_observer
.
on_scan_started__scan_info
()
assert
device_key
in
scan_info
[
"devices"
]
assert
scan_info
[
"devices"
][
device_key
][
"type"
]
==
"mca"
def
test_limatake_with_watcher
(
session
,
lima_simulator
,
test_observer
):
lima_simulator
=
session
.
config
.
get
(
"lima_simulator"
)
...
...
@@ -165,6 +171,8 @@ def test_limatake_with_watcher(session, lima_simulator, test_observer):
for
node
in
builder
.
get_nodes_by_controller_type
(
Lima
):
node
.
set_parameters
(
acq_params
=
lima_params
)
chain
.
add
(
node
)
lima_acq_obj
=
node
.
acquisition_obj
scan
=
Scan
(
chain
,
name
=
"limatake"
,
save
=
False
)
with
watching
(
session
,
test_observer
):
...
...
@@ -175,6 +183,12 @@ def test_limatake_with_watcher(session, lima_simulator, test_observer):
test_observer
.
on_lima_ref_received
.
assert_called
()
test_observer
.
on_scan_finished
.
assert_called_once
()
sf
=
ScanInfo
()
device_key
=
sf
.
_get_key_from_acq_obj
(
lima_acq_obj
)
scan_info
=
test_observer
.
on_scan_started__scan_info
()
assert
device_key
in
scan_info
[
"devices"
]
assert
scan_info
[
"devices"
][
device_key
][
"type"
]
==
"lima"
def
test_data_watch_callback
(
session
,
diode_acq_device_factory
,
mocker
):
chain
=
AcquisitionChain
()
...
...
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