SpikeSafe Python Library
Project description
spikesafe-python
The official Python driver supporting Vektrex SpikeSafe products:
Vektrex SpikeSafe Python API used for automation of custom instrument control sequences for testing LED, laser, and electronic equipment.
The Vektrex SpikeSafe Python API powers the Python examples published on Github.
GitHub Repository: SpikeSafe Python Samples
Library help documentation: spikesafe_python_lib_docs
About
The spikesafe-python package provides light-weight access Python helper classes and functions to easily communicate with to your SpikeSafe and parse data into easy to use objects.
spikesafe-python supports all operating systems that support the free Python interpreter.
spikesafe-python follows Python Software Foundation for supporting different versions.
Installation
Install the latest stable version of spikesafe-python with pip:
$ python -m pip install spikesafe-python
Usage
Easily connect to a SpikeSafe and read its identification:
from spikesafe_python.TcpSocket import TcpSocket
# create socket and connect to SpikeSafe
tcp_socket = TcpSocket()
tcp_socket.open_socket('10.0.0.220', 8282)
# request and read SpikeSafe identification
tcp_socket.send_scpi_command('*IDN?')
idn = tcp_socket.read_data()
print(idn)
Simply use a SpikeSafe to power on a 3V LED/laser for 10 seconds and read its voltage:
from spikesafe_python.MemoryTableReadData import MemoryTableReadData
from spikesafe_python.TcpSocket import TcpSocket
from spikesafe_python.Threading import wait
# create socket and connect to SpikeSafe
tcp_socket = TcpSocket()
tcp_socket.open_socket('10.0.0.220', 8282)
# set SpikeSafe current to 100 mA, compliance voltage to 10V, and turn it on
tcp_socket.send_scpi_command('SOUR1:CURR 0.1')
tcp_socket.send_scpi_command('SOUR1:VOLT 10')
tcp_socket.send_scpi_command('OUTP1 1')
# wait 10 seconds for LED/laser to power on
wait(10)
# read and parse LED/laser data
data = tcp_socket.read_data()
memory_table_read = MemoryTableReadData().parse_memory_table_read(data)
print(memory_table_read.channel_data[0].voltage_reading)
Connect to more than one SpikeSafe:
from spikesafe_python.TcpSocket import TcpSocket
# create socket and connect to SpikeSafe 1
spike_safe_1 = TcpSocket()
spike_safe_1.open_socket('10.0.0.220', 8282)
# create socket and connect to SpikeSafe 2
spike_safe_2 = TcpSocket()
spike_safe_2.open_socket('10.0.0.221', 8282)
Support / Feedback
For further assistance with spikesafe-python please contact Vektrex support at support@vektrex.com. This page is regularly monitored and maintained by Vektrex engineers.
Built With
Versioning
We use SemVer for versioning.
Authors
License
spikesafe-python is licensed under the MIT license, which allows for non-commercial and commercial use.
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
Built Distribution
Hashes for spikesafe_python-1.4.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e163098a25a8da06af2d494c86368095d608375b3db9d277ad4b38b2d046df3c |
|
MD5 | f5d383f130d927efc2e46c8ab04a3942 |
|
BLAKE2b-256 | ce89d3bd7c9fdbc16b9a71a41312f4cf9b48e9fe8e36bba83f794ebffe2341e8 |