Commit 81a7c694 authored by Matias Guijarro's avatar Matias Guijarro Committed by Wout De Nolf
Browse files

metadata: fix global map registration on some controllers

parent 47b6ccd5
......@@ -9,6 +9,7 @@ from typing import Iterable
import typeguard
import numpy
from bliss import global_map
from bliss.common.counter import Counter
from bliss.config.beacon_object import BeaconObject
from bliss.common.logtools import log_debug
......@@ -159,8 +160,12 @@ def _to_list(setting, value):
class LimaImageParameters(BeaconObject):
def __init__(self, config, name):
def __init__(self, controller, name):
config = controller._config_node
super().__init__(config, name=name, share_hardware=False, path=["image"])
# properly put in map, to have "parameters" under the corresponding Lima controller node
# (and not in "controllers")
global_map.register(self, parents_list=[controller], tag="image_parameters")
binning = BeaconObject.property_setting(
"binning", default=[1, 1], set_marshalling=_to_list, set_unmarshalling=_to_list
......@@ -231,7 +236,7 @@ class ImageCounter(Counter):
super().__init__("image", controller)
self._image_params = LimaImageParameters(
controller._config_node, f"{controller._name_prefix}:image"
controller, f"{controller._name_prefix}:image"
)
def __info__(self):
......
......@@ -584,6 +584,9 @@ class Lima(CounterController, HasMetadataForScan):
def image(self):
if self._image is None:
self._image = ImageCounter(self)
global_map.register(
self._image, parents_list=[self], children_list=[self._proxy]
)
return self._image
@autocomplete_property
......
......@@ -19,6 +19,7 @@ import tabulate
import gevent
from bliss import global_map
from bliss.controllers.mca.roi import RoiConfig
from bliss.common.logtools import log_debug
from bliss.common.protocols import HasMetadataForScan
......@@ -103,6 +104,8 @@ class BaseMCA(CounterController, HasMetadataForScan):
# Life cycle
def __init__(self, name, config, beacon_obj_class=MCABeaconObject):
global_map.register(self) # register as controller
CounterController.__init__(self, name)
self.beacon_obj = beacon_obj_class(self, config)
......
......@@ -80,8 +80,6 @@ class esrf_hexapode(Controller, HasMetadataForScan):
def __init__(self, *args, **kwargs):
Controller.__init__(self, *args, **kwargs)
global_map.register(self)
self.device = None
self.roles = {}
self.last_read = None
......
......@@ -188,6 +188,8 @@ class Transfocator(HasMetadataForScan):
)
if self.wago:
global_map.register(self, children_list=[self.wago])
else:
global_map.register(self)
if "lenses" in config:
self.nb_lens = int(config["lenses"])
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment