Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
instruments = true # true if plugin contains instrument classes (else false, notice the lowercase for toml files)
extensions = true # true if plugins contains dashboard extensions
models = true # true if plugins contains pid models
h5exporters = false # true if plugin contains custom h5 file exporters
h5exporters = true # true if plugin contains custom h5 file exporters
scanners = false # true if plugin contains custom scan layout (daq_scan extensions)

[urls]
Expand All @@ -19,12 +19,12 @@ dependencies = [
"pillow",
]


authors = [
{name = "Weber Sebastien", email = "[email protected]"},
]
maintainers = [
{name = "Weber Sebastien", email = "[email protected]"},
#todo: list here all maintainers of your plugin
]


Expand All @@ -33,7 +33,7 @@ maintainers = [
dynamic = ["version", "urls", "entry-points"]
readme = "README.rst"
license = { file="LICENSE" }
requires-python = ">=3.11"
requires-python = ">=3.10"

classifiers = [
"Development Status :: 5 - Production/Stable",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ class DAQ_Move_BSPiezoMirror(DAQ_Move_base):

_controller_units = ''
is_multiaxes = True
stage_names = BeamSteeringActuators.axes[:2]
_epsilon = 1
_axis_names = BeamSteeringActuators.axes[:2]
_epsilons = 1
data_actuator_type = DataActuatorType.DataActuator

params = [
{'title': 'Tau (ms):', 'name': 'tau', 'type': 'int',
'value': BeamSteering._tau * 1000, 'tip': 'Characteristic evolution time'},
] + comon_parameters_fun(is_multiaxes, stage_names, epsilon=_epsilon)
] + comon_parameters_fun(axis_names=_axis_names, epsilon=_epsilons)

def ini_attributes(self):
self.controller: BeamSteering = None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@ class DAQ_Move_BSPiezoMirrorRunTimeError(DAQ_Move_BSPiezoMirror):
"""

def get_actuator_value(self):
raise RuntimeError('Testing Purpose')
axis = self.settings['multiaxes', 'axis']
pos = self.controller.get_value(axis)
pos = self.get_position_with_scaling(pos)
return pos
raise RuntimeError('Testing Purpose') #noqa PMQ202


if __name__ == '__main__':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ def ini_stage(self, controller=None):
"""

"""
self.ini_stage_init(controller, BeamSteering())
if self.is_master:
self.controller = BeamSteering()
else:
self.controller = controller
self.controller.tau = self.settings['tau'] / 1000
raise IOError('Testing Purpose') # simulating an error in initialization !!!
info = ""
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from pymodaq.control_modules.move_utility_classes import DAQ_Move_base, main # base class
from pymodaq.control_modules.move_utility_classes import DAQ_Move_base, main, DataActuatorType, DataActuator # base class
from pymodaq.control_modules.move_utility_classes import comon_parameters_fun # common set of parameters for all actuators

from pymodaq.utils.daq_utils import ThreadCommand, getLineInfo # object used to send info back to the main thread
Expand All @@ -14,20 +14,23 @@ class DAQ_Move_BSPowerMeter(DAQ_Move_base):

_controller_units = 'W'
is_multiaxes = True
stage_names = [BeamSteeringActuators.axes[-1]]
_epsilon = 0.5
_axis_names = [BeamSteeringActuators.axes[-1]]
_epsilons = 0.5

params = [
{'title': 'Tau (ms):', 'name': 'tau', 'type': 'int',
'value': BeamSteering._tau * 1000, 'tip': 'Characteristic evolution time'},
] + comon_parameters_fun(is_multiaxes, stage_names, epsilon=_epsilon)
] + comon_parameters_fun(axis_names=_axis_names, epsilon=_epsilons)

data_actuator_type = DataActuatorType.DataActuator

def ini_attributes(self):
self.controller: BeamSteering = None

def get_actuator_value(self):
axis = self.settings['multiaxes', 'axis']
pos = self.controller.get_value(axis)
def get_actuator_value(self) -> DataActuator:
pos = DataActuator(self._title,
data=self.controller.get_value(self.axis_name),
units=self.axis_unit)
pos = self.get_position_with_scaling(pos)
return pos

Expand Down Expand Up @@ -61,25 +64,28 @@ def ini_stage(self, controller=None):
--------
daq_utils.ThreadCommand
"""
self.ini_stage_init(controller, BeamSteering())
if self.is_master:
self.controller = BeamSteering()
else:
self.controller = controller
info = ""
initialized = True
return info, initialized

def move_abs(self, position):
def move_abs(self, position: DataActuator):
position = self.check_bound(position) #if user checked bounds, the defined bounds are applied here
self.target_value = position
position = self.set_position_with_scaling(position)
axis = self.settings['multiaxes', 'axis']
pos = self.controller.move_at(position, axis)

def move_rel(self, position):
position = self.check_bound(self.current_position + position) - self.current_position
self.target_value = position + self.current_position
self.controller.move_at(position.value(self.axis_unit), self.axis_name)

def move_rel(self, position: DataActuator):
position = self.check_bound(self.current_value + position) - self.current_value
self.target_value = position + self.current_value
position = self.set_position_with_scaling(self.target_value)

axis = self.settings['multiaxes', 'axis']
pos = self.controller.move_at(position, axis)

self.controller.move_at(position.value(self.axis_unit), self.axis_name)

def move_home(self):
"""
Expand All @@ -98,7 +104,7 @@ def stop_motion(self):
--------
move_done
"""
self.controller.stop(self.settings['multiaxes', 'axis'])
self.controller.stop(self.axis_name)
self.move_done()


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ def get_actuator_value(self):
-------
float: The position obtained after scaling conversion.
"""
pos = DataActuator(data=self.controller.amplitude) # when writing your own plugin replace this line
pos = DataActuator(self._title,
data=self.controller.amplitude,
units=self.axis_unit)
pos = self.get_position_with_scaling(pos)
return pos

Expand Down Expand Up @@ -71,10 +73,10 @@ def ini_stage(self, controller=None):
initialized: bool
False if initialization failed otherwise True
"""
self.controller = self.ini_stage_init(old_controller=controller,
new_controller=None)
if self.is_master:
self.controller = Harmonics()
else:
self.controller = controller

info = "Whatever info you want to log"
initialized = True
Expand All @@ -100,8 +102,8 @@ def move_rel(self, value: DataActuator):
----------
value: (float) value of the relative target positioning
"""
value = self.check_bound(self.current_position + value) - self.current_position
self.target_value = value + self.current_position
value = self.check_bound(self.current_value + value) - self.current_value
self.target_value = value + self.current_value
value = self.set_position_relative_with_scaling(value)

self.controller.amplitude = self.target_value.value()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@ class DAQ_Move_MockBinary(DAQ_Move_base):
"""
_controller_units = ''

is_multiaxes = True # set to True if this plugin is controlled for a multiaxis controller (with a unique communication link)
axes_names = ['']
_epsilon = 0.01
params = comon_parameters_fun(is_multiaxes, axes_names, epsilon=_epsilon)
_axis_names = ['']
_epsilons = 0.01
params = comon_parameters_fun(axis_names=_axis_names, epsilon=_epsilons)
data_actuator_type = DataActuatorType.DataActuator
ui_type = UiType.BINARY #for pymodaq >= 5.3.0

Expand All @@ -32,7 +31,10 @@ def internal_state(self, value: int):
self._internal_state = int(value)

def get_actuator_value(self):
pos = DataActuator(data=self.internal_state)
pos = DataActuator(self._title,
data=self.internal_state,
units=self.axis_unit
)
pos = self.get_position_with_scaling(pos)
return pos

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
from pymodaq.control_modules.move_utility_classes import DAQ_Move_base, main # base class
from pymodaq.control_modules.move_utility_classes import DAQ_Move_base, main, DataActuatorType # base class
from pymodaq.control_modules.move_utility_classes import comon_parameters_fun # common set of parameters for all actuators

from pymodaq.utils.daq_utils import ThreadCommand, getLineInfo # object used to send info back to the main thread
from easydict import EasyDict as edict # type of dict

from pymodaq.utils.data import DataActuator
from ..hardware.camera_wrapper import Camera

from pymodaq_plugins_mockexamples import config
Expand All @@ -19,17 +21,19 @@ class DAQ_Move_MockCamera(DAQ_Move_base):
"""
_controller_units = ''
is_multiaxes = True
stage_names = Camera.axes
_epsilon = 0.01
_axis_names = Camera.axes
_epsilons = 0.01

params = comon_parameters_fun(is_multiaxes, stage_names)
params = comon_parameters_fun(axis_names=_axis_names, epsilon=_epsilons)
data_actuator_type = DataActuatorType.DataActuator

def ini_attributes(self):
self.controller: Camera = None

def get_actuator_value(self):
axis = self.settings['multiaxes', 'axis']
pos = self.controller.get_value(axis)
def get_actuator_value(self) -> DataActuator:
pos = DataActuator(self._title,
data=self.controller.get_value(self.axis_name),
units=self.axis_unit)
pos = self.get_position_with_scaling(pos)
return pos

Expand Down Expand Up @@ -62,25 +66,27 @@ def ini_stage(self, controller=None):
--------
daq_utils.ThreadCommand
"""
self.ini_stage_init(controller, Camera())
if self.is_master:
self.controller = Camera()
else:
self.controller = controller

info = "Mock Camera"
initialized = True
return info, initialized

def move_abs(self, position):
def move_abs(self, position: DataActuator):
position = self.check_bound(position) #if user checked bounds, the defined bounds are applied here
self.target_value = position
position = self.set_position_with_scaling(position)
axis = self.settings['multiaxes', 'axis']
pos = self.controller.set_value(axis, position)
pos = self.controller.set_value(self.axis_name, position.value(self.axis_unit))

def move_rel(self, position):
position = self.check_bound(self.current_position + position) - self.current_position
self.target_value = position + self.current_position
def move_rel(self, position: DataActuator):
position = self.check_bound(self.current_value + position) - self.current_value
self.target_value = position + self.current_value
position = self.set_position_with_scaling(self.target_value)

axis = self.settings['multiaxes', 'axis']
pos = self.controller.set_value(axis, position)
pos = self.controller.set_value(self.axis_name, position.value(self.axis_unit))

def move_home(self):
"""
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from pymodaq.control_modules.move_utility_classes import DAQ_Move_base, main # base class
from pymodaq.control_modules.move_utility_classes import DAQ_Move_base, main, DataActuatorType, DataActuator # base class
from pymodaq.control_modules.move_utility_classes import comon_parameters_fun # common set of parameters for all actuators

from pymodaq.utils.daq_utils import ThreadCommand, getLineInfo # object used to send info back to the main thread
Expand All @@ -19,17 +19,20 @@ class DAQ_Move_MockComplexSignal(DAQ_Move_base):
_controller_units = ''
is_multiaxes = True
_axis_names = dict(zip(DataSignal.axes, list(range(len(DataSignal.axes)))))
_epsilon = 0.01
_epsilons = 0.01

params = [{'title': 'Tau (ms):', 'name': 'tau', 'type': 'int',
'value': DataSignal._tau * 1000, 'tip': 'Characteristic evolution time'},] + \
comon_parameters_fun(is_multiaxes, axes_names=_axis_names, epsilon=_epsilon)
comon_parameters_fun(axes_names=_axis_names, epsilon=_epsilons)
data_actuator_type = DataActuatorType.DataActuator

def ini_attributes(self):
self.controller: DataSignal = None

def get_actuator_value(self):
pos = self.controller.get_value(self.axis_name)
def get_actuator_value(self) -> DataActuator:
pos = DataActuator(self._title,
data=self.controller.get_value(self.axis_name),
units = self.axis_unit)
pos = self.get_position_with_scaling(pos)
return pos

Expand Down Expand Up @@ -65,25 +68,28 @@ def ini_stage(self, controller=None):
--------
daq_utils.ThreadCommand
"""
self.ini_stage_init(controller, DataSignal())
if self.settings['multiaxes', 'multi_status'] == "Master":
if self.is_master:
self.controller = DataSignal()
self.controller.ini_random_structures()
else:
self.controller = controller

info = "Mock MultiAxis"
initialized = True
return info, initialized

def move_abs(self, position):
def move_abs(self, position: DataActuator):
position = self.check_bound(position) #if user checked bounds, the defined bounds are applied here
self.target_value = position
position = self.set_position_with_scaling(position)
pos = self.controller.move_at(position, self.axis_name)
pos = self.controller.move_at(position.value(self.axis_unit), self.axis_name)

def move_rel(self, position):
position = self.check_bound(self.current_position + position) - self.current_position
self.target_value = position + self.current_position
position = self.check_bound(self.current_value + position) - self.current_value
self.target_value = position + self.current_value
position = self.set_position_with_scaling(self.target_value)

pos = self.controller.move_at(position, self.axis_name)
pos = self.controller.move_at(position.value(self.axis_unit), self.axis_name)

def move_home(self):
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,22 @@ class DAQ_Move_MockHeater(DAQ_Move_base):
"""
_controller_units = 'W'
is_multiaxes = True
stage_names = ['Heater']
_epsilon = 0.01
_axis_names = ['Heater']
_epsilons = 0.01

params = [] + comon_parameters_fun(is_multiaxes, stage_names, epsilon=_epsilon)
params = [] + comon_parameters_fun(axis_names=_axis_names, epsilon=_epsilons)
data_actuator_type = DataActuatorType.DataActuator

def ini_attributes(self):
self.controller: HeaterController = None


def get_actuator_value(self) -> DataActuator:
"""

"""
pos = DataActuator(self._title, data=self.controller.check_position())
pos = DataActuator(self._title,
data=self.controller.check_position(),
units=self.axis_unit)
pos = self.get_position_with_scaling(pos)
return pos

Expand Down
Loading
Loading