Commit 3515bdfe authored by Jibril Mammeri's avatar Jibril Mammeri
Browse files

Add positioner property to Axis, hide SoftAxes in wa(), update tests

parent a9b33596
Pipeline #39047 failed with stages
in 59 seconds
...@@ -372,7 +372,8 @@ class MapWithAliases(Map): ...@@ -372,7 +372,8 @@ class MapWithAliases(Map):
tasks = list() tasks = list()
for axis in self.get_axes_iter(): for axis in self.get_axes_iter():
tasks.append(gevent.spawn(request, axis)) if axis.positioner:
tasks.append(gevent.spawn(request, axis))
gevent.joinall(tasks) gevent.joinall(tasks)
......
...@@ -682,6 +682,7 @@ class Axis: ...@@ -682,6 +682,7 @@ class Axis:
self.__no_offset = False self.__no_offset = False
self._group_move = GroupMove() self._group_move = GroupMove()
self._lock = gevent.lock.Semaphore() self._lock = gevent.lock.Semaphore()
self.__positioner = True
try: try:
config.parent config.parent
...@@ -739,6 +740,15 @@ class Axis: ...@@ -739,6 +740,15 @@ class Axis:
"""Axis name""" """Axis name"""
return self.__name return self.__name
@property
def positioner(self):
"""Axis positioner"""
return self.__positioner
@positioner.setter
def positioner(self, new_p):
self.__positioner = new_p
@autocomplete_property @autocomplete_property
def controller(self): def controller(self):
"""Reference to :class:`~bliss.controllers.motor.Controller`""" """Reference to :class:`~bliss.controllers.motor.Controller`"""
......
...@@ -19,8 +19,9 @@ def SoftAxis( ...@@ -19,8 +19,9 @@ def SoftAxis(
low_limit=float("-inf"), low_limit=float("-inf"),
high_limit=float("+inf"), high_limit=float("+inf"),
tolerance=None, tolerance=None,
export_to_session=False, export_to_session=True,
unit=None, unit=None,
positioner=False,
): ):
# if callable(position): # if callable(position):
...@@ -47,6 +48,7 @@ def SoftAxis( ...@@ -47,6 +48,7 @@ def SoftAxis(
controller._init() controller._init()
axis = controller.get_axis(name) axis = controller.get_axis(name)
axis.positioner = positioner
if export_to_session: if export_to_session:
current_session = get_current_session() current_session = get_current_session()
......
...@@ -64,7 +64,7 @@ class Pilatus(object): ...@@ -64,7 +64,7 @@ class Pilatus(object):
_energy = 12.34 _energy = 12.34
def get_energy(self): def get_energy(self):
return self._enery return self._energy
def set_energy(self, new_energy): def set_energy(self, new_energy):
self._energy = new_energy self._energy = new_energy
......
...@@ -99,4 +99,6 @@ def test_soft_axis_scan(session): ...@@ -99,4 +99,6 @@ def test_soft_axis_scan(session):
def test_soft_axis_iter_position_all(session): def test_soft_axis_iter_position_all(session):
o = Object() o = Object()
m0 = SoftAxis("bla", o) m0 = SoftAxis("bla", o)
assert not any(whereall.axis_name == "bla" for whereall in iter_axes_position_all())
m0.positioner = True
assert any(whereall.axis_name == "bla" for whereall in iter_axes_position_all()) assert any(whereall.axis_name == "bla" for whereall in iter_axes_position_all())
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