New feature: high speed continuous recording

Discussions about active development projects
Post Reply
Posts: 3
Joined: Tue Jul 10, 2018 7:47 pm

Re: New feature: high speed continuous recording

Post by keramatnejad » Thu Dec 20, 2018 9:00 pm


My issue may sound primitive and unrelated to this discussion. However, since it is sort of a data acquisition issue that I'm dealing with, I hope someone would help me fix it.

I am using the current code to perform: 1- real-time plotting and 2- real-time data recording vs time of the "iq2" and "iq2_2" outputs of the iqs module. Although the animation seems to be wokring, the t (x axis) is not updates as the time goes by. In addition, I am not exactly sure how to save the data for these two curves. I am planning to run this code for at least 30-120 seconds and continuously save the iq2 and iq2_2 in a CSV file. I would appreciate it if anyone could share some insight on this. Here is the code:

from matplotlib import pyplot as plt
from matplotlib import animation
from pyrpl import Pyrpl
import csv
import os
import math
import numpy as np

duration = 20

#p = Pyrpl(hostname="")
p = Pyrpl('LIA')

r = p.rp

##Redpitaya (RP) Oscilloscope Settings

s = r.scope
s.input1 = "iq2" #Output X from the RP Locked-in Amplifier
s.input2 = "iq2_2" #Output Y from the RP Locked-in Amplifier

s.trigger_source = 'immediately'

s.threshold = 0

s.hysteresis = 0.01

s.trigger_delay = 0

s.decimation = 65536

##Locked-in demodulation settings:
iq_I = r.iq2
iq_I.setup(frequency=500, bandwidth=[0,1.186], gain=0.0, phase=0, acbandwidth=0, amplitude=0.2, input='in1', output_direct='out1', output_signal='quadrature', quadrature_factor=1)

print("Available decimation factors:", s.decimations)

R = np.zeros((1907,))
ch1 = np.zeros((16384,))
ch2 = np.zeros((16384,))

ch1 = s._data_ch1
ch2 = s._data_ch2

##Real-time figure plot

fig, ax = plt.subplots()
signal_axis = ax.twinx()
signal_axis.set_ylabel('X (Volt)', color=(31 / 255., 119 / 255., 180 / 255.), size=20)
ax.set_ylabel('Y (Volt)', color=(255 / 255., 127 / 255., 14 / 255.), size=20)
ax.set_xlabel('Time (s)', size=20)
ax.set_ylim(-1.0, 1.0)
signal_axis.set_ylim(-0.2, 0.2)
ch1, = ax.plot([], [], color=(255 / 255., 127 / 255., 14 / 255.))
ch2, = signal_axis.plot([], [], color=(31 / 255., 119 / 255., 180 / 255.))

def animate(i):
ax.set_xlim(0, s.times[16383])
ch1.set_data(s.times[0:16384], s._data_ch1[0:16384])
ch2.set_data(s.times[0:16384], s._data_ch2[0:16384])

ani = animation.FuncAnimation(fig, animate, interval=50)

##Saving the data

#csvDirectory = 'C:\Users\kkera\Desktop\Python data'
#with open('iq-R5.csv', 'wb') as csvfile:
# spamwriter = csv.writer(csvfile, delimiter=',', quotechar='|', quoting=csv.QUOTE_MINIMAL)
# spamwriter.writerow(["t", "iq2", "iq2_2"])
# spamwriter.writerow(s.times)
# spamwriter.writerow(s._data_ch1)
# spamwriter.writerow(s._data_ch2)


Posts: 6
Joined: Fri Mar 06, 2015 4:59 am

Re: New feature: high speed continuous recording

Post by hadmack » Thu Jan 24, 2019 12:39 am

Using Nils' rp_remote_acquire code and ddrdump.bit I am trying to stream data from the ADC over TCP.

Code: Select all

./rp_remote_acquire -m 2 -p 5353 -k 0 -c 0 -d 32 -l -r
The received data is strange consisting of two samples of data (int16) followed by 0xFFFFFFFF before another two samples. I also get two zero samples every 128bytes.

Is anyone out there still working on this? It looks like Nils Roos left the forum over two years ago and this kind of development seems dead but perhaps I am looking in the wrong place. If anyone is has any other high speed acquisition projects for the Pitaya please let me know.

Posts: 9
Joined: Tue Oct 09, 2018 5:01 pm

Re: New feature: high speed continuous recording

Post by gerardpc » Tue Jan 29, 2019 4:31 pm

Hi all!

I'm super interested in making this work, but my attempts so far haven't worked. If anybody else is still interested in this and wants to discuss it, please reply or send me an email.

Post Reply
jadalnie klasyczne ekskluzywne meble wypoczynkowe do salonu ekskluzywne meble tapicerowane ekskluzywne meble do sypialni ekskluzywne meble włoskie

Who is online

Users browsing this forum: No registered users and 2 guests