Skip to content

Instantly share code, notes, and snippets.

@ktemkin
Created June 4, 2014 06:50
Show Gist options
  • Save ktemkin/521d2cf1b214f0b6b393 to your computer and use it in GitHub Desktop.
Save ktemkin/521d2cf1b214f0b6b393 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
#
# Quick script which "captures" a single waveform from the Agilent scopes in the LNG 709/711 labs.
import ivi
import plac
def main(channel: ("The channel to sample on", 'option', 'c') = 1):
""" A simple tool for reading data from the LNG709/711 oscilloscopes."""
#Convert the channel number to zero-indexed:
channel = int(channel)
channel -= 1
#Connect to the Agilent DSO-X 2014A oscilloscope.
dso = ivi.agilent.agilentDSOX2014A("USB::0x0957::0x1798::INSTR")
#Capture data from the oscilloscope.
dso.measurement.initiate()
waveform = dso.channels[channel].measurement.fetch_waveform()
#Output the data in a matlab-friendly format.
for time, value in waveform:
print("{0} {1}".format(time, value))
# If this application was called directly, use it!
if __name__ == '__main__':
plac.call(main)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment