spcm_core
A low-level Python API package for interfacing with Spectrum Instrumentation GmbH devices.
spcm_core
can handle individual cards, StarHubs, groups of cards and Netboxes
Notes
- See the files
regs.py
andspcerr.py
for an extensive list of all the register names and errors that are handled by the driver. - For more information, please have a look at our hardware specific user manuals.
See also
Supported devices
The following product families are supported:
M2i, M3i, M4i, M4x, M2p, M5i
1""" 2.. include:: ./README.md 3 4.. include:: ./SUPPORTED_DEVICES.md 5""" 6 7# Import all registery entries and spectrum card errors into the module's name space 8from .constants import * 9from .pyspcm import * 10from .spcm_tools import * 11 12from . import constants 13from . import regs 14from . import spcerr as errors 15 16# Versioning support using versioneer 17from . import _version 18__version__ = _version.get_versions()['version'] 19 20# Writing spcm_core package version to log file 21try: 22 #from .pyspcm import spcm_dwGetParam_i64, spcm_dwSetParam_ptr, create_string_buffer, byref, int64 23 driver_version = int64(0) 24 spcm_dwGetParam_i64(None, SPC_GETDRVVERSION, byref(driver_version)) 25 version_hex = driver_version.value 26 major = (version_hex & 0xFF000000) >> 24 27 minor = (version_hex & 0x00FF0000) >> 16 28 build = version_hex & 0x0000FFFF 29 # Available starting from build 21797 30 if build < 21797: 31 version_str = "v{}.{}.{}".format(major, minor, build) 32 raise OSError(f"Driver version build {version_str} does not support writing spcm version to log") 33 from importlib.metadata import version 34 version_tag = version('spcm_core') 35 version_str = bytes("Python package spcm_core v{}".format(version_tag), "utf-8") 36 version_ptr = create_string_buffer(version_str) 37 dwErr = spcm_dwSetParam_ptr(None, SPC_WRITE_TO_LOG, version_ptr, len(version_str)) 38except OSError as e: 39 print(e)