Skip to content

Repository files navigation

Labtoolkit

Python package for instrument control, data acquisition and automation.

Demo enumeration

importlabtoolkitimportpyvisafrompyvisa_py.tcpipimportTCPIPInstrVxi11asTCPVXI11# TCPVXI11.list_resources()rm=pyvisa.ResourceManager()
resources=rm.list_resources('(GPIB[0129]::?*::INSTR)|(USB?*)')
ignores= ['GPIB2::22::INSTR',]
resources= [resourceforresourceinresourcesifresourcenotinignores]
resources=resources+TCPVXI11.list_resources()
ignores= ['TCPIP::192.168.100.5::INSTR',]
resources= [resourceforresourceinresourcesifresourcenotinignores]
lab=labtoolkit.Enumerate(resourcemanager=rm, resources=resources)
sa=lab.enumeration.iloc[0].instsa.frequency_center=1e9sa.frequency_span=10e6sa.sweep_points=8192sa.OPCdf=sa.trace# returns a DataFrame of the trace datadf.plot(grid=True, figsize=(8, 6))
df.attrs# df.attrs are used to store metadata (sweep_time, resolution_bandwidth, etc)

Demo manual driver selection

# Communicate with Hardware with PyVISAimportpyvisaimportlabtoolkit.SpectrumAnalyser.AgilentE44nnrm=pyvisa.ResourceManager()
sa=labtookit.SpectrumAnalyser.AgilentE44nn.AgilentE44nn(rm.open_resource('GPIB0::18::INSTR'))
sa.frequency_center=1e9sa.frequency_span=10e6sa.sweep_points=8192sa.OPCdf=sa.trace# returns a DataFrame of the trace datadf.plot(grid=True, figsize=(8, 6))
df.attrs# df.attrs are used to store metadata (sweep_time, resolution_bandwidth, etc)

SpectrumAnalyser example

Badges

PyPI - LicenseGitHub top languageRead the DocsLibraries.io dependency status for latest releasePyPI - DownloadsGitHub issuesGitHub pull requestsGitHub contributorsPyPI

Authors

Acknowledgements

Makes use of

Notes

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

Units

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

GUI

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

About

Python module for instrument control and automation.

Topics

Resources

Stars

28 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages