Page 29 of 29

Re: New feature: high speed continuous recording

Posted: Thu Dec 20, 2018 9:00 pm
by keramatnejad

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)


Re: New feature: high speed continuous recording

Posted: Thu Jan 24, 2019 12:39 am
by hadmack
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.

Re: New feature: high speed continuous recording

Posted: Tue Jan 29, 2019 4:31 pm
by gerardpc
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.

Re: New feature: high speed continuous recording

Posted: Thu Sep 26, 2019 4:12 pm
by November_SSN
So, what's the status of this feature so far? It sounds quite interesting to me, that's something I can see myself using.

Re: New feature: high speed continuous recording

Posted: Fri Jan 03, 2020 2:03 am
by awmlee
I'm getting some distortion on the aquisitions by rp_remote_acquire compared to a 12 bit oscilloscope (picoscope 4227) and even the red pitaya standard oscilloscope (through web interface). Has anyone noticed this, and compared with the new "Data Stream Control" on the RP beta?

I've detailed my experiment and results in an attached pdf, with some waveform captures from each. I've also included some python code (which might be the source of the problem) for decoding the stream from rp_remote_acquire.