コード例 #1
0
status["getValues"] = ps.ps6000aGetValues(chandle, 0, ctypes.byref(noOfSamples), 1, downSampleMode, 0, ctypes.byref(overflow))
assert_pico_ok(status["getValues"])

# get max ADC value
# handle = chandle
minADC = ctypes.c_int16()
maxADC = ctypes.c_int16()
status["getAdcLimits"] = ps.ps6000aGetAdcLimits(chandle, resolution, ctypes.byref(minADC), ctypes.byref(maxADC))
assert_pico_ok(status["getAdcLimits"])

# convert ADC counts data to mV
adc2mVChAMax =  adc2mV(bufferAMax, channelRange, maxADC)

# Obtain binary for Digital Port 0
# The tuple returned contains the channels in order (D7, D6, D5, ... D0).
bufferDPort0 = splitMSODataFast(noOfSamples, bufferDPort0Max)

# Create time data
time = np.linspace(0, (nSamples) * timeInterval.value * 1000000000, nSamples)

# plot data from channel A and B
plt.figure(num='Channel A Data')
plt.plot(time, adc2mVChAMax[:])
plt.xlabel('Time (ns)')
plt.ylabel('Voltage (mV)')
plt.title('Channel A data')
#plt.show()

# Plot the data from digital channels onto a graph
plt.figure(num='Digital Port 0 Data')
plt.title('Plot of Digital Port 0 digital channels vs. time')
コード例 #2
0
# Handle = chandle
# start index = 0
# noOfSamples = ctypes.byref(cTotalSamples)
# DownSampleRatio = 1
# DownSampleRatioMode = 0
# SegmentIndex = 0
# Overflow = ctypes.byref(overflow)

status["GetValues"] = ps.ps5000aGetValues(chandle, 0, ctypes.byref(cTotalSamples), 1, 0, 0, ctypes.byref(overflow))
assert_pico_ok(status["GetValues"])

print ("Data collection complete.")

# Obtain binary for Digital Port 0
# The tuple returned contains the channels in order (D7, D6, D5, ... D0).
bufferDPort0 = splitMSODataFast(cTotalSamples, bufferDPort0Max)

# Creates the time data
time = np.linspace(0, cTotalSamples.value * timeIntervalNs.value, cTotalSamples.value)

print ("Plotting data...")

# Plot the data from digital channels onto a graph

plt.figure(num='PicoScope 3000 Series (A API) MSO Block Capture Example')
plt.title('Plot of Digital Port 0 digital channels vs. time')
plt.plot(time, bufferDPort0[0], label='D7')  # D7 is the first array in the tuple.
plt.plot(time, bufferDPort0[1], label='D6')
plt.plot(time, bufferDPort0[2], label='D5')
plt.plot(time, bufferDPort0[3], label='D4')
plt.plot(time, bufferDPort0[4], label='D3')
コード例 #3
0
print "Data collection complete."

# Find maximum ADC count value
# handle = chandle
# pointer to value = ctypes.byref(maxADC)
maxADC = ctypes.c_int16()
status["maximumValue"] = ps.ps2000aMaximumValue(chandle, ctypes.byref(maxADC))
assert_pico_ok(status["maximumValue"])

# Convert ADC counts data to millivolts
adc2mVChA = adc2mV(bufferA, chARange, maxADC)
adc2mVChB = adc2mV(bufferB, chBRange, maxADC)

# Obtain binary for Digital Port 0
# The tuple returned contains the channels in order (D7, D6, D5, ... D0).
dPort0BinaryData = splitMSODataFast(cTotalSamples, bufferDPort0)

# Create time data
time = np.linspace(0, cTotalSamples.value * timeIntervalNs.value,
                   cTotalSamples.value)

# Plot data from channels A, B and D0

print "Plotting data..."

fig, axs = plt.subplots(2, 1, constrained_layout=True)
axs[0].plot(time, adc2mVChA[:], time, adc2mVChB[:])
axs[0].set_title('Analog data acquisition')
axs[0].set_xlabel('Time (ns)')
axs[0].set_ylabel('Voltage (mV)')
axs[0].legend(('Ch. A', 'Ch. B'), loc="upper right")