From 0858818b4e2522aa3cb1d9c49e765132efc3b7d3 Mon Sep 17 00:00:00 2001 From: Alejandro van Breukelen Garcia Date: Tue, 21 Apr 2026 18:21:13 +0200 Subject: [PATCH 1/8] Commit Ip-address change --- .../resources/config_template.toml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/pymodaq_plugins_redpitaya/resources/config_template.toml b/src/pymodaq_plugins_redpitaya/resources/config_template.toml index 7a57237..5c0f576 100644 --- a/src/pymodaq_plugins_redpitaya/resources/config_template.toml +++ b/src/pymodaq_plugins_redpitaya/resources/config_template.toml @@ -1,11 +1,13 @@ -title = 'this is the configuration file of the redpitaya plugin' +title = 'this is the configuration file of the redpitaya plugin !!!!!!' -ip_address = '10.42.0.77' +ip_address = '169.254.121.34' port = 5000 [sampling] decimation = 8 nsamples = 2000 +gain1 = 'HV' +gain2 = 'HV' [trigger] source = 'CH1_PE' # choose in ['DISABLED', 'NOW', 'CH1_PE', 'CH1_NE', 'CH2_PE', 'CH2_NE', 'EXT_PE', 'EXT_NE', 'AWG_PE', 'AWG_NE'] @@ -15,12 +17,12 @@ center_trigger = true [generator] gen_trigger = 'INT' enabling = false -amplitude = 0.1 #in V # default 1 -frequency = 1000 # in Hz +amplitude = 1 #in V # default 1 +frequency = 1000000 # in Hz shape = 'SINE' offset = 0 # in V phase = 0 # in degrees -cycle = 0.5 # in % +cycle = 0.5 # in fraction (1 = 100%) channel = 1 [sweep] From ff9b36550fd11aa0583d707b189f11d94f31b00e Mon Sep 17 00:00:00 2001 From: Alejandro van Breukelen Garcia Date: Tue, 21 Apr 2026 18:23:54 +0200 Subject: [PATCH 2/8] Commit first changes (Gain 1 and 2 and first tries with Move) --- .../daq_move_RedpitayaSCPI.py | 8 +++++--- .../plugins_1D/daq_1Dviewer_RedPitayaSCPI.py | 20 +++++++++++++++---- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/src/pymodaq_plugins_redpitaya/daq_move_plugins/daq_move_RedpitayaSCPI.py b/src/pymodaq_plugins_redpitaya/daq_move_plugins/daq_move_RedpitayaSCPI.py index 592a5b6..cd6baa9 100644 --- a/src/pymodaq_plugins_redpitaya/daq_move_plugins/daq_move_RedpitayaSCPI.py +++ b/src/pymodaq_plugins_redpitaya/daq_move_plugins/daq_move_RedpitayaSCPI.py @@ -50,7 +50,8 @@ class DAQ_Move_RedpitayaSCPI(DAQ_Move_base): is_multiaxes = True _axis_names: Union[List[str], Dict[str, int]] = ['amplitude', 'frequency'] _controller_units: Union[str, List[str]] = ['V','Hz'] - _epsilon: Union[float, List[float]] = 0.1 # Detailing 1mV and 1Hz #TODO replace this by a value that is correct depending on your controller + _epsilon: Union[float, List[float]] = [0.005,1] # Detailing 5mV and 1Hz. Resolution of reading is 5mV + # _epsilon: Union[float, List[float]] = 0.1 # Detailing 1mV and 1Hz #TODO replace this by a value that is correct depending on your controller # TODO it could be a single float of a list of float (as much as the number of axes) data_actuator_type = DataActuatorType.DataActuator @@ -181,7 +182,8 @@ def ini_stage(self, controller=None): """ if self.is_master: # is needed when controller is master - self.controller = RedPitayaScpi(ip_address=plugin_config('ip_address')) # arguments for instantiation!) + self.controller = RedPitayaScpi(ip_address=self.settings['ip_address']) # arguments for instantiation!) + # self.controller = RedPitayaScpi(ip_address=plugin_config('ip_address')) # arguments for instantiation!) else: self.controller = controller @@ -232,4 +234,4 @@ def stop_motion(self): if __name__ == '__main__': - main(__file__) + main(__file__, init=False) diff --git a/src/pymodaq_plugins_redpitaya/daq_viewer_plugins/plugins_1D/daq_1Dviewer_RedPitayaSCPI.py b/src/pymodaq_plugins_redpitaya/daq_viewer_plugins/plugins_1D/daq_1Dviewer_RedPitayaSCPI.py index 2fbc794..1089edf 100644 --- a/src/pymodaq_plugins_redpitaya/daq_viewer_plugins/plugins_1D/daq_1Dviewer_RedPitayaSCPI.py +++ b/src/pymodaq_plugins_redpitaya/daq_viewer_plugins/plugins_1D/daq_1Dviewer_RedPitayaSCPI.py @@ -8,8 +8,7 @@ from pymodaq.utils.parameter import Parameter from pymodaq_plugins_redpitaya.utils import Config -from pymeasure.instruments.redpitaya.redpitaya_scpi import RedPitayaScpi - +from pymeasure.instruments.redpitaya.redpitaya_scpi import RedPitayaScpi, AnalogInputFastChannel class DAQ_1DViewer_RedPitayaSCPI(DAQ_Viewer_base): """ Instrument plugin class for a 1D viewer. @@ -47,8 +46,12 @@ class DAQ_1DViewer_RedPitayaSCPI(DAQ_Viewer_base): {'title': 'Buffer Length:', 'name': 'buffer_length', 'type': 'int', 'readonly': True}, {'title': 'Window Length:', 'name': 'window_length', 'type': 'float', 'value': 0, 'siPrefix': True, 'suffix': 's', 'readonly': True}, + {'title': 'Gain1 (jumper CH1):', 'name': 'gain1', 'type': 'list', + 'limits': RedPitayaScpi.GAINS, 'value': plugin_config('sampling', 'gain1')}, + {'title': 'Gain2 (jumper CH2):', 'name': 'gain2', 'type': 'list', + 'limits': RedPitayaScpi.GAINS, 'value': plugin_config('sampling', 'gain2')}, - ]}, + ]}, {'title': 'Triggering:', 'name': 'triggering', 'type': 'group', 'children': [ {'title': 'Source:', 'name': 'trigger_source', 'type': 'list', 'limits': RedPitayaScpi.TRIGGER_SOURCES, 'value': plugin_config('trigger', 'source')}, @@ -95,6 +98,11 @@ def commit_settings(self, param: Parameter): elif param.name() == 'trigger_source': self.controller.acq_trigger_source = param.value() + elif param.name() == 'gain1': + self.controller.acq_gain1 = param.value() + elif param.name() == 'gain2': + self.controller.acq_gain2 = param.value() + def _center_trigger(self): if self.settings['triggering', 'center_trigger']: self.controller.acq_trigger_delay_samples = \ @@ -134,8 +142,12 @@ def ini_detector(self, controller=None): self.controller.acq_format = 'ASCII' self.controller.acq_units = 'VOLTS' + self.controller.acq_gain1 = self.settings['sampling', 'gain1'] + self.controller.acq_gain2 = self.settings['sampling', 'gain2'] + self.controller.acq_trigger_level = self.settings['triggering', 'level'] + self.controller.decimation = self.settings['sampling', 'decimation'] self.controller.decimation = self.settings['sampling', 'decimation'] self.controller.average_skipped_samples = self.settings['sampling', 'average'] self.settings.child('sampling', 'buffer_length').setValue(self.controller.buffer_length) @@ -160,7 +172,7 @@ def grab_data(self, Naverage=1, **kwargs): ---------- Naverage: int Number of hardware averaging (if hardware averaging is possible, self.hardware_averaging should be set to - True in class preamble and you should code this implementation) + True in class preamble, and you should code this implementation) kwargs: dict others optionals arguments """ From f2a184a2b77f369b73dd0ecd96e853d64d5b34f5 Mon Sep 17 00:00:00 2001 From: Alejandro van Breukelen Garcia Date: Thu, 30 Apr 2026 16:54:58 +0200 Subject: [PATCH 3/8] Commit changes on DAQ_move for it to regenerate signal when changing both amplitude and frequency --- .../daq_move_plugins/daq_move_RedpitayaSCPI.py | 17 ++++++++++++----- .../plugins_1D/daq_1Dviewer_RedPitayaSCPI.py | 4 ++-- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/pymodaq_plugins_redpitaya/daq_move_plugins/daq_move_RedpitayaSCPI.py b/src/pymodaq_plugins_redpitaya/daq_move_plugins/daq_move_RedpitayaSCPI.py index cd6baa9..c5ac87f 100644 --- a/src/pymodaq_plugins_redpitaya/daq_move_plugins/daq_move_RedpitayaSCPI.py +++ b/src/pymodaq_plugins_redpitaya/daq_move_plugins/daq_move_RedpitayaSCPI.py @@ -23,7 +23,7 @@ class DAQ_Move_RedpitayaSCPI(DAQ_Move_base): Python wrapper of a particular instrument. * Should be compatible with all redpitaya flavours using the SCPI communication protocol - * Tested with Red Pitaya 2.00-37 OS | STEMlab 125-14 + * Tested with Red Pitaya 2.00-37 OS | STEMlab 125-14 Pro (Gen 2) version * PyMoDAQ >= 5.0.5 * Tested with Linux Ubuntu 24.04.1 LTS * Installation instruction: @@ -59,6 +59,7 @@ class DAQ_Move_RedpitayaSCPI(DAQ_Move_base): 'value': plugin_config('ip_address')}, {'title': 'Port:', 'name': 'port', 'type': 'int', 'value': plugin_config('port')}, {'title': 'Board name:', 'name': 'bname', 'type': 'str', 'readonly': True}, + {'title': 'Channel', 'name': 'channel', 'type': 'list', 'limits':{'1': 1, '2': 2}, 'value': plugin_config('generator', 'channel')}, @@ -130,7 +131,7 @@ def commit_settings(self, param: Parameter): self.settings.child('bounds', 'max_bound').setValue(50e6) elif param.value == 'amplitude': self.settings.child('bounds', 'min_bound').setValue(0) - self.settings.child('bounds', 'max_bound').setValue(1) + self.settings.child('bounds', 'max_bound').setValue(2) self.settings.child('bounds', 'is_bounds').value() self.settings.child('bounds', 'is_bounds').setValue(True) @@ -156,6 +157,9 @@ def commit_settings(self, param: Parameter): self.aout.sweep_state = param.value() elif param.name() == 'sweep_direction': self.aout.sweep_direction = param.value() + elif param.name() == 'gen_trigger': + self.aout.gen_trigger_source = param.value() + # TODO implement trigger source setting correctly def is_enabled(self) -> bool: "It defines if the supply voltage is enabled on the output channel chosen" @@ -192,7 +196,7 @@ def ini_stage(self, controller=None): self.settings.child('bounds', 'is_bounds').setOpts(readonly=True) self.aout.enable = True - self.aout.run() + self.aout.run() # TODO change this function to work with other trigger sources than INTernal trigger info = "Whatever info you want to log" initialized = True @@ -210,8 +214,11 @@ def move_abs(self, value: DataActuator): value = self.check_bound(value) #if user checked bounds, the defined bounds are applied here self.target_value = value value = self.set_position_with_scaling(value) # apply scaling if the user specified one - - setattr(self.controller.analog_out[self.settings['channel']], self.axis_name, value.value(self.axis_unit)) + print("axis name: ",self.axis_name) + print("axis value: ",value) + setattr(self.aout, self.axis_name, value.value(self.axis_unit)) + self.aout.run() # regenerates trigger, otherwise it will continue to generate on the passed settings + # TODO change this function to work with other trigger sources than INTernal trigger def move_rel(self, value: DataActuator): """ Move the actuator to the relative target actuator value defined by value diff --git a/src/pymodaq_plugins_redpitaya/daq_viewer_plugins/plugins_1D/daq_1Dviewer_RedPitayaSCPI.py b/src/pymodaq_plugins_redpitaya/daq_viewer_plugins/plugins_1D/daq_1Dviewer_RedPitayaSCPI.py index 1089edf..b5112c1 100644 --- a/src/pymodaq_plugins_redpitaya/daq_viewer_plugins/plugins_1D/daq_1Dviewer_RedPitayaSCPI.py +++ b/src/pymodaq_plugins_redpitaya/daq_viewer_plugins/plugins_1D/daq_1Dviewer_RedPitayaSCPI.py @@ -18,7 +18,7 @@ class DAQ_1DViewer_RedPitayaSCPI(DAQ_Viewer_base): Python wrapper of a particular instrument. * Should be compatible with all redpitaya flavour using the SCPI communication protocol - * Tested with the STEMlab 125-14 version + * Tested with the STEMlab 125-14 Pro (Gen 2) version * PyMoDAQ >= 4.1.0 Attributes: @@ -208,7 +208,7 @@ def grab_data(self, Naverage=1, **kwargs): size=nsamples) self.dte_signal.emit(DataToExport('Redpitaya_dte', data=[DataFromPlugins(name='RedPitaya', data=data_list, - dim='Data1D', labels=['AI0', 'AI1'], + dim='Data1D', labels=['IN1', 'IN2'], axes=[axis])])) def stop(self): From 34f6aaf7286a87bc536720f3d9e8104981e8225c Mon Sep 17 00:00:00 2001 From: Avanbreukeleng Date: Thu, 1 Oct 2026 13:46:15 +0200 Subject: [PATCH 4/8] Daqmove analog slow without the conversion factor --- .../daq_move_RedpitayaAnalogSlow.py | 187 ++++++++++++++++++ 1 file changed, 187 insertions(+) create mode 100644 src/pymodaq_plugins_redpitaya/daq_move_plugins/daq_move_RedpitayaAnalogSlow.py diff --git a/src/pymodaq_plugins_redpitaya/daq_move_plugins/daq_move_RedpitayaAnalogSlow.py b/src/pymodaq_plugins_redpitaya/daq_move_plugins/daq_move_RedpitayaAnalogSlow.py new file mode 100644 index 0000000..cbfbf54 --- /dev/null +++ b/src/pymodaq_plugins_redpitaya/daq_move_plugins/daq_move_RedpitayaAnalogSlow.py @@ -0,0 +1,187 @@ + +from typing import Union, List, Dict +from pymodaq.control_modules.move_utility_classes import (DAQ_Move_base, comon_parameters_fun, + main, DataActuatorType, DataActuator) + +from pymodaq_utils.utils import ThreadCommand # object used to send info back to the main thread + +from pymodaq_gui.parameter import Parameter + +from pymeasure.instruments.redpitaya.redpitaya_scpi import RedPitayaScpi, AnalogOutputFastChannel + +from pymodaq_data import Q_ + +from pymodaq_plugins_redpitaya.utils import Config + +plugin_config = Config() + +class DAQ_Move_RedpitayaAnalogSlow(DAQ_Move_base): + """ Instrument plugin class for Red Pitaya + + This object inherits all functionalities to communicate with PyMoDAQ’s DAQ_Move module through + inheritance via DAQ_Move_base. It makes a bridge between the DAQ_Move module and the + Python wrapper of a particular instrument. + + * Should be compatible with all redpitaya flavours using the SCPI communication protocol + * Tested with Red Pitaya 2.00-37 OS | STEMlab 125-14 Pro (Gen 2) version + * PyMoDAQ >= 5.0.5 + * Tested with Linux Ubuntu 24.04.1 LTS + * Installation instruction: + These instructions are valid when using an Ethernet cable to communicate with the Red Pitaya. + The instrument is accessed using a TCP/IP Socket communication adapter, in the form: “TCPIP::x.y.z.k::port::SOCKET” + - x.y.z.k is the IP address of the SCPI server (that should be activated on the board) + - port is the TCP/IP port number, usually 5000 + To activate the use of the Red Pitaya: + 1. Connect the redpitaya to your computer/network with an ethernet cable. + 2. Enter the url address written on the network plug (on the Red Pitaya) + It should be something like “RP-F0B462.LOCAL/” + 3. Browse the menu, open the System application then the Network manager application + Look at the ip_address, and modify the config_template + 4. Return to the menu, open the Development application and activate the SCPI server. + 5. You can now run daq_move_RedpiatayaSCPI.py + + Attributes: + ----------- + controller: object + The particular object that allow the communication with the hardware, in general a python wrapper around the + hardware library. + """ + + is_multiaxes = True + _axis_names: Union[List[str], Dict[str, int]] = ['voltage'] + _controller_units: Union[str, List[str]] = ['V'] + _epsilon: Union[float, List[float]] = [0.128] # Detailing 5mV and 1Hz. Resolution of reading is 5mV + # _epsilon: Union[float, List[float]] = 0.1 # Detailing 1mV and 1Hz #TODO replace this by a value that is correct depending on your controller + # TODO it could be a single float of a list of float (as much as the number of axes) + data_actuator_type = DataActuatorType.DataActuator + + params = [ {'title': 'IP Address:', 'name': 'ip_address', 'type': 'str', + 'value': plugin_config('ip_address')}, + {'title': 'Port:', 'name': 'port', 'type': 'int', 'value': plugin_config('port')}, + {'title': 'Board name:', 'name': 'bname', 'type': 'str', 'readonly': True}, + + {'title': 'Channel', 'name': 'channel', 'type': 'list', 'limits':{'0': 0, '1': 1, '2': 2, '3': 3}, + 'value': plugin_config('generator_slow', 'channel')}, + + ] + comon_parameters_fun(is_multiaxes, axis_names=_axis_names, epsilon=_epsilon) + # _epsilon is the initial default value for the epsilon parameter allowing pymodaq to know if the controller reached + # the target value. It is the developer responsibility to put here a meaningful value + + def ini_attributes(self): + self.controller: RedPitayaScpi = None + self.target_value = 0 + # self.conv_factor = 50e-6 + # self.scale = True + pass + + def get_actuator_value(self): + """Get the current value from the hardware with scaling conversion. + + Returns + ------- + float: The position obtained after scaling conversion. + """ + return self.target_value + + + def close(self): + """Terminate the communication protocol""" + self.aout_slow.reset() + + + def commit_settings(self, param: Parameter): + """Apply the consequences of a change of value in the detector settings + + Parameters + ---------- + param: Parameter + A given parameter (within detector_settings) whose value has been changed by the user + """ + if param.name() == 'axis': + if param.value == 'voltage': + self.settings.child('bounds', 'min_bound').setValue(0) + self.settings.child('bounds', 'max_bound').setValue(1.8) + + self.settings.child('bounds', 'is_bounds').value() + self.settings.child('bounds', 'is_bounds').setValue(True) + + + # def is_enabled(self) -> bool: + # "It defines if the supply voltage is enabled on the output channel chosen" + # return self.settings['enable'] == True + + @property + def aout_slow(self): + """ It defines what output channel the user chose""" + return self.controller.analog_out_slow[self.settings['channel']] + + def ini_stage(self, controller=None): + """Actuator communication initialization + + Parameters + ---------- + controller: (object) + custom object of a PyMoDAQ plugin (Slave case). None if only one actuator by controller (Master case) + + Returns + ------- + info: str + initialized: bool + False if initialization failed otherwise True + """ + + if self.is_master: # is needed when controller is master + self.controller = RedPitayaScpi(ip_address=self.settings['ip_address']) # arguments for instantiation!) + # self.controller = RedPitayaScpi(ip_address=plugin_config('ip_address')) # arguments for instantiation!) + else: + self.controller = controller + + if self.axis_name == 'voltage': + self.settings.child('bounds', 'min_bound').setValue(0) + self.settings.child('bounds', 'max_bound').setValue(1.8) + self.settings.child('bounds', 'is_bounds').value() + self.settings.child('bounds', 'is_bounds').setValue(True) + self.settings.child('bounds', 'is_bounds').setOpts(readonly=True) + + + info = "Whatever info you want to log" + initialized = True + return info, initialized + + def move_abs(self, value: DataActuator): + """ Move the actuator to the absolute target defined by value + + Parameters + ---------- + value: (float) value of the absolute target positioning + """ + value = self.check_bound(value) #if user checked bounds, the defined bounds are applied here + self.target_value = value + print(value) + value = self.set_position_with_scaling(value) # TODO apply scaling if the user specified one + print(self.axis_unit) + setattr(self.aout_slow, self.axis_name, value.value(self.axis_unit)) + # TODO change this run command to work with other trigger sources than INTernal trigger + + def move_rel(self, value: DataActuator): + """ Move the actuator to the relative target actuator value defined by value + + Parameters + ---------- + 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 + self.move_abs(self.target_value) + + def move_home(self): + """Call the reference method of the controller""" + pass + + def stop_motion(self): + """Stop the actuator and emits move_done signal""" + pass + + +if __name__ == '__main__': + main(__file__, init=False) \ No newline at end of file From 99c5ddba4a55308fe3388de0da7f9eba4e33ccb6 Mon Sep 17 00:00:00 2001 From: Alejandro van Breukelen Garcia Date: Fri, 2 Oct 2026 15:33:16 +0200 Subject: [PATCH 5/8] Adjust to go with pymeasure and be able to get actuator value as well as set. --- .../daq_move_plugins/daq_move_RedpitayaAnalogSlow.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/pymodaq_plugins_redpitaya/daq_move_plugins/daq_move_RedpitayaAnalogSlow.py b/src/pymodaq_plugins_redpitaya/daq_move_plugins/daq_move_RedpitayaAnalogSlow.py index cbfbf54..6f4c1b4 100644 --- a/src/pymodaq_plugins_redpitaya/daq_move_plugins/daq_move_RedpitayaAnalogSlow.py +++ b/src/pymodaq_plugins_redpitaya/daq_move_plugins/daq_move_RedpitayaAnalogSlow.py @@ -81,7 +81,11 @@ def get_actuator_value(self): ------- float: The position obtained after scaling conversion. """ - return self.target_value + + pos = DataActuator(data=getattr(self.aout_slow, self.axis_name), + units=self.axis_unit) + pos = self.get_position_with_scaling(pos) + return pos def close(self): @@ -141,7 +145,7 @@ def ini_stage(self, controller=None): self.settings.child('bounds', 'max_bound').setValue(1.8) self.settings.child('bounds', 'is_bounds').value() self.settings.child('bounds', 'is_bounds').setValue(True) - self.settings.child('bounds', 'is_bounds').setOpts(readonly=True) + # self.settings.child('bounds', 'is_bounds').setOpts(readonly=True) info = "Whatever info you want to log" From 6737059d5660942bc04de91bd9003a5d1380800f Mon Sep 17 00:00:00 2001 From: Alejandro van Breukelen Garcia Date: Fri, 2 Oct 2026 15:48:16 +0200 Subject: [PATCH 6/8] Correct Bounds --- .../daq_move_plugins/daq_move_RedpitayaAnalogSlow.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/pymodaq_plugins_redpitaya/daq_move_plugins/daq_move_RedpitayaAnalogSlow.py b/src/pymodaq_plugins_redpitaya/daq_move_plugins/daq_move_RedpitayaAnalogSlow.py index 6f4c1b4..35e5b28 100644 --- a/src/pymodaq_plugins_redpitaya/daq_move_plugins/daq_move_RedpitayaAnalogSlow.py +++ b/src/pymodaq_plugins_redpitaya/daq_move_plugins/daq_move_RedpitayaAnalogSlow.py @@ -103,10 +103,9 @@ def commit_settings(self, param: Parameter): """ if param.name() == 'axis': if param.value == 'voltage': + # self.settings.child('bounds', 'is_bounds').value() self.settings.child('bounds', 'min_bound').setValue(0) self.settings.child('bounds', 'max_bound').setValue(1.8) - - self.settings.child('bounds', 'is_bounds').value() self.settings.child('bounds', 'is_bounds').setValue(True) @@ -140,14 +139,12 @@ def ini_stage(self, controller=None): else: self.controller = controller - if self.axis_name == 'voltage': - self.settings.child('bounds', 'min_bound').setValue(0) - self.settings.child('bounds', 'max_bound').setValue(1.8) + self.settings.child('bounds', 'min_bound').setValue(0) + self.settings.child('bounds', 'max_bound').setValue(1.8) self.settings.child('bounds', 'is_bounds').value() self.settings.child('bounds', 'is_bounds').setValue(True) # self.settings.child('bounds', 'is_bounds').setOpts(readonly=True) - info = "Whatever info you want to log" initialized = True return info, initialized From b359bb6ef51235bfadda76e47e2bec6b307805b3 Mon Sep 17 00:00:00 2001 From: Avanbreukeleng Date: Mon, 5 Oct 2026 14:15:16 +0200 Subject: [PATCH 7/8] Add parameter Board generation: gen 1 or gen 2 --- .../daq_move_RedpitayaSCPI.py | 24 ++++++++++++++----- .../resources/config_template.toml | 1 + 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/pymodaq_plugins_redpitaya/daq_move_plugins/daq_move_RedpitayaSCPI.py b/src/pymodaq_plugins_redpitaya/daq_move_plugins/daq_move_RedpitayaSCPI.py index c5ac87f..9150b87 100644 --- a/src/pymodaq_plugins_redpitaya/daq_move_plugins/daq_move_RedpitayaSCPI.py +++ b/src/pymodaq_plugins_redpitaya/daq_move_plugins/daq_move_RedpitayaSCPI.py @@ -50,7 +50,7 @@ class DAQ_Move_RedpitayaSCPI(DAQ_Move_base): is_multiaxes = True _axis_names: Union[List[str], Dict[str, int]] = ['amplitude', 'frequency'] _controller_units: Union[str, List[str]] = ['V','Hz'] - _epsilon: Union[float, List[float]] = [0.005,1] # Detailing 5mV and 1Hz. Resolution of reading is 5mV + _epsilon: Union[float, List[float]] = [0.005, 1] # Detailing 5mV and 1Hz. Resolution of reading is 5mV # _epsilon: Union[float, List[float]] = 0.1 # Detailing 1mV and 1Hz #TODO replace this by a value that is correct depending on your controller # TODO it could be a single float of a list of float (as much as the number of axes) data_actuator_type = DataActuatorType.DataActuator @@ -60,6 +60,9 @@ class DAQ_Move_RedpitayaSCPI(DAQ_Move_base): {'title': 'Port:', 'name': 'port', 'type': 'int', 'value': plugin_config('port')}, {'title': 'Board name:', 'name': 'bname', 'type': 'str', 'readonly': True}, + {'title': 'Board Generation', 'name': 'gen', 'type': 'list', 'limits': {'Original': 1, 'Gen 2': 2}, + 'value': plugin_config('generation')}, + {'title': 'Channel', 'name': 'channel', 'type': 'list', 'limits':{'1': 1, '2': 2}, 'value': plugin_config('generator', 'channel')}, @@ -131,10 +134,14 @@ def commit_settings(self, param: Parameter): self.settings.child('bounds', 'max_bound').setValue(50e6) elif param.value == 'amplitude': self.settings.child('bounds', 'min_bound').setValue(0) - self.settings.child('bounds', 'max_bound').setValue(2) - + self.settings.child('bounds', 'max_bound').setValue(self.settings['generation']) self.settings.child('bounds', 'is_bounds').value() self.settings.child('bounds', 'is_bounds').setValue(True) + + elif param.name() == 'generation': + if self.axis_name == 'amplitude': + self.settings.child('bounds', 'min_bound').setValue(0) + self.settings.child('bounds', 'max_bound').setValue(param.value()) elif param.name() == 'enable': self.aout.enable = param.value() elif param.name() == 'shape': @@ -187,12 +194,19 @@ def ini_stage(self, controller=None): if self.is_master: # is needed when controller is master self.controller = RedPitayaScpi(ip_address=self.settings['ip_address']) # arguments for instantiation!) - # self.controller = RedPitayaScpi(ip_address=plugin_config('ip_address')) # arguments for instantiation!) else: self.controller = controller self.aout.shape = self.settings['shape'] #plugin_config('generator', 'shape') + if self.settings['axis'] =='frequency': + self.settings.child('bounds', 'min_bound').setValue(1e-6) + self.settings.child('bounds', 'max_bound').setValue(50e6) + elif self.settings['axis'] == 'amplitude': + self.settings.child('bounds', 'min_bound').setValue(0) + self.settings.child('bounds', 'max_bound').setValue(self.settings['generation']) + self.settings.child('bounds', 'is_bounds').value() + self.settings.child('bounds', 'is_bounds').setValue(True) self.settings.child('bounds', 'is_bounds').setOpts(readonly=True) self.aout.enable = True @@ -214,8 +228,6 @@ def move_abs(self, value: DataActuator): value = self.check_bound(value) #if user checked bounds, the defined bounds are applied here self.target_value = value value = self.set_position_with_scaling(value) # apply scaling if the user specified one - print("axis name: ",self.axis_name) - print("axis value: ",value) setattr(self.aout, self.axis_name, value.value(self.axis_unit)) self.aout.run() # regenerates trigger, otherwise it will continue to generate on the passed settings # TODO change this function to work with other trigger sources than INTernal trigger diff --git a/src/pymodaq_plugins_redpitaya/resources/config_template.toml b/src/pymodaq_plugins_redpitaya/resources/config_template.toml index 5c0f576..10e3e0f 100644 --- a/src/pymodaq_plugins_redpitaya/resources/config_template.toml +++ b/src/pymodaq_plugins_redpitaya/resources/config_template.toml @@ -2,6 +2,7 @@ title = 'this is the configuration file of the redpitaya plugin !!!!!!' ip_address = '169.254.121.34' port = 5000 +generation = 2 [sampling] decimation = 8 From 5840cfcdd838b61dbb087a9ad03e91df1cdf8f02 Mon Sep 17 00:00:00 2001 From: Alejandro van Breukelen Garcia Date: Fri, 16 Oct 2026 12:26:26 +0200 Subject: [PATCH 8/8] Debug and correct Gen 1/2 choice --- .../daq_move_plugins/daq_move_RedpitayaSCPI.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/pymodaq_plugins_redpitaya/daq_move_plugins/daq_move_RedpitayaSCPI.py b/src/pymodaq_plugins_redpitaya/daq_move_plugins/daq_move_RedpitayaSCPI.py index 9150b87..f887631 100644 --- a/src/pymodaq_plugins_redpitaya/daq_move_plugins/daq_move_RedpitayaSCPI.py +++ b/src/pymodaq_plugins_redpitaya/daq_move_plugins/daq_move_RedpitayaSCPI.py @@ -134,11 +134,11 @@ def commit_settings(self, param: Parameter): self.settings.child('bounds', 'max_bound').setValue(50e6) elif param.value == 'amplitude': self.settings.child('bounds', 'min_bound').setValue(0) - self.settings.child('bounds', 'max_bound').setValue(self.settings['generation']) + self.settings.child('bounds', 'max_bound').setValue(self.settings['gen']) self.settings.child('bounds', 'is_bounds').value() self.settings.child('bounds', 'is_bounds').setValue(True) - elif param.name() == 'generation': + elif param.name() == 'gen': if self.axis_name == 'amplitude': self.settings.child('bounds', 'min_bound').setValue(0) self.settings.child('bounds', 'max_bound').setValue(param.value()) @@ -199,12 +199,12 @@ def ini_stage(self, controller=None): self.aout.shape = self.settings['shape'] #plugin_config('generator', 'shape') - if self.settings['axis'] =='frequency': + if self.axis_name =='frequency': self.settings.child('bounds', 'min_bound').setValue(1e-6) self.settings.child('bounds', 'max_bound').setValue(50e6) - elif self.settings['axis'] == 'amplitude': + elif self.axis_name == 'amplitude': self.settings.child('bounds', 'min_bound').setValue(0) - self.settings.child('bounds', 'max_bound').setValue(self.settings['generation']) + self.settings.child('bounds', 'max_bound').setValue(self.settings['gen']) self.settings.child('bounds', 'is_bounds').value() self.settings.child('bounds', 'is_bounds').setValue(True) self.settings.child('bounds', 'is_bounds').setOpts(readonly=True)