Skip to content

Commit bd924e1

Browse files
committed
adding tau setting
1 parent 3e554ca commit bd924e1

1 file changed

Lines changed: 10 additions & 13 deletions

File tree

src/pymodaq_plugins_teaching/daq_move_plugins/daq_move_Monochromator.py

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,10 @@ class DAQ_Move_Monochromator(DAQ_Move_base):
3838
data_actuator_type = DataActuatorType.DataActuator # wether you use the new data style for actuator otherwise set this
3939
# as DataActuatorType.float (or entirely remove the line)
4040

41-
params = [ # TODO for your custom plugin: elements to be added here as dicts in order to control your custom stage
42-
] + comon_parameters_fun(is_multiaxes, axis_names=_axis_names, epsilon=_epsilon)
41+
params = [{'title': 'Tau (ms)', 'name': 'tau', 'type': 'float', 'value': 1234.,
42+
'suffix': 'ms', 'visible': True, 'readonly': False},
43+
44+
] + comon_parameters_fun(is_multiaxes, axis_names=_axis_names, epsilon=_epsilon)
4345
# _epsilon is the initial default value for the epsilon parameter allowing pymodaq to know if the controller reached
4446
# the target value. It is the developer responsibility to put here a meaningful value
4547

@@ -91,14 +93,8 @@ def commit_settings(self, param: Parameter):
9193
A given parameter (within detector_settings) whose value has been changed by the user
9294
"""
9395
## TODO for your custom plugin
94-
if param.name() == 'axis':
95-
self.axis_unit = self.controller.your_method_to_get_correct_axis_unit()
96-
# do this only if you can and if the units are not known beforehand, for instance
97-
# if the motors connected to the controller are of different type (mm, µm, nm, , etc...)
98-
# see BrushlessDCMotor from the thorlabs plugin for an exemple
99-
100-
elif param.name() == "a_parameter_you've_added_in_self.params":
101-
self.controller.your_method_to_apply_this_param_change()
96+
if param.name() == 'tau':
97+
self.controller.tau = param.value() / 1000
10298
else:
10399
pass
104100

@@ -119,12 +115,13 @@ def ini_stage(self, controller=None):
119115
if self.is_master: # is needed when controller is master
120116
self.controller = Spectrometer()
121117
initialized = self.controller.open_communication() # todo
122-
# todo: enter here whatever is needed for your controller initialization and eventual
123-
# opening of the communication channel
124118
else:
125119
self.controller = controller
126120
initialized = True
127121

122+
if initialized:
123+
self.settings.child('tau').setValue(self.controller.tau * 1000)
124+
128125
info = "Whatever info you want to log"
129126
return info, initialized
130127

@@ -164,4 +161,4 @@ def stop_motion(self):
164161
self.controller.stop()
165162

166163
if __name__ == '__main__':
167-
main(__file__)
164+
main(__file__, init=False)

0 commit comments

Comments
 (0)