spcm-core 0.0.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
spcm_core/__init__.py ADDED
@@ -0,0 +1,35 @@
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
8
+ from .constants import *
9
+ from .pyspcm import *
10
+ from .spcm_tools import *
11
+
12
+ # Versioning support using versioneer
13
+ from . import _version
14
+ __version__ = _version.get_versions()['version']
15
+
16
+ # Writing spcm_core package version to log file
17
+ try:
18
+ #from .pyspcm import spcm_dwGetParam_i64, spcm_dwSetParam_ptr, create_string_buffer, byref, int64
19
+ driver_version = int64(0)
20
+ spcm_dwGetParam_i64(None, SPC_GETDRVVERSION, byref(driver_version))
21
+ version_hex = driver_version.value
22
+ major = (version_hex & 0xFF000000) >> 24
23
+ minor = (version_hex & 0x00FF0000) >> 16
24
+ build = version_hex & 0x0000FFFF
25
+ # Available starting from build 21797
26
+ if build < 21797:
27
+ version_str = "v{}.{}.{}".format(major, minor, build)
28
+ raise OSError(f"Driver version build {version_str} does not support writing spcm version to log")
29
+ from importlib.metadata import version
30
+ version_tag = version('spcm_core')
31
+ version_str = bytes("Python package spcm_core v{}".format(version_tag), "utf-8")
32
+ version_ptr = create_string_buffer(version_str)
33
+ dwErr = spcm_dwSetParam_ptr(None, SPC_WRITE_TO_LOG, version_ptr, len(version_str))
34
+ except OSError as e:
35
+ print(e)