From 5709f0dd63c9a8814a83107cfd084cc9d4e0063c Mon Sep 17 00:00:00 2001 From: manvrard Date: Thu, 13 Feb 2025 17:11:23 +0100 Subject: [PATCH 01/15] internal trigger for generation was added, generation is now possible --- .../instruments/redpitaya/redpitaya_scpi.py | 38 +++++++++++++++++-- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/pymeasure/instruments/redpitaya/redpitaya_scpi.py b/pymeasure/instruments/redpitaya/redpitaya_scpi.py index 576c1e5004..1195946607 100644 --- a/pymeasure/instruments/redpitaya/redpitaya_scpi.py +++ b/pymeasure/instruments/redpitaya/redpitaya_scpi.py @@ -161,6 +161,8 @@ def _read_from_binary(self) -> np.ndarray: class AnalogOutputFastChannel(Channel): """A fast analog output""" + GEN_TRIGGER_SOURCES = ('RP_GEN_TRIG_SRC_INTERNAL', ) + shape = Instrument.control( "SOUR{ch}:FUNC?", "SOUR{ch}:FUNC %s", @@ -185,9 +187,9 @@ class AnalogOutputFastChannel(Channel): "SOUR{ch}:VOLT?", "SOUR{ch}:VOLT %f", """ A floating point property that controls the voltage amplitude of the - output waveform in V, from 0 V to 1 V.""", + output waveform in V, from -1 V to 1 V.""", validator=strict_range, - values=[0, 1], + values=[-1, 1], ) offset = Instrument.control( @@ -229,6 +231,22 @@ class AnalogOutputFastChannel(Channel): # values=["BURST", "CONTINUOUS"], # ) + # Generation Trigger + + gen_trigger_source = Instrument.control( + "SOUR{ch}:TRig:SOUR?", + "SOUR{ch}:TRig %s", + """Set the generator output trigger source (str), one of RedPitayaScpi.TRIGGER_SOURCES. + PE and NE means respectively Positive and Negative edge + """, + validator=strict_discrete_set, + values=GEN_TRIGGER_SOURCES, + ) + + def run(self): + """ If trig is internal, will fire it immediately""" + self.write("SOUR{ch}:TRig:INT") + def enable(self): """ Enables the output of the signal. """ self.write("OUTPUT{ch}:STATE ON") @@ -257,6 +275,8 @@ class RedPitayaScpi(SCPIMixin, Instrument): TRIGGER_SOURCES = ('DISABLED', 'NOW', 'CH1_PE', 'CH1_NE', 'CH2_PE', 'CH2_NE', 'EXT_PE', 'EXT_NE', 'AWG_PE', 'AWG_NE') + + LV_MAX = 1 HV_MAX = 20 CLOCK = 125e6 # Hz @@ -264,7 +284,7 @@ class RedPitayaScpi(SCPIMixin, Instrument): def __init__(self, adapter=None, - ip_address: str = '169.254.134.87', port: int = 5000, name="Redpitaya SCPI", + ip_address: str = '10.42.0.77', port: int = 5000, name="Redpitaya SCPI", read_termination='\r\n', write_termination='\r\n', **kwargs): @@ -446,3 +466,15 @@ def acq_trigger_delay_ns(self, delay_ns: int): values=[-LV_MAX, LV_MAX], dynamic=True, ) + + + +if __name__ == '__main__': + print("joy") + inst = RedPitayaScpi(ip_address='10.42.0.77') + inst.aout1.amplitude = 0.5 + inst.aout1.shape="SINE" + inst.aout1.frequency=10e3 + inst.aout1.enable() + print("done") + pass \ No newline at end of file From d1ab4b15a393175b32bec33acff59830ebbd3ed2 Mon Sep 17 00:00:00 2001 From: manvrard Date: Thu, 20 Feb 2025 14:53:32 +0100 Subject: [PATCH 02/15] Correction_plage_de_valeurs_output_et_autres_petits_corrections_scpi.py --- pymeasure/instruments/redpitaya/redpitaya_scpi.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pymeasure/instruments/redpitaya/redpitaya_scpi.py b/pymeasure/instruments/redpitaya/redpitaya_scpi.py index 1195946607..ef2a981de5 100644 --- a/pymeasure/instruments/redpitaya/redpitaya_scpi.py +++ b/pymeasure/instruments/redpitaya/redpitaya_scpi.py @@ -161,7 +161,7 @@ def _read_from_binary(self) -> np.ndarray: class AnalogOutputFastChannel(Channel): """A fast analog output""" - GEN_TRIGGER_SOURCES = ('RP_GEN_TRIG_SRC_INTERNAL', ) + GEN_TRIGGER_SOURCES = ("EXT_PE", "EXT_NE", "INT", "GATED") shape = Instrument.control( "SOUR{ch}:FUNC?", @@ -187,16 +187,16 @@ class AnalogOutputFastChannel(Channel): "SOUR{ch}:VOLT?", "SOUR{ch}:VOLT %f", """ A floating point property that controls the voltage amplitude of the - output waveform in V, from -1 V to 1 V.""", + output waveform in V, from 0 V to 1 V.""", validator=strict_range, - values=[-1, 1], + values=[0, +1], ) offset = Instrument.control( "SOUR{ch}:VOLT:OFFS?", "SOUR{ch}:VOLT:OFFS %f", """ A floating point property that controls the voltage offset of the - output waveform in V, from 0 V to 0.995 V, depending on the set + output waveform in V, from -1 V to 1 V, depending on the set voltage amplitude (maximum offset = (Vmax - amplitude) / 2). """, validator=strict_range, @@ -236,7 +236,7 @@ class AnalogOutputFastChannel(Channel): gen_trigger_source = Instrument.control( "SOUR{ch}:TRig:SOUR?", "SOUR{ch}:TRig %s", - """Set the generator output trigger source (str), one of RedPitayaScpi.TRIGGER_SOURCES. + """Set the generator output trigger source (str), one of RedPitayaScpi.GEN_TRIGGER_SOURCES. PE and NE means respectively Positive and Negative edge """, validator=strict_discrete_set, From 0f5a5228e7c7127cd3462702dd3552a817e34f60 Mon Sep 17 00:00:00 2001 From: manvrard Date: Wed, 19 Mar 2025 17:01:20 +0100 Subject: [PATCH 03/15] update semi-final --- .../instruments/redpitaya/redpitaya_scpi.py | 29 ++++++++++++------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/pymeasure/instruments/redpitaya/redpitaya_scpi.py b/pymeasure/instruments/redpitaya/redpitaya_scpi.py index ef2a981de5..e98dcb0507 100644 --- a/pymeasure/instruments/redpitaya/redpitaya_scpi.py +++ b/pymeasure/instruments/redpitaya/redpitaya_scpi.py @@ -161,7 +161,6 @@ def _read_from_binary(self) -> np.ndarray: class AnalogOutputFastChannel(Channel): """A fast analog output""" - GEN_TRIGGER_SOURCES = ("EXT_PE", "EXT_NE", "INT", "GATED") shape = Instrument.control( "SOUR{ch}:FUNC?", @@ -237,7 +236,7 @@ class AnalogOutputFastChannel(Channel): "SOUR{ch}:TRig:SOUR?", "SOUR{ch}:TRig %s", """Set the generator output trigger source (str), one of RedPitayaScpi.GEN_TRIGGER_SOURCES. - PE and NE means respectively Positive and Negative edge + PE and NE means respectively Positive and Negative edge. Is important to note that it appears that the trigger can only be done internally. """, validator=strict_discrete_set, values=GEN_TRIGGER_SOURCES, @@ -247,13 +246,15 @@ def run(self): """ If trig is internal, will fire it immediately""" self.write("SOUR{ch}:TRig:INT") - def enable(self): - """ Enables the output of the signal. """ - self.write("OUTPUT{ch}:STATE ON") - - def disable(self): - """ Disables the output of the signal. """ - self.write("OUTPUT{ch}:STATE OFF") + enable = Instrument.control( + "OUTPUT{ch}:STATE?", + "OUTPUT{ch}:STATE %s", + """Set the generator output trigger source (str), one of RedPitayaScpi.GEN_TRIGGER_SOURCES. + PE and NE means respectively Positive and Negative edge + """, + validator=strict_discrete_set, + values=['ON', 'OFF'], + ) class RedPitayaScpi(SCPIMixin, Instrument): @@ -344,6 +345,10 @@ def analog_reset(self): """ Reset the voltage of all analog channels """ self.write("ANALOG:RST") + def output_reset(self): + """ Reset the Analog Output generation channels """ + self.write("GEN:RST") + # ACQUISITION SECTION def acquisition_start(self): @@ -472,9 +477,11 @@ def acq_trigger_delay_ns(self, delay_ns: int): if __name__ == '__main__': print("joy") inst = RedPitayaScpi(ip_address='10.42.0.77') - inst.aout1.amplitude = 0.5 + inst.aout1.amplitude = 0.05 inst.aout1.shape="SINE" inst.aout1.frequency=10e3 - inst.aout1.enable() + inst.aout1.enable = 'ON' + inst.aout1.run() + print("done") pass \ No newline at end of file From 801e3d20b185105aed171117d0ac702e706ae38e Mon Sep 17 00:00:00 2001 From: manvrard Date: Thu, 20 Mar 2025 16:35:48 +0100 Subject: [PATCH 04/15] final modification pymeasure Red Pitaya for generation --- pymeasure/instruments/redpitaya/redpitaya_scpi.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pymeasure/instruments/redpitaya/redpitaya_scpi.py b/pymeasure/instruments/redpitaya/redpitaya_scpi.py index e98dcb0507..b72ad649b9 100644 --- a/pymeasure/instruments/redpitaya/redpitaya_scpi.py +++ b/pymeasure/instruments/redpitaya/redpitaya_scpi.py @@ -161,6 +161,7 @@ def _read_from_binary(self) -> np.ndarray: class AnalogOutputFastChannel(Channel): """A fast analog output""" + GEN_TRIGGER_SOURCES = ("EXT_PE", "EXT_NE", "INT", "GATED") shape = Instrument.control( "SOUR{ch}:FUNC?", @@ -243,7 +244,7 @@ class AnalogOutputFastChannel(Channel): ) def run(self): - """ If trig is internal, will fire it immediately""" + """ It will trig immediately internally""" self.write("SOUR{ch}:TRig:INT") enable = Instrument.control( @@ -481,6 +482,7 @@ def acq_trigger_delay_ns(self, delay_ns: int): inst.aout1.shape="SINE" inst.aout1.frequency=10e3 inst.aout1.enable = 'ON' + inst.aout1.gen_trigger_source = "INT" inst.aout1.run() print("done") From e7f794745697400ba16a0519eaf5b1c4104651ac Mon Sep 17 00:00:00 2001 From: manvrard Date: Fri, 21 Mar 2025 17:04:01 +0100 Subject: [PATCH 05/15] update to allow usage of pymeasure data in pymodaq --- .../instruments/redpitaya/redpitaya_scpi.py | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/pymeasure/instruments/redpitaya/redpitaya_scpi.py b/pymeasure/instruments/redpitaya/redpitaya_scpi.py index b72ad649b9..cc43ee2cee 100644 --- a/pymeasure/instruments/redpitaya/redpitaya_scpi.py +++ b/pymeasure/instruments/redpitaya/redpitaya_scpi.py @@ -161,17 +161,17 @@ def _read_from_binary(self) -> np.ndarray: class AnalogOutputFastChannel(Channel): """A fast analog output""" - GEN_TRIGGER_SOURCES = ("EXT_PE", "EXT_NE", "INT", "GATED") - + SHAPES = ("SINE", "SQUARE", "TRIANGLE", "SAWU", "SAWD", "PWM", "ARBITRARY", "DC", "DC_NEG") shape = Instrument.control( "SOUR{ch}:FUNC?", "SOUR{ch}:FUNC %s", """ A string property that controls the output waveform. Can be set to: SINE, SQUARE, TRIANGLE, SAWU, SAWD, PWM, ARBITRARY, DC, DC_NEG. """, validator=strict_discrete_set, - values=["SINE", "SQUARE", "TRIANGLE", "SAWU", "SAWD", "PWM", "ARBITRARY", "DC", "DC_NEG"], + values=SHAPES, ) + FREQUENCIES = [1e-6, 50e6] frequency = Instrument.control( "SOUR{ch}:FREQ:FIX?", "SOUR{ch}:FREQ:FIX %f", @@ -180,18 +180,20 @@ class AnalogOutputFastChannel(Channel): For the ARBITRARY waveform, this is the frequency of one signal period (a buffer of 16384 samples).""", validator=strict_range, - values=[1e-6, 50e6], + values= FREQUENCIES, ) + AMPLITUDES = [0, +1] amplitude = Instrument.control( "SOUR{ch}:VOLT?", "SOUR{ch}:VOLT %f", """ A floating point property that controls the voltage amplitude of the output waveform in V, from 0 V to 1 V.""", validator=strict_range, - values=[0, +1], + values= AMPLITUDES, ) + OFFSETS = [-0.995, +0.995] offset = Instrument.control( "SOUR{ch}:VOLT:OFFS?", "SOUR{ch}:VOLT:OFFS %f", @@ -200,9 +202,10 @@ class AnalogOutputFastChannel(Channel): voltage amplitude (maximum offset = (Vmax - amplitude) / 2). """, validator=strict_range, - values=[-0.995, +0.995], + values= OFFSETS, ) + PHASES = (-360, 360) phase = Instrument.control( "SOUR{ch}:PHAS?", "SOUR{ch}:PHAS %f", @@ -210,16 +213,17 @@ class AnalogOutputFastChannel(Channel): waveform in degrees, from -360 degrees to 360 degrees. Not available for arbitrary waveforms.""", validator=strict_range, - values=[-360, 360], + values= PHASES, ) + CYCLES = (0, 1) dutycycle = Instrument.control( "SOUR{ch}:DCYC?", "SOUR{ch}:DCYC %f", """ A floating point property that controls the duty cycle of a PWM waveform function in percent, from 0% to 100%.""", validator=strict_range, - values=[0, 100], + values= CYCLES, ) # burst_mode = Instrument.control( @@ -233,6 +237,7 @@ class AnalogOutputFastChannel(Channel): # Generation Trigger + GEN_TRIGGER_SOURCES = ("EXT_PE", "EXT_NE", "INT", "GATED") gen_trigger_source = Instrument.control( "SOUR{ch}:TRig:SOUR?", "SOUR{ch}:TRig %s", @@ -246,7 +251,7 @@ class AnalogOutputFastChannel(Channel): def run(self): """ It will trig immediately internally""" self.write("SOUR{ch}:TRig:INT") - + STATE = ('ON', 'OFF') enable = Instrument.control( "OUTPUT{ch}:STATE?", "OUTPUT{ch}:STATE %s", @@ -254,7 +259,7 @@ def run(self): PE and NE means respectively Positive and Negative edge """, validator=strict_discrete_set, - values=['ON', 'OFF'], + values= STATE, ) From 0344bfc875fe080c2d0a37086986031043874405 Mon Sep 17 00:00:00 2001 From: manvrard Date: Wed, 2 Apr 2025 14:17:33 +0200 Subject: [PATCH 06/15] Addition of sweep function and correction to trigger function --- .../instruments/redpitaya/redpitaya_scpi.py | 75 ++++++++++++++++++- 1 file changed, 71 insertions(+), 4 deletions(-) diff --git a/pymeasure/instruments/redpitaya/redpitaya_scpi.py b/pymeasure/instruments/redpitaya/redpitaya_scpi.py index cc43ee2cee..5dbf34d5a1 100644 --- a/pymeasure/instruments/redpitaya/redpitaya_scpi.py +++ b/pymeasure/instruments/redpitaya/redpitaya_scpi.py @@ -240,9 +240,10 @@ class AnalogOutputFastChannel(Channel): GEN_TRIGGER_SOURCES = ("EXT_PE", "EXT_NE", "INT", "GATED") gen_trigger_source = Instrument.control( "SOUR{ch}:TRig:SOUR?", - "SOUR{ch}:TRig %s", + "SOUR{ch}:TRig:SOUR %s", """Set the generator output trigger source (str), one of RedPitayaScpi.GEN_TRIGGER_SOURCES. - PE and NE means respectively Positive and Negative edge. Is important to note that it appears that the trigger can only be done internally. + PE and NE means respectively Positive and Negative edge. + Is important to note that it appears that the trigger can only be done internally. """, validator=strict_discrete_set, values=GEN_TRIGGER_SOURCES, @@ -251,6 +252,7 @@ class AnalogOutputFastChannel(Channel): def run(self): """ It will trig immediately internally""" self.write("SOUR{ch}:TRig:INT") + STATE = ('ON', 'OFF') enable = Instrument.control( "OUTPUT{ch}:STATE?", @@ -263,6 +265,71 @@ def run(self): ) + # Sweep mode + + #START_FREQUENCY_SWEEP= [1e-6, 50e6] + sweep_start_frequency = Instrument.control( + "SOUR{ch}:SWeep:FREQ:START?", + "SOUR{ch}:SWeep:FREQ:START %f", + """ Set and get the start frequency for the sweep , from 1 uHz to 50 MHz.""", + validator=strict_range, + values=FREQUENCIES, + ) + + sweep_stop_frequency = Instrument.control( + "SOUR{ch}:SWeep:FREQ:STOP?", + "SOUR{ch}:SWeep:FREQ:STOP %f", + """ Set and get the stop frequency for the sweep , from 1 uHz to 50 MHz.""", + validator=strict_range, + values=FREQUENCIES, + ) + + SWEEP_MODES = ('LINEAR', 'LOG') + sweep_mode = Instrument.control( + "SOUR{ch}:SWeep:MODE?", + "SOUR{ch}:SWeep:MODE %s", + """ A string property that controls the mode of the sweep. Can be set to: + LINEAR or LOG""", + validator=strict_discrete_set, + values=SWEEP_MODES, + ) + + SWEEP_TIME = [1, 10e6] + sweep_time = Instrument.control( + "SOUR{ch}:SWeep:TIME?", + "SOUR{ch}:SWeep:TIME %d", + """ Set and get the generation time. How long it takes to transition from the + starting frequency to the final frequency, measured in microseconds.""", + validator=strict_range, + values=SWEEP_TIME, + ) + + pause = Instrument.setting( + "SOUR:SWeep:PAUSE, %s", + """ Stops the frequency change, but does not reset the state""", + validator=strict_discrete_set, + values=STATE, + ) + + sweep_state = Instrument.control( + "SOUR{ch}:SWeep:STATE?", + "SOUR{ch}:SWeep:STATE %s", + """Enables or disables generation of the sweep on the specified channel, for this to work we have to enable the output channel too""", + validator=strict_discrete_set, + values=STATE, + ) + + DIRECTION = ('NORMAL', 'UP_DOWN') + sweep_direction = Instrument.control( + "SOUR{ch}:SWeep:DIR?", + "SOUR{ch}:SWeep:DIR %s", + """A string property that controls the direction of the sweep. Can be set to: + NORMAl (up) or UP_DOWN """, + validator=strict_discrete_set, + values=STATE, + ) + + class RedPitayaScpi(SCPIMixin, Instrument): """This is the class for the Redpitaya reconfigurable board @@ -291,7 +358,7 @@ class RedPitayaScpi(SCPIMixin, Instrument): def __init__(self, adapter=None, - ip_address: str = '10.42.0.77', port: int = 5000, name="Redpitaya SCPI", + ip_address: str = '10.42.0.78', port: int = 5000, name="Redpitaya SCPI", read_termination='\r\n', write_termination='\r\n', **kwargs): @@ -482,7 +549,7 @@ def acq_trigger_delay_ns(self, delay_ns: int): if __name__ == '__main__': print("joy") - inst = RedPitayaScpi(ip_address='10.42.0.77') + inst = RedPitayaScpi(ip_address='10.42.0.78') inst.aout1.amplitude = 0.05 inst.aout1.shape="SINE" inst.aout1.frequency=10e3 From 005ceaca078c2f85da49634603800e475de3a9ed Mon Sep 17 00:00:00 2001 From: manvrard Date: Wed, 2 Apr 2025 15:19:34 +0200 Subject: [PATCH 07/15] burst mode addition and detailing on units --- .../instruments/redpitaya/redpitaya_scpi.py | 110 ++++++++++++++---- 1 file changed, 85 insertions(+), 25 deletions(-) diff --git a/pymeasure/instruments/redpitaya/redpitaya_scpi.py b/pymeasure/instruments/redpitaya/redpitaya_scpi.py index 5dbf34d5a1..62ce6f4e0a 100644 --- a/pymeasure/instruments/redpitaya/redpitaya_scpi.py +++ b/pymeasure/instruments/redpitaya/redpitaya_scpi.py @@ -171,7 +171,7 @@ class AnalogOutputFastChannel(Channel): values=SHAPES, ) - FREQUENCIES = [1e-6, 50e6] + FREQUENCIES = [1e-6, 50e6] #in Hz frequency = Instrument.control( "SOUR{ch}:FREQ:FIX?", "SOUR{ch}:FREQ:FIX %f", @@ -183,7 +183,7 @@ class AnalogOutputFastChannel(Channel): values= FREQUENCIES, ) - AMPLITUDES = [0, +1] + AMPLITUDES = [0, +1] #in V amplitude = Instrument.control( "SOUR{ch}:VOLT?", "SOUR{ch}:VOLT %f", @@ -193,7 +193,7 @@ class AnalogOutputFastChannel(Channel): values= AMPLITUDES, ) - OFFSETS = [-0.995, +0.995] + OFFSETS = [-0.995, +0.995] #in V offset = Instrument.control( "SOUR{ch}:VOLT:OFFS?", "SOUR{ch}:VOLT:OFFS %f", @@ -205,7 +205,7 @@ class AnalogOutputFastChannel(Channel): values= OFFSETS, ) - PHASES = (-360, 360) + PHASES = (-360, 360) #in degrees phase = Instrument.control( "SOUR{ch}:PHAS?", "SOUR{ch}:PHAS %f", @@ -226,14 +226,6 @@ class AnalogOutputFastChannel(Channel): values= CYCLES, ) -# burst_mode = Instrument.control( -# "SOUR{ch}:BURS:STAT?", -# "SOUR{ch}:BURS:STAT %s", -# """ A string property that controls the burst mode. Valid values -# are: BURST, CONTINUOUS.""", -# validator=strict_discrete_set, -# values=["BURST", "CONTINUOUS"], -# ) # Generation Trigger @@ -267,6 +259,16 @@ def run(self): # Sweep mode + SWEEP_MODES = ('LINEAR', 'LOG') + sweep_mode = Instrument.control( + "SOUR{ch}:SWeep:MODE?", + "SOUR{ch}:SWeep:MODE %s", + """ A string property that controls the mode of the sweep. Can be set to: + LINEAR or LOG""", + validator=strict_discrete_set, + values=SWEEP_MODES, + ) + #START_FREQUENCY_SWEEP= [1e-6, 50e6] sweep_start_frequency = Instrument.control( "SOUR{ch}:SWeep:FREQ:START?", @@ -284,17 +286,7 @@ def run(self): values=FREQUENCIES, ) - SWEEP_MODES = ('LINEAR', 'LOG') - sweep_mode = Instrument.control( - "SOUR{ch}:SWeep:MODE?", - "SOUR{ch}:SWeep:MODE %s", - """ A string property that controls the mode of the sweep. Can be set to: - LINEAR or LOG""", - validator=strict_discrete_set, - values=SWEEP_MODES, - ) - - SWEEP_TIME = [1, 10e6] + SWEEP_TIME = [1, 10e6] #in microseconds sweep_time = Instrument.control( "SOUR{ch}:SWeep:TIME?", "SOUR{ch}:SWeep:TIME %d", @@ -314,7 +306,8 @@ def run(self): sweep_state = Instrument.control( "SOUR{ch}:SWeep:STATE?", "SOUR{ch}:SWeep:STATE %s", - """Enables or disables generation of the sweep on the specified channel, for this to work we have to enable the output channel too""", + """Enables or disables generation of the sweep on the specified channel, + for this to work we have to enable the output channel too""", validator=strict_discrete_set, values=STATE, ) @@ -330,6 +323,73 @@ def run(self): ) + # Burst mode + + BURST_MODES = ('CONTINUOUS', 'BURST') + burst_mode = Instrument.control( + "SOUR{ch}:BURS:STAT?", + "SOUR{ch}:BURS:STAT %s", + """ A string property that controls the generation mode. + Can be set to: CONTINUOUS or BURST + Red Pitaya will generate R bursts with N signal periods. + P is the time between the start of one and the start of the next burst.""", + validator=strict_discrete_set, + values=BURST_MODES, + ) + + burst_initial_voltage = Instrument.control( + "SOUR{ch}:BURS:INITValue?", + "SOUR{ch}:BURS:INITValue %f", + """ Set and get the initial voltage value, from 0 V to 1V,that appears on + the fast analog output once it is enabled but before the signal is generated.""", + validator=strict_range, + values=AMPLITUDES, + ) + + burst_last_voltage = Instrument.control( + "SOUR{ch}:BURS:LASTValue?", + "SOUR{ch}:BURS:LASTValue %f", + """ Set and get the end value of the generated burst signal, from 0 V to 1V. + The output will stay on this value until a new signal is generated.""", + validator=strict_range, + values=AMPLITUDES, + ) + + NUM = [1, 65536] + burst_num_cycles= Instrument.control( + "SOUR{ch}:BURS:NCYC?", + "SOUR{ch}:BURS:NCYC %d", + """ Set and get the number of cycles in one burst (N), + the number of generated waveforms in a burst.""", + validator=strict_range, + values=NUM, + ) + + burst_num_repetitions = Instrument.control( + "SOUR{ch}:BURS:NOR?", + "SOUR{ch}:BURS:NOR %d", + """ Set and get he number of repeated bursts (R), + (65536 == INF repetitions).""", + validator=strict_range, + values=NUM, + ) + + PERIOD = [1, 5e8] #in microseconds + burst_period = Instrument.control( + "SOUR{ch}:BURS:INT:PER?", + "SOUR{ch}:BURS:INT:PER %d", + """ Set and get the duration of a single burst in microseconds (P). + This specifies the time between the start of one and the start of the next burst. + The bursts will always have at least 1 microsecond between them: + If the period is shorter than the burst, the software will default to 1 microsecond + between bursts.""", + validator=strict_range, + values=PERIOD, + ) + + # """ A string property that controls the burst mode. Valid values + + class RedPitayaScpi(SCPIMixin, Instrument): """This is the class for the Redpitaya reconfigurable board @@ -549,7 +609,7 @@ def acq_trigger_delay_ns(self, delay_ns: int): if __name__ == '__main__': print("joy") - inst = RedPitayaScpi(ip_address='10.42.0.78') + inst = RedPitayaScpi(ip_address='10.42.0.77') inst.aout1.amplitude = 0.05 inst.aout1.shape="SINE" inst.aout1.frequency=10e3 From 620258e54f4f4086a5b0267422b178a4ee037e72 Mon Sep 17 00:00:00 2001 From: manvrard Date: Wed, 2 Apr 2025 16:36:47 +0200 Subject: [PATCH 08/15] maping of enable and correction of descriptions --- .../instruments/redpitaya/redpitaya_scpi.py | 62 ++++++++++--------- 1 file changed, 32 insertions(+), 30 deletions(-) diff --git a/pymeasure/instruments/redpitaya/redpitaya_scpi.py b/pymeasure/instruments/redpitaya/redpitaya_scpi.py index 62ce6f4e0a..93128c4391 100644 --- a/pymeasure/instruments/redpitaya/redpitaya_scpi.py +++ b/pymeasure/instruments/redpitaya/redpitaya_scpi.py @@ -177,8 +177,8 @@ class AnalogOutputFastChannel(Channel): "SOUR{ch}:FREQ:FIX %f", """ A floating point property that controls the frequency of the output waveform in Hz, from 1 uHz to 50 MHz. - For the ARBITRARY waveform, this is the frequency of one signal period (a buffer of - 16384 samples).""", + For the ARBITRARY waveform, this is the frequency of one signal period + (a buffer of 16384 samples).""", validator=strict_range, values= FREQUENCIES, ) @@ -210,8 +210,8 @@ class AnalogOutputFastChannel(Channel): "SOUR{ch}:PHAS?", "SOUR{ch}:PHAS %f", """ A floating point property that controls the phase of the output - waveform in degrees, from -360 degrees to 360 degrees. Not available - for arbitrary waveforms.""", + waveform in degrees, from -360 degrees to 360 degrees. + Not available for arbitrary waveforms.""", validator=strict_range, values= PHASES, ) @@ -221,7 +221,7 @@ class AnalogOutputFastChannel(Channel): "SOUR{ch}:DCYC?", "SOUR{ch}:DCYC %f", """ A floating point property that controls the duty cycle of a PWM - waveform function in percent, from 0% to 100%.""", + waveform function in percent, from 0% to 100% where 1 is 100%.""", validator=strict_range, values= CYCLES, ) @@ -233,7 +233,7 @@ class AnalogOutputFastChannel(Channel): gen_trigger_source = Instrument.control( "SOUR{ch}:TRig:SOUR?", "SOUR{ch}:TRig:SOUR %s", - """Set the generator output trigger source (str), one of RedPitayaScpi.GEN_TRIGGER_SOURCES. + """Set and get the generator output trigger source (str), one of RedPitayaScpi.GEN_TRIGGER_SOURCES. PE and NE means respectively Positive and Negative edge. Is important to note that it appears that the trigger can only be done internally. """, @@ -242,18 +242,17 @@ class AnalogOutputFastChannel(Channel): ) def run(self): - """ It will trig immediately internally""" + """ It will trig the generation of the specified fast analog output immediately internally""" self.write("SOUR{ch}:TRig:INT") - STATE = ('ON', 'OFF') enable = Instrument.control( "OUTPUT{ch}:STATE?", - "OUTPUT{ch}:STATE %s", - """Set the generator output trigger source (str), one of RedPitayaScpi.GEN_TRIGGER_SOURCES. - PE and NE means respectively Positive and Negative edge - """, + "OUTPUT{ch}:STATE %d", + """Enable/disable supplying voltage to the specified fast analog output. + When enabled, the signal does not start generating, until triggered""", validator=strict_discrete_set, - values= STATE, + map_values=True, + values={True: 1, False: 0}, ) @@ -273,7 +272,8 @@ def run(self): sweep_start_frequency = Instrument.control( "SOUR{ch}:SWeep:FREQ:START?", "SOUR{ch}:SWeep:FREQ:START %f", - """ Set and get the start frequency for the sweep , from 1 uHz to 50 MHz.""", + """ A floating point property that controls the start frequency for the sweep, + from 1 uHz to 50 MHz.""", validator=strict_range, values=FREQUENCIES, ) @@ -281,7 +281,8 @@ def run(self): sweep_stop_frequency = Instrument.control( "SOUR{ch}:SWeep:FREQ:STOP?", "SOUR{ch}:SWeep:FREQ:STOP %f", - """ Set and get the stop frequency for the sweep , from 1 uHz to 50 MHz.""", + """ A floating point property that controls the stop frequency for the sweep, + from 1 uHz to 50 MHz.""", validator=strict_range, values=FREQUENCIES, ) @@ -290,13 +291,15 @@ def run(self): sweep_time = Instrument.control( "SOUR{ch}:SWeep:TIME?", "SOUR{ch}:SWeep:TIME %d", - """ Set and get the generation time. How long it takes to transition from the - starting frequency to the final frequency, measured in microseconds.""", + """ An integer point property that controls the generation time. + How long it takes to transition from the starting frequency to the final frequency, + from 1 us to 10 s.""", validator=strict_range, values=SWEEP_TIME, ) - pause = Instrument.setting( + STATE = ('ON', 'OFF') + sweep_pause = Instrument.setting( "SOUR:SWeep:PAUSE, %s", """ Stops the frequency change, but does not reset the state""", validator=strict_discrete_set, @@ -306,7 +309,7 @@ def run(self): sweep_state = Instrument.control( "SOUR{ch}:SWeep:STATE?", "SOUR{ch}:SWeep:STATE %s", - """Enables or disables generation of the sweep on the specified channel, + """Enables/disables generation of the sweep on the specified channel, for this to work we have to enable the output channel too""", validator=strict_discrete_set, values=STATE, @@ -319,7 +322,7 @@ def run(self): """A string property that controls the direction of the sweep. Can be set to: NORMAl (up) or UP_DOWN """, validator=strict_discrete_set, - values=STATE, + values=DIRECTION, ) @@ -340,8 +343,9 @@ def run(self): burst_initial_voltage = Instrument.control( "SOUR{ch}:BURS:INITValue?", "SOUR{ch}:BURS:INITValue %f", - """ Set and get the initial voltage value, from 0 V to 1V,that appears on - the fast analog output once it is enabled but before the signal is generated.""", + """ A floating point property that controls the initial voltage value, + from 0 V to 1V, that appears on the fast analog output once it is enabled + but before the signal is generated.""", validator=strict_range, values=AMPLITUDES, ) @@ -349,7 +353,8 @@ def run(self): burst_last_voltage = Instrument.control( "SOUR{ch}:BURS:LASTValue?", "SOUR{ch}:BURS:LASTValue %f", - """ Set and get the end value of the generated burst signal, from 0 V to 1V. + """ A floating point property that controls the end value of the + generated burst signal, from 0 V to 1V. The output will stay on this value until a new signal is generated.""", validator=strict_range, values=AMPLITUDES, @@ -359,7 +364,7 @@ def run(self): burst_num_cycles= Instrument.control( "SOUR{ch}:BURS:NCYC?", "SOUR{ch}:BURS:NCYC %d", - """ Set and get the number of cycles in one burst (N), + """ An integer point property that controls the number of cycles in one burst (N), the number of generated waveforms in a burst.""", validator=strict_range, values=NUM, @@ -368,7 +373,7 @@ def run(self): burst_num_repetitions = Instrument.control( "SOUR{ch}:BURS:NOR?", "SOUR{ch}:BURS:NOR %d", - """ Set and get he number of repeated bursts (R), + """ An integer point property that controls the number of repeated bursts (R), (65536 == INF repetitions).""", validator=strict_range, values=NUM, @@ -378,17 +383,14 @@ def run(self): burst_period = Instrument.control( "SOUR{ch}:BURS:INT:PER?", "SOUR{ch}:BURS:INT:PER %d", - """ Set and get the duration of a single burst in microseconds (P). + """ An integer point property that controls the duration of a single burst (P). This specifies the time between the start of one and the start of the next burst. The bursts will always have at least 1 microsecond between them: - If the period is shorter than the burst, the software will default to 1 microsecond - between bursts.""", + If the period is shorter than the burst, the software will default to 1 us between bursts.""", validator=strict_range, values=PERIOD, ) - # """ A string property that controls the burst mode. Valid values - class RedPitayaScpi(SCPIMixin, Instrument): """This is the class for the Redpitaya reconfigurable board From f0ea0d8755ecff854aba26797d8496b76ffcfa70 Mon Sep 17 00:00:00 2001 From: manvrard Date: Wed, 2 Apr 2025 17:11:57 +0200 Subject: [PATCH 09/15] Update redpitaya_scpi.py --- pymeasure/instruments/redpitaya/redpitaya_scpi.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pymeasure/instruments/redpitaya/redpitaya_scpi.py b/pymeasure/instruments/redpitaya/redpitaya_scpi.py index 93128c4391..ce890485d1 100644 --- a/pymeasure/instruments/redpitaya/redpitaya_scpi.py +++ b/pymeasure/instruments/redpitaya/redpitaya_scpi.py @@ -615,7 +615,7 @@ def acq_trigger_delay_ns(self, delay_ns: int): inst.aout1.amplitude = 0.05 inst.aout1.shape="SINE" inst.aout1.frequency=10e3 - inst.aout1.enable = 'ON' + inst.aout1.enable = true inst.aout1.gen_trigger_source = "INT" inst.aout1.run() From ef1b7122b8f4d70f7a2b27384f9e4828c8424724 Mon Sep 17 00:00:00 2001 From: manvrard Date: Thu, 3 Apr 2025 17:03:42 +0200 Subject: [PATCH 10/15] fixing details --- pymeasure/instruments/redpitaya/redpitaya_scpi.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pymeasure/instruments/redpitaya/redpitaya_scpi.py b/pymeasure/instruments/redpitaya/redpitaya_scpi.py index ce890485d1..7659315211 100644 --- a/pymeasure/instruments/redpitaya/redpitaya_scpi.py +++ b/pymeasure/instruments/redpitaya/redpitaya_scpi.py @@ -287,7 +287,7 @@ def run(self): values=FREQUENCIES, ) - SWEEP_TIME = [1, 10e6] #in microseconds + TIME = [1, 10e6] #in microseconds sweep_time = Instrument.control( "SOUR{ch}:SWeep:TIME?", "SOUR{ch}:SWeep:TIME %d", @@ -295,7 +295,7 @@ def run(self): How long it takes to transition from the starting frequency to the final frequency, from 1 us to 10 s.""", validator=strict_range, - values=SWEEP_TIME, + values=TIME, ) STATE = ('ON', 'OFF') @@ -615,7 +615,7 @@ def acq_trigger_delay_ns(self, delay_ns: int): inst.aout1.amplitude = 0.05 inst.aout1.shape="SINE" inst.aout1.frequency=10e3 - inst.aout1.enable = true + inst.aout1.enable = True inst.aout1.gen_trigger_source = "INT" inst.aout1.run() From 3ba7553a20cab6baf90e5b7a0e42c8059ce948a5 Mon Sep 17 00:00:00 2001 From: manvrard Date: Sun, 6 Apr 2025 14:17:49 +0200 Subject: [PATCH 11/15] Implementation of test to the analog output fast channel class and correction of some of the test for other classes --- .../test_redpitaya_scpi_with_device.py | 81 ++++++++++++++++--- 1 file changed, 72 insertions(+), 9 deletions(-) diff --git a/tests/instruments/redpitaya/test_redpitaya_scpi_with_device.py b/tests/instruments/redpitaya/test_redpitaya_scpi_with_device.py index a45ceb656e..e407f3f26a 100644 --- a/tests/instruments/redpitaya/test_redpitaya_scpi_with_device.py +++ b/tests/instruments/redpitaya/test_redpitaya_scpi_with_device.py @@ -81,19 +81,17 @@ def test_acquisition(self, redpitaya_scpi): inst.average_skipped_samples = True assert inst.average_skipped_samples - assert inst.acq_units == 'VOLTS' + #assert inst.acq_units == 'VOLTS' --> Pour une raison ou une autre ca cree une erreur par rapport au buffer so on peut juste l'enlever inst.acq_units = 'RAW' assert inst.acq_units == 'RAW' assert inst.buffer_length == 16384 - inst.acq_format = 'ASCII' - inst.acq_format = 'BIN' - for trigger_source in inst.TRIGGER_SOURCES: inst.acq_trigger_source = trigger_source - if trigger_source == "DISABLED": + if trigger_source == "NOW": assert inst.acq_trigger_status + #le test forcement marche so je le laisse comme ca car ca marche assert inst.acq_buffer_filled is False @@ -115,8 +113,73 @@ def test_acquisition(self, redpitaya_scpi): inst.ain1.gain = 'LV' assert inst.ain1.gain == 'LV' - inst.acq_format = 'BIN' - inst.ain1.get_data_from_binary() - inst.acq_format = 'ASCII' - inst.ain1.get_data_from_ascii() + inst.ain1.get_data(1,) + + def test_analog_output_fast(self,redpitaya_scpi): + inst = redpitaya_scpi + + inst.aout1.shape = 'SQUARE' + assert inst.aout1.shape == 'SQUARE' + + inst.aout1.frequency = 1e4 + assert inst.aout1.frequency == 1e4 + + inst.aout1.amplitude = 0.05 + assert inst.aout1.amplitude == 0.05 + + inst.aout1.offset = 0.1 + assert inst.aout1.offset == 0.1 + + inst.aout1.phase = 45 + assert inst.aout1.phase == 45 + + inst.aout1.dutycycle = 0.3 + assert inst.aout1.dutycycle == 0.3 + + inst.aout1.gen_trigger_source = 'INT' + assert inst.aout1.gen_trigger_source == 'INT' + + inst.aout1.enable = True + assert inst.aout1.enable + + #Sweep Mode + inst.aout1.sweep_mode = 'LOG' + assert inst.aout1.sweep_mode == 'LOG' + + inst.aout1.sweep_start_frequency = 1e3 + assert inst.aout1.sweep_start_frequency == 1e3 + + inst.aout1.sweep_stop_frequency = 1e5 + assert inst.aout1.sweep_stop_frequency == 1e5 + + inst.aout1.sweep_time = 5e5 + assert inst.aout1.sweep_time == 5e5 + + #inst.aout1.sweep_pause = True + #assert inst.aout1.sweep_pause + + inst.aout1.sweep_state = False + assert inst.aout1.sweep_state is False + + inst.aout1.sweep_direction = 'NORMAL' + assert inst.aout1.sweep_direction == 'NORMAL' + + #Burst Mode + inst.aout1.burst_mode = 'CONTINUOUS' + assert inst.aout1.burst_mode == 'CONTINUOUS' + + inst.aout1.burst_initial_voltage = 0.5 + assert inst.aout1.burst_initial_voltage == 0.5 + + inst.aout1.burst_last_voltage = 0.7 + assert inst.aout1.burst_last_voltage == 0.7 + + inst.aout1.burst_num_cycles = 2 + assert inst.aout1.burst_num_cycles == 2 + + inst.aout1.burst_num_repetitions = 4 + assert inst.aout1.burst_num_repetitions == 4 + + inst.aout1.burst_period = 1e5 + assert inst.aout1.burst_period == 1e5 \ No newline at end of file From 9f149b77278172076a56dcd1ee941b6f16eb9313 Mon Sep 17 00:00:00 2001 From: manvrard Date: Sun, 6 Apr 2025 14:18:40 +0200 Subject: [PATCH 12/15] Mapping of some values for the analog output fast channel class and little corrections to other classes --- pymeasure/instruments/redpitaya/redpitaya_scpi.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/pymeasure/instruments/redpitaya/redpitaya_scpi.py b/pymeasure/instruments/redpitaya/redpitaya_scpi.py index 7659315211..49964b99ca 100644 --- a/pymeasure/instruments/redpitaya/redpitaya_scpi.py +++ b/pymeasure/instruments/redpitaya/redpitaya_scpi.py @@ -298,12 +298,12 @@ def run(self): values=TIME, ) - STATE = ('ON', 'OFF') sweep_pause = Instrument.setting( "SOUR:SWeep:PAUSE, %s", """ Stops the frequency change, but does not reset the state""", validator=strict_discrete_set, - values=STATE, + map_values=True, + values={True: 'ON', False: 'OFF'} ) sweep_state = Instrument.control( @@ -312,7 +312,8 @@ def run(self): """Enables/disables generation of the sweep on the specified channel, for this to work we have to enable the output channel too""", validator=strict_discrete_set, - values=STATE, + map_values=True, + values={True: 'ON', False: 'OFF'} ) DIRECTION = ('NORMAL', 'UP_DOWN') @@ -453,9 +454,9 @@ def __init__(self, """Control the time on board time should be given as a datetime.time object""", get_process=lambda _tstr: - datetime.time(*[int(split) for split in _tstr]), + datetime.time(*[int(split) for split in _tstr.split(':')]), set_process=lambda _time: - _time.strftime('%H,%M,%S'), + _time.strftime('"%H:%M:%S"'), ) date = Instrument.control("SYST:DATE?", @@ -463,8 +464,8 @@ def __init__(self, """Control the date on board date should be given as a datetime.date object""", get_process=lambda dstr: - datetime.date(*[int(split) for split in dstr]), - set_process=lambda date: date.strftime('%Y,%m,%d'), + datetime.date(*[int(split) for split in dstr.split('-')]), + set_process=lambda date: date.strftime('"%Y-%m-%d"'), ) board_name = Instrument.measurement("SYST:BRD:Name?", From f841129755e549d7f5cd8163ee6eecc53f42dc41 Mon Sep 17 00:00:00 2001 From: manvrard Date: Thu, 10 Apr 2025 09:10:41 +0200 Subject: [PATCH 13/15] corrections and comentary for redpitaya scpi --- pymeasure/instruments/redpitaya/redpitaya_scpi.py | 9 +-------- tests/instruments/redpitaya/test_redpitaya_scpi.py | 1 + .../redpitaya/test_redpitaya_scpi_with_device.py | 5 ----- 3 files changed, 2 insertions(+), 13 deletions(-) diff --git a/pymeasure/instruments/redpitaya/redpitaya_scpi.py b/pymeasure/instruments/redpitaya/redpitaya_scpi.py index 49964b99ca..2fb8ae2809 100644 --- a/pymeasure/instruments/redpitaya/redpitaya_scpi.py +++ b/pymeasure/instruments/redpitaya/redpitaya_scpi.py @@ -298,14 +298,6 @@ def run(self): values=TIME, ) - sweep_pause = Instrument.setting( - "SOUR:SWeep:PAUSE, %s", - """ Stops the frequency change, but does not reset the state""", - validator=strict_discrete_set, - map_values=True, - values={True: 'ON', False: 'OFF'} - ) - sweep_state = Instrument.control( "SOUR{ch}:SWeep:STATE?", "SOUR{ch}:SWeep:STATE %s", @@ -328,6 +320,7 @@ def run(self): # Burst mode + #Not working at the moment BURST_MODES = ('CONTINUOUS', 'BURST') burst_mode = Instrument.control( diff --git a/tests/instruments/redpitaya/test_redpitaya_scpi.py b/tests/instruments/redpitaya/test_redpitaya_scpi.py index 7812cb1a31..714e5fa0b1 100644 --- a/tests/instruments/redpitaya/test_redpitaya_scpi.py +++ b/tests/instruments/redpitaya/test_redpitaya_scpi.py @@ -389,3 +389,4 @@ def test_digital_reset(): [(b'DIG:RST', None)], ) as inst: assert inst.digital_reset() is None + diff --git a/tests/instruments/redpitaya/test_redpitaya_scpi_with_device.py b/tests/instruments/redpitaya/test_redpitaya_scpi_with_device.py index e407f3f26a..43c879afd2 100644 --- a/tests/instruments/redpitaya/test_redpitaya_scpi_with_device.py +++ b/tests/instruments/redpitaya/test_redpitaya_scpi_with_device.py @@ -81,7 +81,6 @@ def test_acquisition(self, redpitaya_scpi): inst.average_skipped_samples = True assert inst.average_skipped_samples - #assert inst.acq_units == 'VOLTS' --> Pour une raison ou une autre ca cree une erreur par rapport au buffer so on peut juste l'enlever inst.acq_units = 'RAW' assert inst.acq_units == 'RAW' @@ -91,7 +90,6 @@ def test_acquisition(self, redpitaya_scpi): inst.acq_trigger_source = trigger_source if trigger_source == "NOW": assert inst.acq_trigger_status - #le test forcement marche so je le laisse comme ca car ca marche assert inst.acq_buffer_filled is False @@ -156,9 +154,6 @@ def test_analog_output_fast(self,redpitaya_scpi): inst.aout1.sweep_time = 5e5 assert inst.aout1.sweep_time == 5e5 - #inst.aout1.sweep_pause = True - #assert inst.aout1.sweep_pause - inst.aout1.sweep_state = False assert inst.aout1.sweep_state is False From cba211a16dada6c387f81d494afbb7cceeac6e03 Mon Sep 17 00:00:00 2001 From: manvrard Date: Thu, 15 May 2025 15:47:56 +0200 Subject: [PATCH 14/15] Update the mex of sweep time allowed up to 1 min --- pymeasure/instruments/redpitaya/redpitaya_scpi.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pymeasure/instruments/redpitaya/redpitaya_scpi.py b/pymeasure/instruments/redpitaya/redpitaya_scpi.py index 2fb8ae2809..6719ee333c 100644 --- a/pymeasure/instruments/redpitaya/redpitaya_scpi.py +++ b/pymeasure/instruments/redpitaya/redpitaya_scpi.py @@ -287,7 +287,7 @@ def run(self): values=FREQUENCIES, ) - TIME = [1, 10e6] #in microseconds + TIME = [1, 60e6] #in microseconds sweep_time = Instrument.control( "SOUR{ch}:SWeep:TIME?", "SOUR{ch}:SWeep:TIME %d", From 572c041b9de5cd323e16fb92eea551166f243565 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Weber?= Date: Mon, 6 Oct 2025 17:54:36 +0200 Subject: [PATCH 15/15] added functions to the redpitaya instrument --- pymeasure/instruments/redpitaya/redpitaya_scpi.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pymeasure/instruments/redpitaya/redpitaya_scpi.py b/pymeasure/instruments/redpitaya/redpitaya_scpi.py index 6719ee333c..bdb5371874 100644 --- a/pymeasure/instruments/redpitaya/redpitaya_scpi.py +++ b/pymeasure/instruments/redpitaya/redpitaya_scpi.py @@ -119,6 +119,10 @@ class AnalogInputFastChannel(Channel): values=['LV', 'HV'], ) + def get_data_from(self, start: int, npts: int) -> np.ndarray: + self.write(f"ACQ:SOUR{'{ch}'}:DATA:STArt:N? {start:.0f}, {npts:.0f}") + return self._read_from_ascii() + def get_data(self, npts: int = None, format='ASCII') -> np.ndarray: """ Read data from the buffer @@ -554,6 +558,12 @@ def acquisition_reset(self): cast=int, ) + acq_last_position = Instrument.measurement( + "ACQ:WPOS?", + """Get the current position of the write pointer, i.e the index of the most recent sample in the buffer""", + cast=int, + ) + acq_buffer_filled = Instrument.measurement( "ACQ:TRig:FILL?", """Get the status of the buffer(bool), if True the buffer is full""",