diff --git a/src/pymodaq_plugins_template/daq_move_plugins/daq_move_Template.py b/src/pymodaq_plugins_template/daq_move_plugins/daq_move_Template.py index 26b4c84..3dafa38 100644 --- a/src/pymodaq_plugins_template/daq_move_plugins/daq_move_Template.py +++ b/src/pymodaq_plugins_template/daq_move_plugins/daq_move_Template.py @@ -69,8 +69,9 @@ def get_actuator_value(self): float: The position obtained after scaling conversion. """ ## TODO for your custom plugin - raise NotImplemented # when writing your own plugin remove this line - pos = DataActuator(data=self.controller.your_method_to_get_the_actuator_value()) # when writing your own plugin replace this line + raise NotImplementedError # when writing your own plugin remove this line + pos = DataActuator(data=self.controller.your_method_to_get_the_actuator_value(), # when writing your own plugin replace this line + units=self.axis_unit) pos = self.get_position_with_scaling(pos) return pos @@ -91,8 +92,10 @@ def user_condition_to_reach_target(self) -> bool: def close(self): """Terminate the communication protocol""" ## TODO for your custom plugin - raise NotImplemented # when writing your own plugin remove this line - # self.controller.your_method_to_terminate_the_communication() # when writing your own plugin replace this line + raise NotImplementedError # when writing your own plugin remove this line + if self.is_master: + # self.controller.your_method_to_terminate_the_communication() # when writing your own plugin replace this line + ... def commit_settings(self, param: Parameter): """Apply the consequences of a change of value in the detector settings @@ -128,16 +131,17 @@ def ini_stage(self, controller=None): initialized: bool False if initialization failed otherwise True """ - raise NotImplemented # TODO when writing your own plugin remove this line and modify the ones below - self.ini_stage_init(slave_controller=controller) # will be useful when controller is slave - + raise NotImplementedError # TODO when writing your own plugin remove this line and modify the ones below if self.is_master: # is needed when controller is master self.controller = PythonWrapperOfYourInstrument(arg1, arg2, ...) # arguments for instantiation!) + initialized = self.controller.a_method_or_atttribute_to_check_if_init() # todo # todo: enter here whatever is needed for your controller initialization and eventual # opening of the communication channel + else: + self.controller = controller + initialized = True info = "Whatever info you want to log" - initialized = self.controller.a_method_or_atttribute_to_check_if_init() # todo return info, initialized def move_abs(self, value: DataActuator): @@ -152,8 +156,8 @@ def move_abs(self, value: DataActuator): self.target_value = value value = self.set_position_with_scaling(value) # apply scaling if the user specified one ## TODO for your custom plugin - raise NotImplemented # when writing your own plugin remove this line - self.controller.your_method_to_set_an_absolute_value(value.value()) # when writing your own plugin replace this line + raise NotImplementedError # when writing your own plugin remove this line + self.controller.your_method_to_set_an_absolute_value(value.value(self.axis_unit)) # when writing your own plugin replace this line self.emit_status(ThreadCommand('Update_Status', ['Some info you want to log'])) def move_rel(self, value: DataActuator): @@ -168,25 +172,25 @@ def move_rel(self, value: DataActuator): value = self.set_position_relative_with_scaling(value) ## TODO for your custom plugin - raise NotImplemented # when writing your own plugin remove this line - self.controller.your_method_to_set_a_relative_value(value.value()) # when writing your own plugin replace this line + raise NotImplementedError # when writing your own plugin remove this line + self.controller.your_method_to_set_a_relative_value(value.value(self.axis_unit)) # when writing your own plugin replace this line self.emit_status(ThreadCommand('Update_Status', ['Some info you want to log'])) def move_home(self): """Call the reference method of the controller""" ## TODO for your custom plugin - raise NotImplemented # when writing your own plugin remove this line + raise NotImplementedError # when writing your own plugin remove this line self.controller.your_method_to_get_to_a_known_reference() # when writing your own plugin replace this line self.emit_status(ThreadCommand('Update_Status', ['Some info you want to log'])) def stop_motion(self): - """Stop the actuator and emits move_done signal""" + """Stop the actuator and emits move_done signal""" - ## TODO for your custom plugin - raise NotImplemented # when writing your own plugin remove this line - self.controller.your_method_to_stop_positioning() # when writing your own plugin replace this line - self.emit_status(ThreadCommand('Update_Status', ['Some info you want to log'])) + ## TODO for your custom plugin + raise NotImplementedError # when writing your own plugin remove this line + self.controller.your_method_to_stop_positioning() # when writing your own plugin replace this line + self.emit_status(ThreadCommand('Update_Status', ['Some info you want to log'])) if __name__ == '__main__': diff --git a/src/pymodaq_plugins_template/daq_viewer_plugins/plugins_0D/daq_0Dviewer_Template.py b/src/pymodaq_plugins_template/daq_viewer_plugins/plugins_0D/daq_0Dviewer_Template.py index 7ceb2ec..f75a38c 100644 --- a/src/pymodaq_plugins_template/daq_viewer_plugins/plugins_0D/daq_0Dviewer_Template.py +++ b/src/pymodaq_plugins_template/daq_viewer_plugins/plugins_0D/daq_0Dviewer_Template.py @@ -82,12 +82,14 @@ def ini_detector(self, controller=None): False if initialization failed otherwise True """ - raise NotImplemented # TODO when writing your own plugin remove this line and modify the one below - self.ini_detector_init(slave_controller=controller) - + raise NotImplementedError # TODO when writing your own plugin remove this line and modify the one below if self.is_master: self.controller = PythonWrapperOfYourInstrument() #instantiate you driver with whatever arguments are needed self.controller.open_communication() # call eventual methods + initialized = self.controller.a_method_or_atttribute_to_check_if_init() # TODO + else: + self.controller = controller + initialized = True # TODO for your custom plugin (optional) initialize viewers panel with the future type of data self.dte_signal_temp.emit(DataToExport(name='myplugin', @@ -97,14 +99,15 @@ def ini_detector(self, controller=None): labels=['Mock1', 'label2'])])) info = "Whatever info you want to log" - initialized = self.controller.a_method_or_atttribute_to_check_if_init() # TODO return info, initialized def close(self): """Terminate the communication protocol""" ## TODO for your custom plugin - raise NotImplemented # when writing your own plugin remove this line - # self.controller.your_method_to_terminate_the_communication() # when writing your own plugin replace this line + raise NotImplementedError # when writing your own plugin remove this line + if self.is_master: + # self.controller.your_method_to_terminate_the_communication() # when writing your own plugin replace this line + ... def grab_data(self, Naverage=1, **kwargs): """Start a grab from the detector @@ -120,7 +123,7 @@ def grab_data(self, Naverage=1, **kwargs): ## TODO for your custom plugin: you should choose EITHER the synchrone or the asynchrone version following # synchrone version (blocking function) - raise NotImplemented # when writing your own plugin remove this line + raise NotImplementedError # when writing your own plugin remove this line data_tot = self.controller.your_method_to_start_a_grab_snap() self.dte_signal.emit(DataToExport(name='myplugin', data=[DataFromPlugins(name='Mock1', data=data_tot, @@ -128,7 +131,7 @@ def grab_data(self, Naverage=1, **kwargs): ######################################################### # asynchrone version (non-blocking function with callback) - raise NotImplemented # when writing your own plugin remove this line + raise NotImplementedError # when writing your own plugin remove this line self.controller.your_method_to_start_a_grab_snap(self.callback) # when writing your own plugin replace this line ######################################################### @@ -143,7 +146,7 @@ def callback(self): def stop(self): """Stop the current grab hardware wise if necessary""" ## TODO for your custom plugin - raise NotImplemented # when writing your own plugin remove this line + raise NotImplementedError # when writing your own plugin remove this line self.controller.your_method_to_stop_acquisition() # when writing your own plugin replace this line self.emit_status(ThreadCommand('Update_Status', ['Some info you want to log'])) ############################## diff --git a/src/pymodaq_plugins_template/daq_viewer_plugins/plugins_1D/daq_1Dviewer_Template.py b/src/pymodaq_plugins_template/daq_viewer_plugins/plugins_1D/daq_1Dviewer_Template.py index f33aace..34b7a6c 100644 --- a/src/pymodaq_plugins_template/daq_viewer_plugins/plugins_1D/daq_1Dviewer_Template.py +++ b/src/pymodaq_plugins_template/daq_viewer_plugins/plugins_1D/daq_1Dviewer_Template.py @@ -87,12 +87,14 @@ def ini_detector(self, controller=None): False if initialization failed otherwise True """ - raise NotImplemented # TODO when writing your own plugin remove this line and modify the one below - self.ini_detector_init(slave_controller=controller) - + raise NotImplementedError # TODO when writing your own plugin remove this line and modify the one below if self.is_master: self.controller = PythonWrapperOfYourInstrument() #instantiate you driver with whatever arguments are needed self.controller.open_communication() # call eventual methods + initialized = self.controller.a_method_or_atttribute_to_check_if_init() # TODO + else: + self.controller = controller + initialized = True ## TODO for your custom plugin # get the x_axis (you may want to to this also in the commit settings if x_axis may have changed @@ -108,14 +110,15 @@ def ini_detector(self, controller=None): axes=[self.x_axis])])) info = "Whatever info you want to log" - initialized = True return info, initialized def close(self): """Terminate the communication protocol""" ## TODO for your custom plugin - raise NotImplemented # when writing your own plugin remove this line - # self.controller.your_method_to_terminate_the_communication() # when writing your own plugin replace this line + raise NotImplementedError # when writing your own plugin remove this line + if self.is_master: + # self.controller.your_method_to_terminate_the_communication() # when writing your own plugin replace this line + ... def grab_data(self, Naverage=1, **kwargs): """Start a grab from the detector @@ -152,7 +155,7 @@ def callback(self): def stop(self): """Stop the current grab hardware wise if necessary""" ## TODO for your custom plugin - raise NotImplemented # when writing your own plugin remove this line + raise NotImplementedError # when writing your own plugin remove this line self.controller.your_method_to_stop_acquisition() # when writing your own plugin replace this line self.emit_status(ThreadCommand('Update_Status', ['Some info you want to log'])) ############################## diff --git a/src/pymodaq_plugins_template/daq_viewer_plugins/plugins_2D/daq_2Dviewer_Template.py b/src/pymodaq_plugins_template/daq_viewer_plugins/plugins_2D/daq_2Dviewer_Template.py index 379629f..80419b0 100644 --- a/src/pymodaq_plugins_template/daq_viewer_plugins/plugins_2D/daq_2Dviewer_Template.py +++ b/src/pymodaq_plugins_template/daq_viewer_plugins/plugins_2D/daq_2Dviewer_Template.py @@ -82,12 +82,14 @@ def ini_detector(self, controller=None): initialized: bool False if initialization failed otherwise True """ - raise NotImplemented # TODO when writing your own plugin remove this line and modify the one below - self.ini_detector_init(slave_controller=controller) - + raise NotImplementedError # TODO when writing your own plugin remove this line and modify the one below if self.is_master: self.controller = PythonWrapperOfYourInstrument() #instantiate you driver with whatever arguments are needed self.controller.open_communication() # call eventual methods + initialized = self.controller.a_method_or_atttribute_to_check_if_init() # TODO + else: + self.controller = controller + initialized = True ## TODO for your custom plugin # get the x_axis (you may want to to this also in the commit settings if x_axis may have changed @@ -105,14 +107,15 @@ def ini_detector(self, controller=None): axes=[self.x_axis, self.y_axis]), ])) info = "Whatever info you want to log" - initialized = True return info, initialized def close(self): """Terminate the communication protocol""" ## TODO for your custom plugin - raise NotImplemented # when writing your own plugin remove this line - # self.controller.your_method_to_terminate_the_communication() # when writing your own plugin replace this line + raise NotImplementedError # when writing your own plugin remove this line + if self.is_master: + # self.controller.your_method_to_terminate_the_communication() # when writing your own plugin replace this line + ... def grab_data(self, Naverage=1, **kwargs): """Start a grab from the detector @@ -150,7 +153,7 @@ def callback(self): def stop(self): """Stop the current grab hardware wise if necessary""" ## TODO for your custom plugin - raise NotImplemented # when writing your own plugin remove this line + raise NotImplementedError # when writing your own plugin remove this line self.controller.your_method_to_stop_acquisition() # when writing your own plugin replace this line self.emit_status(ThreadCommand('Update_Status', ['Some info you want to log'])) ##############################