The Spectrum Instrumentation API has extensive support for Python. There is an implementation for both low- and high-level Python programming. The low-level API is closely related to C and optimized for speed. The high-level general-purpose object-oriented API is located on Github and available through the pip repository and optimized for usability and learning how to use the cards.
Low-level Python API
The low-level Python API is directly communicating with the Spectrum Instrumentation general driver library, both on Windows (.dll) and Linux (.so). The translation from Python code to dynamic library call is done using ctypes. This low-level API supports both Python 2 and Python 3 and has no external dependencies. The package is can be downloaded in the Downloads section of the Spectrum Instrumentation website:
High-level object oriented Python package spcm
Build on top of the low-level Python API, there is a general purpose high-level object oriented Python package. This spcm package is available through the PIP repository and is easily installed using the straight-forward pip install spcm command.
The package automatically handles correct opening and closing of cards and Netbox devices, including sets of synchronizes cards. It also implements error handling through exceptions.
Moreover, the package handles allocation of memory and provides a direct interface to numpy and support for physical quantities and units through pint. A multitude of card functionalities are implemented in easy-to-use classes and examples. The spcm package can be found here:
- Spectrum Instrumentation Python package on GitHub: spcm package
- Spectrum Instrumentation Python examples on GitHub: spcm examples
- Spectrum Instrumentation Python repository on GitHub: PyPI pip repository
- Spectrum Instrumentation Python refernce documentation on GitHub: reference documentation
The spcm is free-to-use and freely available to all Spectrum Instrumentation card users under the MIT-license. The package is only available for Python 3 starting with version 3.9.