This is not fancy, flexible, or robust. It configures a prologix usb-gpib converter to grab screen captures from a LeCroy 94xx or 93xx oscilloscope, store the resulting HPGL into a file, and convert that file to a .png using the HP2xx conversion program.
You need to have pyserial and HP2xx installed. Both are available through repos.
Usage: sudo python screencapture.py [/dev/tty of usb converter] [gpib address of scope, which has to be between 2 and 30, because lecroys behave weirdly outside that range.]
This should work with early Waverunners like the LT3xx series. I have not yet gotten it to work but that’s a setup issue with the Prologix. A Waverunner will need a much larger buffer.
To do: use a serial.inwaiting loop to only use as much buffer size as needed.
I’m also incompetent at posting code on wordpress apparently, so you can go to github: lecroy scope screencap on github
if __name__ == '__main__':
if len(sys.argv) != 3:
print "Usage: ", os.path.basename(sys.argv), "
comport = sys.argv
addr = sys.argv
ser = serial.Serial()
ser = serial.Serial(sys.argv, 9600, timeout = 2.0)
print("Setting up usb-gpib device")
ser.write('++addr ' + addr + '\n')
print("Setting up scope screen plot parameters")
print("Acquiring screen capture")
s = ser.read(65536)
f = open("scope_output.txt","w")
print("Done writing to file! Using HP2xx to convert to png image.")
print("Finished converting image to png")
except serial.SerialException, e:
except serial.KeyboardInterrupt, e: