Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| en:python-ivi:readme [2012/10/27 02:04] – [Usage example] alex | en:python-ivi:readme [2014/02/12 19:28] (current) – [Usage example] alex | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Python IVI Readme ====== | ====== Python IVI Readme ====== | ||
| + | |||
| + | ===== Introduction ===== | ||
| Python IVI is a Python-based interpretation of the Interchangeable Virtual Instrument standard from the [[http:// | Python IVI is a Python-based interpretation of the Interchangeable Virtual Instrument standard from the [[http:// | ||
| Line 5: | Line 7: | ||
| ===== Included drivers ===== | ===== Included drivers ===== | ||
| - | * DC Power Supplies | + | * Oscilloscopes |
| - | * Tektronix PS2520G/PS2521G | + | * Agilent InfiniiVision 2000A/3000A series |
| + | * Agilent InfiniiVision 6000A series | ||
| + | * Agilent InfiniiVision 7000A/B series | ||
| + | * Agilent Infiniium 90000A/ | ||
| * Function Generators (fgen) | * Function Generators (fgen) | ||
| * Tektronix AWG2000 series | * Tektronix AWG2000 series | ||
| + | * DC Power Supplies (dcpwr) | ||
| + | * Agilent E3600A series | ||
| + | * Agilent 603xA series | ||
| + | * Rigol DP800 series | ||
| + | * Rigol DP1000 series | ||
| + | * Tektronix PS2520G/ | ||
| + | * RF Power Meters (pwrmeter): | ||
| + | * Agilent 436A | ||
| * RF Signal Generators (rfsiggen) | * RF Signal Generators (rfsiggen) | ||
| * Agilent 8642 A/B | * Agilent 8642 A/B | ||
| - | * Oscilloscopes (scope) | + | * Other |
| - | * Agilent | + | * Agilent |
| + | * Agilent 86140B | ||
| + | * Colby Instruments PDL10A Programmable Delay Line | ||
| + | * DiCon Fiberoptics GP700 Programmable Fiberoptic Instrument | ||
| + | * JDS Uniphase TB9 Series Optical Grating Filter | ||
| + | * Tektronix AM5030 programmable current probe amplifier | ||
| + | * Tektronix OA5000 series optical attenuator | ||
| ===== Instrument communication ===== | ===== Instrument communication ===== | ||
| - | Python IVI can use linux-gpib | + | Python IVI can use Python VXI-11, Python USBTMC, pySerial and linux-gpib to connect to instruments. |
| ===== A note on standards compliance ===== | ===== A note on standards compliance ===== | ||
| Line 23: | Line 41: | ||
| The Python IVI library is a Pythonized version of the .NET and COM IVI API specifications, | The Python IVI library is a Pythonized version of the .NET and COM IVI API specifications, | ||
| + | |||
| + | |||
| + | ===== Requirements ===== | ||
| + | |||
| + | * Python 2 or Python 3 | ||
| + | * One or more communication extensions | ||
| + | |||
| + | ===== Installation ===== | ||
| + | |||
| + | Extract and run | ||
| + | |||
| + | < | ||
| + | # python setup.py install | ||
| + | </ | ||
| + | |||
| + | ==== Instrument Communication Extensions ==== | ||
| + | |||
| + | Python IVI does not contain any IO drivers itself. | ||
| + | |||
| + | === Python VXI11 === | ||
| + | |||
| + | Python VXI11 provides a pure python TCP/IP driver for LAN based instruments that support the VXI11 protocol. | ||
| + | |||
| + | Home page: | ||
| + | http:// | ||
| + | |||
| + | GitHub repository: | ||
| + | https:// | ||
| + | |||
| + | === Python USBTMC === | ||
| + | |||
| + | Python USBTMC provides a pure python USBTMC driver for instruments that support the USB Test and Measurement Class. | ||
| + | |||
| + | Home page: | ||
| + | http:// | ||
| + | |||
| + | GitHub repository: | ||
| + | https:// | ||
| + | |||
| + | === Linux GPIB === | ||
| + | |||
| + | Python IVI provides an interface wrapper for the Linux GPIB driver. | ||
| + | |||
| + | Home page: | ||
| + | http:// | ||
| + | |||
| + | === pySerial === | ||
| + | |||
| + | Python IVI provides an interface wrapper for the pySerial library. | ||
| + | |||
| + | Home page: | ||
| + | http:// | ||
| ===== Usage example ===== | ===== Usage example ===== | ||
| - | This sample Python code will use Python IVI connect to an Agilent MSO7104A over LXI (VXI11), configure the timebase, trigger, and channel 1, capture a waveform, and read it out of the instrument. | + | This sample Python code will use Python IVI connect to an Agilent MSO7104A over LXI (VXI-11), configure the timebase, trigger, and channel 1, capture a waveform, and read it out of the instrument. |
| <code python> | <code python> | ||
| Line 33: | Line 103: | ||
| # connect to MSO7104A via LXI | # connect to MSO7104A via LXI | ||
| mso = ivi.agilent.agilentMSO7104A(" | mso = ivi.agilent.agilentMSO7104A(" | ||
| + | # connect to MSO7104A via USBTMC | ||
| + | #mso = ivi.agilent.agilentMSO7104A(" | ||
| # configure timebase | # configure timebase | ||
| mso.acquisition.time_per_record = 1e-3 | mso.acquisition.time_per_record = 1e-3 | ||
| Line 50: | Line 122: | ||
| # read out channel 1 waveform data | # read out channel 1 waveform data | ||
| waveform = mso.channels[0].measurement.fetch_waveform() | waveform = mso.channels[0].measurement.fetch_waveform() | ||
| + | # measure peak-to-peak voltage | ||
| + | vpp = mso.channels[0].measurement.fetch_waveform_measurement(" | ||
| + | # measure phase | ||
| + | phase = mso.channels[' | ||
| + | # save screenshot to file | ||
| + | png = mso.display.fetch_screenshot() | ||
| + | with open(' | ||
| + | f.write(png) | ||
| + | # save setup to file | ||
| + | setup = mso.system.fetch_setup() | ||
| + | with open(' | ||
| + | f.write(setup) | ||
| + | # restore setup from file | ||
| + | with open(' | ||
| + | setup = f.read() | ||
| + | mso.system.load_setup(setup) | ||
| </ | </ | ||
| + | |||
| + | This sample Python code will use Python IVI to connect to a Tektronix AWG2021 through a GPIB to VXI11 bridge or serial (pySerial), generate a sinewave with numpy, and transfer it to channel 1. | ||
| + | |||
| + | <code python> | ||
| + | # import Python IVI | ||
| + | import ivi | ||
| + | # import numpy | ||
| + | from numpy import * | ||
| + | # connect to AWG2021 via GPIB | ||
| + | #awg = ivi.tektronix.tektronixAWG2021(" | ||
| + | # connect to AWG2021 via E2050A GPIB to VXI11 bridge | ||
| + | awg = ivi.tektronix.tektronixAWG2021(" | ||
| + | # connect to AWG2021 via serial | ||
| + | #awg = ivi.tektronix.tektronixAWG2021(" | ||
| + | # create a waveform | ||
| + | n = 128 | ||
| + | f = 1 | ||
| + | a = 1 | ||
| + | wfm = a*sin(2*pi/ | ||
| + | # transfer to AWG2021 | ||
| + | awg.outputs[0].arbitrary.create_waveform(wfm) | ||
| + | # 2 volts peak to peak | ||
| + | awg.outputs[0].arbitrary.gain = 2.0 | ||
| + | # zero offset | ||
| + | awg.outputs[0].arbitrary.gain = 0.0 | ||
| + | # sample rate 128 MHz | ||
| + | arb.arbitrary.sample_rate = 128e6 | ||
| + | # enable ouput | ||
| + | awg.outputs[0].enabled = True | ||
| + | </ | ||
| + | |||
| + | This sample Python code will use Python IVI to connect to an Agilent E3649A and configure an output. | ||
| + | |||
| + | <code python> | ||
| + | # import Python IVI | ||
| + | import ivi | ||
| + | # connect to E3649A via GPIB | ||
| + | #psu = ivi.agilent.agilentE3649A(" | ||
| + | # connect to E3649A via E2050A GPIB to VXI11 bridge | ||
| + | psu = ivi.agilent.agilentE3649A(" | ||
| + | # connect to E3649A via serial | ||
| + | #psu = ivi.agilent.agilentE3649A(" | ||
| + | # configure output | ||
| + | psu.outputs[0].configure_range(' | ||
| + | psu.outputs[0].voltage_level = 12.0 | ||
| + | psu.outputs[0].current_limit = 1.0 | ||
| + | psu.outputs[0].ovp_limit = 14.0 | ||
| + | psu.outputs[0].ovp_enabled = True | ||
| + | psu.outptus[0].enabled = True | ||
| + | </ | ||
| + | |||