Skip to main content

Python package for instrument control, data acquisition and automation

Project description

Labtoolkit

Python package for instrument control, data acquisition and automation.

Demo enumeration

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)

Demo manual driver selection

# 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)

SpectrumAnalyser example

Badges

PyPI - License GitHub top language Read the Docs Libraries.io dependency status for latest release PyPI - Downloads GitHub issues GitHub pull requests GitHub contributors PyPI

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

Existing xkcd: Standards

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

labtoolkit-1.4.0.tar.gz (113.1 kB view details)

Uploaded Source

Built Distribution

labtoolkit-1.4.0-py3-none-any.whl (131.1 kB view details)

Uploaded Python 3

File details

Details for the file labtoolkit-1.4.0.tar.gz.

File metadata

  • Download URL: labtoolkit-1.4.0.tar.gz
  • Upload date:
  • Size: 113.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for labtoolkit-1.4.0.tar.gz
Algorithm Hash digest
SHA256 7f277b8303c32537a396f6cd98c78b6869bb5ba420a856d74d8aa00a64e74a61
MD5 aebffcd8613e48c1c3e3a3ee64a3d5b9
BLAKE2b-256 3f70da351e23633879c73d762a761334a00f31a528baf2bbf5b133fb74ee80e0

See more details on using hashes here.

File details

Details for the file labtoolkit-1.4.0-py3-none-any.whl.

File metadata

  • Download URL: labtoolkit-1.4.0-py3-none-any.whl
  • Upload date:
  • Size: 131.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for labtoolkit-1.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4fa36708a266ba2ad6c82ee491a858da49c119d9b7d18cec49b8e2b4d2fc178b
MD5 05e652845d3da25167160acde0f23e31
BLAKE2b-256 41336a36dab6f06561513dc50890ec88b17ec3db3db63c06f7d470d0733e20a1

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page