diff --git a/pyproject.toml b/pyproject.toml index 2ca9baa..e421a00 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,6 +16,7 @@ dependencies = [ "pymodaq_utils>=5.3.1", "pymodaq_gui>=5.3.0", "pymodaq_data>=5.3.0", + "pymodaq_plugins_utils>=5.3.4", #todo: list here all dependencies your package may have ] diff --git a/src/pymodaq_plugins_holoeye/hardware/mock_holoeye.py b/src/pymodaq_plugins_holoeye/hardware/mock_holoeye.py index 1140f33..af17321 100644 --- a/src/pymodaq_plugins_holoeye/hardware/mock_holoeye.py +++ b/src/pymodaq_plugins_holoeye/hardware/mock_holoeye.py @@ -19,6 +19,8 @@ def open(self): def errorString(self, error_code): return ErrorCode(error_code).name + pixelsize_um = 8. + @property def width_px(self) -> int: return 1024 diff --git a/src/pymodaq_plugins_holoeye/resources/daq_move_HoloeyeBase.py b/src/pymodaq_plugins_holoeye/resources/daq_move_HoloeyeBase.py index f5ea761..efe86db 100644 --- a/src/pymodaq_plugins_holoeye/resources/daq_move_HoloeyeBase.py +++ b/src/pymodaq_plugins_holoeye/resources/daq_move_HoloeyeBase.py @@ -17,6 +17,7 @@ from pymodaq_utils.logger import set_logger, get_module_name from pymodaq_utils.math_utils import wrap +from pymodaq_plugins_utils.hardware.shaper import ModulatorType, shaper_params, fill_shaper_settings from pymodaq_plugins_holoeye.hardware.sdk import SDK_CHOICES, NO_ERROR, get_slm_class logger = set_logger(get_module_name(__file__)) @@ -46,7 +47,7 @@ class DAQ_Move_HoloeyeBase(DAQ_Move_base): {'title': 'shaping options:', 'name': 'options', 'type': 'group', 'visible': True, 'children': []}, {'title': 'Input as grey:', 'name': 'input_as_grey_levels', 'type': 'bool', 'value': False}, - ] + ] + shaper_params() params = comon_shaping_params + comon_parameters_fun(is_multiaxes, _axis_names, epsilon=_epsilon) def ini_attributes(self): @@ -98,6 +99,10 @@ def ini_stage(self, controller=None): self.settings.child('info', 'width').setValue(data_width) self.settings.child('info', 'height').setValue(data_height) + pixel_size = float(self.controller.pixelsize_um) + # showPhasevalues / showPhaseData convert phase to grey levels inside the SDK + fill_shaper_settings(self.settings, 'Holoeye', data_width, data_height, pixel_size, + modulator_type=ModulatorType.PHASE, has_internal_calibration=True) self.current_position = DataActuator(data=[np.zeros(self.shape)]) diff --git a/tests/test_sdk_selection.py b/tests/test_sdk_selection.py index 94389dc..89401a6 100644 --- a/tests/test_sdk_selection.py +++ b/tests/test_sdk_selection.py @@ -148,6 +148,29 @@ def test_mock_plugin_still_works(qapp): plugin.close() +def _shaper(plugin): + from pymodaq_plugins_utils.hardware.shaper import Shaper, GEOMETRY_NAME, PROPERTIES_NAME + return Shaper.from_settings(plugin.settings.child(GEOMETRY_NAME), plugin.settings.child(PROPERTIES_NAME)) + + +def test_shaper_sdk4(qapp, fake_sdk4): + plugin = make_actuator(DAQ_Move_Holoeye, sdk='4') + shaper = _shaper(plugin) + assert shaper.shape == (6, 8) + assert shaper.pixel_size == 8. + assert shaper.has_internal_calibration and shaper.use_internal_calibration + plugin.close() + + +def test_shaper_mock(qapp): + plugin = make_actuator(DAQ_Move_HoloeyeMock) + shaper = _shaper(plugin) + assert shaper.shape == (768, 1024) + assert shaper.pixel_size == 8. + assert shaper.has_internal_calibration + plugin.close() + + def test_sdk4_folder_from_the_most_recent_variable(tmp_path): import json import os