nirfmxdemod 26.3.0__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.
@@ -0,0 +1,106 @@
1
+ """nirfmxdemod package."""
2
+
3
+ __version__ = "26.3.0"
4
+
5
+ from nirfmxdemod.attributes import * # noqa: F403
6
+ from nirfmxdemod.demod import Demod, _DemodSignalConfiguration
7
+ from nirfmxdemod.enums import * # noqa: F403
8
+ from nirfmxdemod.grpc_session_options import * # noqa: F403
9
+
10
+
11
+ def get_diagnostic_information():
12
+ """Get diagnostic information about the system state that is suitable for printing or logging.
13
+ returns: dict
14
+ note: Python bitness may be incorrect when running in a virtual environment.
15
+ """
16
+ import importlib.metadata
17
+ import os
18
+ import platform
19
+ import struct
20
+ import sys
21
+
22
+ def is_python_64bit():
23
+ return struct.calcsize("P") == 8
24
+
25
+ def is_os_64bit():
26
+ return platform.machine().endswith("64")
27
+
28
+ def is_venv():
29
+ return "VIRTUAL_ENV" in os.environ
30
+
31
+ info = {} # type: ignore
32
+ info["os"] = {}
33
+ info["python"] = {}
34
+ info["driver"] = {}
35
+ info["module"] = {}
36
+ if platform.system() == "Windows":
37
+ try:
38
+ import winreg as winreg
39
+ except ImportError:
40
+ import _winreg as winreg # type: ignore
41
+
42
+ os_name = "Windows"
43
+ try:
44
+ driver_version_key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\National Instruments\RFmx\Demod\C Runtime Support") # type: ignore
45
+ driver_version = winreg.QueryValueEx(driver_version_key, "Version")[0] # type: ignore
46
+ except WindowsError: # type: ignore
47
+ driver_version = "Unknown"
48
+ else:
49
+ raise SystemError("Unsupported platform: {}".format(platform.system()))
50
+
51
+ if sys.version_info[1] >= 10:
52
+ installed_packages_names = [
53
+ name
54
+ for name_list in importlib.metadata.packages_distributions().values()
55
+ for name in name_list
56
+ ]
57
+ installed_packages_names = set(installed_packages_names) # type: ignore
58
+ installed_packages_list = [
59
+ {"name": name, "version": importlib.metadata.distribution(name).version}
60
+ for name in sorted(installed_packages_names)
61
+ ]
62
+ else:
63
+ import pkg_resources
64
+
65
+ installed_packages = pkg_resources.working_set
66
+ installed_packages_list = [
67
+ {
68
+ "name": i.key,
69
+ "version": i.version,
70
+ }
71
+ for i in installed_packages
72
+ ]
73
+
74
+ info["os"]["name"] = os_name
75
+ info["os"]["version"] = platform.version()
76
+ info["os"]["bits"] = "64" if is_os_64bit() else "32" # type: ignore
77
+ info["driver"]["name"] = "RFmx Demod"
78
+ info["driver"]["version"] = driver_version
79
+ info["module"]["name"] = "nirfmxdemod"
80
+ info["module"]["version"] = "26.3.0"
81
+ info["python"]["version"] = sys.version
82
+ info["python"]["bits"] = "64" if is_python_64bit() else "32" # type: ignore
83
+ info["python"]["is_venv"] = is_venv() # type: ignore
84
+ info["python"]["packages"] = installed_packages_list
85
+
86
+ return info
87
+
88
+
89
+ def print_diagnostic_information():
90
+ """Print diagnostic information in a format suitable for issue report.
91
+ note: Python bitness may be incorrect when running in a virtual environment.
92
+ """
93
+ info = get_diagnostic_information() # type: ignore
94
+
95
+ row_format = " {:<10"
96
+ for type in ["OS", "Driver", "Module", "Python"]:
97
+ typename = type.lower()
98
+ print(type + ":")
99
+ for item in info[typename]:
100
+ if item != "packages":
101
+ print(row_format.format(item.title() + ":", info[typename][item]))
102
+ print(" Installed Packages:")
103
+ for p in info["python"]["packages"]:
104
+ print((" " * 8) + p["name"] + "==" + p["version"])
105
+
106
+ return info
@@ -0,0 +1,31 @@
1
+ """Represents the ADemod measurement."""
2
+
3
+ import functools
4
+
5
+ import nirfmxdemod.analog_demod_configuration as configuration
6
+ import nirfmxdemod.analog_demod_results as results
7
+
8
+
9
+ def _raise_if_disposed(f):
10
+ """From https://stackoverflow.com/questions/5929107/decorators-with-parameters."""
11
+
12
+ @functools.wraps(f)
13
+ def aux(*xs, **kws):
14
+ meas_obj = xs[0] # parameter 0 is 'self' which is the measurement object
15
+ if meas_obj._signal_obj.is_disposed:
16
+ raise Exception("Cannot access a disposed Demod signal configuration")
17
+ return f(*xs, **kws)
18
+
19
+ return aux
20
+
21
+
22
+ class ADemod(object):
23
+ """Represents the ADemod measurement."""
24
+
25
+ def __init__(self, signal_obj):
26
+ """Represents the ADemod measurement."""
27
+ self._signal_obj = signal_obj
28
+ self._session_function_lock = signal_obj._session_function_lock
29
+ self._interpreter = signal_obj._interpreter
30
+ self.configuration = configuration.ADemodConfiguration(signal_obj) # type: ignore
31
+ self.results = results.ADemodResults(signal_obj) # type: ignore