Python package for instrument control, data acquisition and automation.
import labtoolkit
import pyvisa
from pyvisa_py.tcpip import TCPIPInstrVxi11 as TCPVXI11 # TCPVXI11.list_resources()
rm = pyvisa.ResourceManager()
resources = rm.list_resources('(GPIB[0129]::?*::INSTR)|(USB?*)')
ignores = ['GPIB2::22::INSTR',]
resources = [resource for resource in resources if resource not in ignores]
resources = resources + TCPVXI11.list_resources()
ignores = ['TCPIP::192.168.100.5::INSTR',]
resources = [resource for resource in resources if resource not in ignores]
lab = labtoolkit.Enumerate(resourcemanager=rm, resources=resources)
sa = lab.enumeration.iloc[0].inst
sa.frequency_center = 1e9
sa.frequency_span = 10e6
sa.sweep_points = 8192
sa.OPC
df = sa.trace
# returns a DataFrame of the trace data
df.plot(grid=True, figsize=(8, 6))
df.attrs
# df.attrs are used to store metadata (sweep_time, resolution_bandwidth, etc)
# Communicate with Hardware with PyVISA
import pyvisa
import labtoolkit.SpectrumAnalyser.AgilentE44nn
rm = pyvisa.ResourceManager()
sa = labtookit.SpectrumAnalyser.AgilentE44nn.AgilentE44nn(rm.open_resource('GPIB0::18::INSTR'))
sa.frequency_center = 1e9
sa.frequency_span = 10e6
sa.sweep_points = 8192
sa.OPC
df = sa.trace
# returns a DataFrame of the trace data
df.plot(grid=True, figsize=(8, 6))
df.attrs
# df.attrs are used to store metadata (sweep_time, resolution_bandwidth, etc)
- NumPy
- pandas - Python Data Analysis Library
- PyVISA - Control your instruments with Python
- PyVISA-py - Pure Python backend for PyVISA
- pytest - helps you write better programs
Lots of the libaries that exist around PyVISA start their own ResourceManager.
Some intentionally operate differently when using a different interface (GPIB, LAN, USB, serial)
Absolutely no changes needed to run on Linux or Windows (I don't have a Mac to test with)
To rescan the avalable instruments if needed (between tests)
To assign drivers that simplify setting and retreaving data from instruments. Which provide a fairly common interface to instruments of the same kind (spectrum analyser, oscilloscope, VNA)
Do most of the instrument response conversion out of view (see query_bool
or query_float
)
Make sure I could explain how this driver layer behaves to test enginners or auditors
I know I am at least number 15 in this situation xkcd: Standards
I will be processing reasonably sized arrays (8k min or 40k to 100k on spectrum analyser) more from an oscilloscope so Numpy and Pandas are essential
Wherever practicible units returned are in the basic unit
Wherever practicible inputs units are in the basic unit
For example 5e-12 rather than 5 ps
Use ... for formatting when passing to users as needed
I have used JupyterLab for myself
And for a couple of single flow applications I have used Voilà to turn Jupyter notebooks into standalone web applications
As it stands I'm planning on using Dear PyGui: A fast and powerful Graphical User Interface Toolkit for Python with minimal dependencies
Existing xkcd: Standards
- KE5FX GPIB Toolkit
- Galvant/InstrumentKit has stripped numpy out
- LabPy/lantz has gone quiet
- p3trus/slave has gone quiet, (breakdown of IEEE 488.2 is tidy
- python-ivi/python-iv has gone quiet, more RF focused.
- QCoDeS/Qcodes
- scikit-rf/scikit-rf: RF and Microwave Engineering
- ...
- relationship between pyvisa, lantz, slave, etc · Issue #23 · python-ivi/python-ivi
- Catalog the python lab automation landscape · Issue #23 · LabPy/labpy-discussion
- REVIEW: Hardware-Control: Instrument Control and Automation Package · Issue #2688 · openjournals/joss-reviews
- berkeleylab / hardware-control — Bitbucket
- python-data-acquisition/meta
- pycro-manager focues on microscope optical tasks, has Java controller.
- yaq seems to run daemons for everything
- Adding Additional RF Instrument Support · Galvant/InstrumentKit
- QCoDeS/Qcodes Modular data acquisition framework 15 minutes to QCoDeS
- pymeasure: Scientific measurement library for instruments, experiments, and live-plotting
- ...
- VISA GPIB HP-Agilent-Keysight-equipment@groups.io | GPIB toolkit on Linux ?
- HP-Agilent-Keysight-equipment@groups.io | HP8695E HPIB Commands
- Creating and Editing Waveforms with Keysight PathWave BenchVue Software | Keysight Blogs
- Exopy’s documentation
- Instrbuilder: Easy Instrument Control with Python