Skip to content

Commit 338cdcb

Browse files
committed
modified init and get_actuaror_value
1 parent 7fa8c17 commit 338cdcb

1 file changed

Lines changed: 10 additions & 33 deletions

File tree

src/pymodaq_plugins_teaching/daq_move_plugins/daq_move_MonoChromator.py

Lines changed: 10 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,10 @@
66
from pymodaq_utils.utils import ThreadCommand # object used to send info back to the main thread
77
from pymodaq_gui.parameter import Parameter
88

9-
# TODO:
10-
# Replace the following fake import with the import of the real Python wrapper of your instrument. Here we suppose that
11-
# the wrapper is in the hardware directory, but it could come from an external librairy like pylablib or pymeasure.
12-
from pymodaq_plugins_template.hardware.python_wrapper_file_of_your_instrument import PythonWrapperObjectOfYourInstrument
13-
14-
# TODO:
15-
# (1) change the name of the following class to DAQ_Move_TheNameOfYourChoice
16-
# (2) change the name of this file to daq_move_TheNameOfYourChoice ("TheNameOfYourChoice" should be the SAME
17-
# for the class name and the file name.)
18-
# (3) this file should then be put into the right folder, namely IN THE FOLDER OF THE PLUGIN YOU ARE DEVELOPING:
19-
# pymodaq_plugins_my_plugin/daq_move_plugins
20-
9+
from pymodaq_plugins_teaching.hardware.spectrometer import Spectrometer
2110

2211
class DAQ_Move_MonoChromator(DAQ_Move_base):
23-
12+
2413
""" Instrument plugin class for an actuator.
2514
2615
This object inherits all functionalities to communicate with PyMoDAQ’s DAQ_Move module through inheritance via
@@ -38,13 +27,11 @@ class DAQ_Move_MonoChromator(DAQ_Move_base):
3827
controller: object
3928
The particular object that allow the communication with the hardware, in general a python wrapper around the
4029
hardware library.
41-
42-
# TODO add your particular attributes here if any
4330
4431
"""
4532
is_multiaxes = False # TODO for your plugin set to True if this plugin is controlled for a multiaxis controller
46-
_axis_names: Union[List[str], Dict[str, int]] = ['Axis1', 'Axis2'] # TODO for your plugin: complete the list
47-
_controller_units: Union[str, List[str]] = 'mm' # TODO for your plugin: put the correct unit here, it could be
33+
_axis_names: Union[List[str], Dict[str, int]] = ['Wavelength'] # TODO for your plugin: complete the list
34+
_controller_units: Union[str, List[str]] = 'nm' # TODO for your plugin: put the correct unit here, it could be
4835
# TODO a single str (the same one is applied to all axes) or a list of str (as much as the number of axes)
4936
_epsilon: Union[float, List[float]] = 0.1 # TODO replace this by a value that is correct depending on your controller
5037
# TODO it could be a single float of a list of float (as much as the number of axes)
@@ -53,27 +40,20 @@ class DAQ_Move_MonoChromator(DAQ_Move_base):
5340

5441
params = [ # TODO for your custom plugin: elements to be added here as dicts in order to control your custom stage
5542
] + comon_parameters_fun(is_multiaxes, axis_names=_axis_names, epsilon=_epsilon)
56-
# _epsilon is the initial default value for the epsilon parameter allowing pymodaq to know if the controller reached
57-
# the target value. It is the developer responsibility to put here a meaningful value
5843

5944
def ini_attributes(self):
60-
# TODO declare the type of the wrapper (and assign it to self.controller) you're going to use for easy
61-
# autocompletion
62-
self.controller: PythonWrapperObjectOfYourInstrument = None
6345

64-
#TODO declare here attributes you want/need to init with a default value
65-
pass
46+
self.controller: Spectrometer = None
6647

67-
def get_actuator_value(self):
48+
def get_actuator_value(self) -> DataActuator:
6849
"""Get the current value from the hardware with scaling conversion.
6950
7051
Returns
7152
-------
7253
float: The position obtained after scaling conversion.
7354
"""
74-
## TODO for your custom plugin
75-
raise NotImplementedError # when writing your own plugin remove this line
76-
pos = DataActuator(data=self.controller.your_method_to_get_the_actuator_value(), # when writing your own plugin replace this line
55+
56+
pos = DataActuator(data=self.controller.get_wavelength(), # when writing your own plugin replace this line
7757
units=self.axis_unit)
7858
pos = self.get_position_with_scaling(pos)
7959
return pos
@@ -134,12 +114,9 @@ def ini_stage(self, controller=None):
134114
initialized: bool
135115
False if initialization failed otherwise True
136116
"""
137-
raise NotImplementedError # TODO when writing your own plugin remove this line and modify the ones below
138117
if self.is_master: # is needed when controller is master
139-
self.controller = PythonWrapperObjectOfYourInstrument(arg1, arg2, ...) # arguments for instantiation!)
140-
initialized = self.controller.a_method_or_atttribute_to_check_if_init() # todo
141-
# todo: enter here whatever is needed for your controller initialization and eventual
142-
# opening of the communication channel
118+
self.controller = Spectrometer()
119+
initialized = self.controller.open_communication()
143120
else:
144121
self.controller = controller
145122
initialized = True

0 commit comments

Comments
 (0)