pyscpi
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.
Metadata
Release files for pyscpi 0.5.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| pyscpi-0.5.3.tar.gz | 15.0 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyscpi-0.5.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 28.9 kB
Release files / pyscpi-0.5.3.tar.gz
| Download URL | pyscpi-0.5.3.tar.gz |
|---|---|
| Size | 15.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7652931d0afa24feccf30069b9072ac84346ab8d2b08d492d7f840178d7fb762
|
|
BLAKE2b-256 checksum How to use checksums |
d4b39a476b5911483eb7afc894368cde6bb197b3dc8ddab106673a24a1f214ad
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.6
|
Release files / pyscpi-0.5.3-py3-none-any.whl
| Download URL | pyscpi-0.5.3-py3-none-any.whl |
|---|---|
| Size | 13.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
991c97de84404c7c5989a67df2ea7d0af62b823eded7facaf4412e0b731da73e
|
|
BLAKE2b-256 checksum How to use checksums |
b8cd34c122cec510c3e8afce94083cda14a36abc6c8be72908cf82221a40c22f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.6
|
Security for pyscpi 0.5.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.