Skip to main content

A Python library for communicating with SCPI devices and a helper library for communicating with the Keysight's Smart Bench Essentials

Project description

pyscpi

PyPI version

A Python library for communicating with SCPI devices and a helper library for communicating with the Keysight's Smart Bench Essentials educational equipment. The library communicates using multiple backends including PyVisa, USBTMC and socket communication. The library also provides helper functions for reading oscilloscope waveforms and plotting them.

Using PyVisa and Keysight's IOLibrary

you need to install Keysight's IOLibrary and PyVisa.

Using alternative methods including usb and ethernet

You can use USBTMC, a standard for communicating with instruments using USB using generic drivers. This method works both in Windows and WSL2. Alternatively, you can use the standard TCP/IP sockets to communicate with the instrument. However, you need to connect the instrument on the same network as your computer, either using a direct ethernet cable or a switch/router. If you are not using a router, then you may need to set the instrument's IP address manually or use a DHCP server for dynamic IP allocation. Further information can be found in the here.

Getting Started

Installing

You can install the library using pip:

python -m pip install --upgrade pyscpi

connecting to the instrument using PyVisa

import pyvisa as visa

rm = visa.ResourceManager()
inst = rm.open_resource('<resource address>')

print(inst.query('*IDN?'))

connecting to the instrument using USBTMC

from pyscpi import usbtmc

inst =  usbtmc.Instrument(<VendorID>, <ProductID>)

print(inst.query("*IDN?"))

connecting to the instrument using socket (driverless)

from pyscpi import scpi

inst = scpi.Instrument('<IP address>', 5025)

print(inst.query('*IDN?'))

Reading oscilloscope waveform

from pyscpi.keysight import osc
import numpy as np

t, y1 = osc.readSingleChannel(inst, 1)

Plotting oscilloscope waveform

# %matplotlib ipympl
import matplotlib.pyplot as plt

plt.plot(t, y1)
plt.show()

closing the connection

inst.close()

Acknowledgments

Thanks to Keysight Education for providing the Smart Bench Essentials educational equipment.

USBTMC is used for communicating with the instruments using USB.

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

pyscpi-0.5.3.tar.gz (15.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyscpi-0.5.3-py3-none-any.whl (13.9 kB view details)

Uploaded Python 3

File details

Details for the file pyscpi-0.5.3.tar.gz.

File metadata

  • Download URL: pyscpi-0.5.3.tar.gz
  • Upload date:
  • Size: 15.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for pyscpi-0.5.3.tar.gz
Algorithm Hash digest
SHA256 7652931d0afa24feccf30069b9072ac84346ab8d2b08d492d7f840178d7fb762
MD5 495925ee5b524bf0512ef10d10f9e88a
BLAKE2b-256 d4b39a476b5911483eb7afc894368cde6bb197b3dc8ddab106673a24a1f214ad

See more details on using hashes here.

File details

Details for the file pyscpi-0.5.3-py3-none-any.whl.

File metadata

  • Download URL: pyscpi-0.5.3-py3-none-any.whl
  • Upload date:
  • Size: 13.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for pyscpi-0.5.3-py3-none-any.whl
Algorithm Hash digest
SHA256 991c97de84404c7c5989a67df2ea7d0af62b823eded7facaf4412e0b731da73e
MD5 6586ea6fc86c153e29d1109276e90e9a
BLAKE2b-256 b8cd34c122cec510c3e8afce94083cda14a36abc6c8be72908cf82221a40c22f

See more details on using hashes here.

Supported by

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