I am trying to use Pyvisa to capture data from one of my channels of my Keithly 2701 DMM.
I get a static onetime response via temp = keithly.ask('SCPI COmmand')
, but what I want to do is constantly print new data without setting any predefined size, i.e capture 300 data points.
I want to determine when to stop the capture if I have seen a trend over 10000 data points, or, in another experiment, I might see a trend after 2500 data points.
from pylab import *
from visa import instrument
inst = SerialInstument(args)
while new data:
print inst.aks('channel')
You can then ctrl-c to stop the loop when you see fit.
The above script is simple - it just puts numbers on the screen until you kill it. I find it useful to plot the data from PyVISA in real time, using matplotlib. I found this to be buggy in pyplot mode (I got lots of blank screens when I turned off interactive mode, ymmv) so I embedded it into a tkinter window, as follows:
It may not seem like much, but we gradually developed a short script like this into a rather capable instrument control program ;)