Skip to content

Commit 168b83e

Browse files
author
neil.hamilton
committed
improve plotting for ps6000aStreamingModeExample.py
1 parent 3619e4e commit 168b83e

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

ps6000aExamples/ps6000aStreamingModeExample.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,22 @@
151151
print(noOfStreamedSamples.value)
152152

153153

154-
154+
# convert ADC counts data to mV
155+
bufferAmV = []
156+
for k in range (0, maxBuffers, 1):
157+
mvValues = adc2mV(bufferA[k], channelRange, maxADC)
158+
bufferAmV.append(mvValues)
159+
160+
time = np.linspace(0, ((nSamples -1)*maxBuffers) * sampleInterval.value * 1000000, (nSamples*maxBuffers))
161+
startTime = 0
162+
endTime = nSamples
155163
# plot ADC data
156-
plt.plot(bufferA[0])
157-
plt.plot(bufferB[0])
164+
for h in range (0, maxBuffers, 1):
165+
plt.plot(time[startTime:endTime],bufferAmV[h])
166+
startTime += nSamples
167+
endTime += nSamples
168+
plt.xlabel('Time (us)')
169+
plt.ylabel('Voltage (mV)')
158170
plt.show()
159171

160172

0 commit comments

Comments
 (0)