nirfmxlte 26.0.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.
- nirfmxlte/__init__.py +106 -0
- nirfmxlte/acp.py +31 -0
- nirfmxlte/acp_component_carrier_results.py +208 -0
- nirfmxlte/acp_configuration.py +3661 -0
- nirfmxlte/acp_results.py +809 -0
- nirfmxlte/attributes.py +5800 -0
- nirfmxlte/chp.py +31 -0
- nirfmxlte/chp_component_carrier_results.py +205 -0
- nirfmxlte/chp_configuration.py +2107 -0
- nirfmxlte/chp_results.py +342 -0
- nirfmxlte/component_carrier.py +8909 -0
- nirfmxlte/enums.py +1793 -0
- nirfmxlte/errors.py +96 -0
- nirfmxlte/examples/nirfmxlte_acp_single_carrier.py +212 -0
- nirfmxlte/examples/nirfmxlte_chp_single_carrier.py +146 -0
- nirfmxlte/examples/nirfmxlte_sem_single_carrier.py +215 -0
- nirfmxlte/examples/nirfmxlte_ul_modacc_single_carrier.py +198 -0
- nirfmxlte/examples/nirfmxlte_ul_pvt_single_carrier_grpc.py +223 -0
- nirfmxlte/grpc_session_options.py +64 -0
- nirfmxlte/internal/_custom_types.py +13 -0
- nirfmxlte/internal/_grpc_stub_interpreter.py +3109 -0
- nirfmxlte/internal/_helper.py +279 -0
- nirfmxlte/internal/_library.py +7107 -0
- nirfmxlte/internal/_library_interpreter.py +6852 -0
- nirfmxlte/internal/_library_singleton.py +53 -0
- nirfmxlte/internal/nidevice_pb2.py +37 -0
- nirfmxlte/internal/nidevice_pb2_grpc.py +3 -0
- nirfmxlte/internal/nirfmxlte_pb2.py +1558 -0
- nirfmxlte/internal/nirfmxlte_pb2_grpc.py +15243 -0
- nirfmxlte/internal/session_pb2.py +33 -0
- nirfmxlte/internal/session_pb2_grpc.py +3 -0
- nirfmxlte/lte.py +5000 -0
- nirfmxlte/modacc.py +31 -0
- nirfmxlte/modacc_configuration.py +3226 -0
- nirfmxlte/modacc_results.py +7218 -0
- nirfmxlte/obw.py +31 -0
- nirfmxlte/obw_configuration.py +1282 -0
- nirfmxlte/obw_results.py +291 -0
- nirfmxlte/pvt.py +31 -0
- nirfmxlte/pvt_configuration.py +937 -0
- nirfmxlte/pvt_results.py +457 -0
- nirfmxlte/sem.py +31 -0
- nirfmxlte/sem_component_carrier_configuration.py +252 -0
- nirfmxlte/sem_component_carrier_results.py +275 -0
- nirfmxlte/sem_configuration.py +3378 -0
- nirfmxlte/sem_results.py +2155 -0
- nirfmxlte/slotphase.py +31 -0
- nirfmxlte/slotphase_configuration.py +793 -0
- nirfmxlte/slotphase_results.py +320 -0
- nirfmxlte/slotpower.py +31 -0
- nirfmxlte/slotpower_configuration.py +555 -0
- nirfmxlte/slotpower_results.py +79 -0
- nirfmxlte/txp.py +31 -0
- nirfmxlte/txp_configuration.py +649 -0
- nirfmxlte/txp_results.py +207 -0
- nirfmxlte-26.0.0.dist-info/METADATA +268 -0
- nirfmxlte-26.0.0.dist-info/RECORD +59 -0
- nirfmxlte-26.0.0.dist-info/WHEEL +4 -0
- nirfmxlte-26.0.0.dist-info/licenses/LICENSE +30 -0
nirfmxlte/__init__.py
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"""nirfmxlte package."""
|
|
2
|
+
|
|
3
|
+
__version__ = "26.0.0"
|
|
4
|
+
|
|
5
|
+
from nirfmxlte.attributes import * # noqa: F403
|
|
6
|
+
from nirfmxlte.enums import * # noqa: F403
|
|
7
|
+
from nirfmxlte.grpc_session_options import * # noqa: F403
|
|
8
|
+
from nirfmxlte.lte import Lte, _LteSignalConfiguration
|
|
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\LTE\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 LTE"
|
|
78
|
+
info["driver"]["version"] = driver_version
|
|
79
|
+
info["module"]["name"] = "nirfmxlte"
|
|
80
|
+
info["module"]["version"] = "26.0.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
|
nirfmxlte/acp.py
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"""Represents the Acp measurement."""
|
|
2
|
+
|
|
3
|
+
import functools
|
|
4
|
+
|
|
5
|
+
import nirfmxlte.acp_configuration as configuration
|
|
6
|
+
import nirfmxlte.acp_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 Lte signal configuration")
|
|
17
|
+
return f(*xs, **kws)
|
|
18
|
+
|
|
19
|
+
return aux
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class Acp(object):
|
|
23
|
+
"""Represents the Acp measurement."""
|
|
24
|
+
|
|
25
|
+
def __init__(self, signal_obj):
|
|
26
|
+
"""Represents the Acp 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.AcpConfiguration(signal_obj) # type: ignore
|
|
31
|
+
self.results = results.AcpResults(signal_obj) # type: ignore
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
""""""
|
|
2
|
+
|
|
3
|
+
import functools
|
|
4
|
+
|
|
5
|
+
import nirfmxlte.attributes as attributes
|
|
6
|
+
import nirfmxlte.errors as errors
|
|
7
|
+
import nirfmxlte.internal._helper as _helper
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def _raise_if_disposed(f):
|
|
11
|
+
"""From https://stackoverflow.com/questions/5929107/decorators-with-parameters."""
|
|
12
|
+
|
|
13
|
+
@functools.wraps(f)
|
|
14
|
+
def aux(*xs, **kws):
|
|
15
|
+
meas_obj = xs[0] # parameter 0 is 'self' which is the measurement object
|
|
16
|
+
if meas_obj._signal_obj.is_disposed:
|
|
17
|
+
raise Exception("Cannot access a disposed Lte signal configuration")
|
|
18
|
+
return f(*xs, **kws)
|
|
19
|
+
|
|
20
|
+
return aux
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class AcpComponentCarrierResults(object):
|
|
24
|
+
""""""
|
|
25
|
+
|
|
26
|
+
def __init__(self, signal_obj):
|
|
27
|
+
""""""
|
|
28
|
+
self._signal_obj = signal_obj
|
|
29
|
+
self._session_function_lock = signal_obj._session_function_lock
|
|
30
|
+
self._interpreter = signal_obj._interpreter
|
|
31
|
+
|
|
32
|
+
@_raise_if_disposed
|
|
33
|
+
def get_absolute_power(self, selector_string):
|
|
34
|
+
r"""Gets the power measured over the integration bandwidth of the carrier. The carrier power is reported in dBm when you
|
|
35
|
+
set the :py:attr:`~nirfmxlte.attributes.AttributeID.ACP_POWER_UNITS` attribute to **dBm**, and in dBm/Hz when you set
|
|
36
|
+
the ACP Pwr Units attribute to **dBm/Hz**.
|
|
37
|
+
|
|
38
|
+
Use "carrier<*k*>" or "subblock<*n*>/carrier<*k*>" as the selector string to read this result.
|
|
39
|
+
|
|
40
|
+
Args:
|
|
41
|
+
selector_string (string):
|
|
42
|
+
Pass an empty string.
|
|
43
|
+
|
|
44
|
+
Returns:
|
|
45
|
+
Tuple (attr_val, error_code):
|
|
46
|
+
|
|
47
|
+
attr_val (float):
|
|
48
|
+
Returns the power measured over the integration bandwidth of the carrier. The carrier power is reported in dBm when you
|
|
49
|
+
set the :py:attr:`~nirfmxlte.attributes.AttributeID.ACP_POWER_UNITS` attribute to **dBm**, and in dBm/Hz when you set
|
|
50
|
+
the ACP Pwr Units attribute to **dBm/Hz**.
|
|
51
|
+
|
|
52
|
+
error_code (int):
|
|
53
|
+
Returns the status code of this method. The status code either indicates success or describes a warning condition.
|
|
54
|
+
"""
|
|
55
|
+
try:
|
|
56
|
+
self._session_function_lock.enter_read_lock()
|
|
57
|
+
updated_selector_string = _helper.validate_and_update_selector_string(
|
|
58
|
+
selector_string, self._signal_obj
|
|
59
|
+
)
|
|
60
|
+
attr_val, error_code = self._interpreter.get_attribute_f64(
|
|
61
|
+
updated_selector_string,
|
|
62
|
+
attributes.AttributeID.ACP_RESULTS_COMPONENT_CARRIER_ABSOLUTE_POWER.value,
|
|
63
|
+
)
|
|
64
|
+
finally:
|
|
65
|
+
self._session_function_lock.exit_read_lock()
|
|
66
|
+
|
|
67
|
+
return attr_val, error_code
|
|
68
|
+
|
|
69
|
+
@_raise_if_disposed
|
|
70
|
+
def get_relative_power(self, selector_string):
|
|
71
|
+
r"""Gets the component carrier power relative to its subblock power. This value is expressed in dB.
|
|
72
|
+
|
|
73
|
+
Use "carrier<*k*>" or "subblock<*n*>/carrier<*k*>" as the selector string to read this result.
|
|
74
|
+
|
|
75
|
+
Args:
|
|
76
|
+
selector_string (string):
|
|
77
|
+
Pass an empty string.
|
|
78
|
+
|
|
79
|
+
Returns:
|
|
80
|
+
Tuple (attr_val, error_code):
|
|
81
|
+
|
|
82
|
+
attr_val (float):
|
|
83
|
+
Returns the component carrier power relative to its subblock power. This value is expressed in dB.
|
|
84
|
+
|
|
85
|
+
error_code (int):
|
|
86
|
+
Returns the status code of this method. The status code either indicates success or describes a warning condition.
|
|
87
|
+
"""
|
|
88
|
+
try:
|
|
89
|
+
self._session_function_lock.enter_read_lock()
|
|
90
|
+
updated_selector_string = _helper.validate_and_update_selector_string(
|
|
91
|
+
selector_string, self._signal_obj
|
|
92
|
+
)
|
|
93
|
+
attr_val, error_code = self._interpreter.get_attribute_f64(
|
|
94
|
+
updated_selector_string,
|
|
95
|
+
attributes.AttributeID.ACP_RESULTS_COMPONENT_CARRIER_RELATIVE_POWER.value,
|
|
96
|
+
)
|
|
97
|
+
finally:
|
|
98
|
+
self._session_function_lock.exit_read_lock()
|
|
99
|
+
|
|
100
|
+
return attr_val, error_code
|
|
101
|
+
|
|
102
|
+
@_raise_if_disposed
|
|
103
|
+
def fetch_measurement_array(self, selector_string, timeout):
|
|
104
|
+
r"""Returns an array of the absolute and relative powers of the component carriers. The relative power is relative to the
|
|
105
|
+
subblock power.
|
|
106
|
+
|
|
107
|
+
Use "subblock<*n*>" as the selector string to read results from this method.
|
|
108
|
+
|
|
109
|
+
Args:
|
|
110
|
+
selector_string (string):
|
|
111
|
+
This parameter specifies a `Selector String
|
|
112
|
+
<https://www.ni.com/docs/en-US/bundle/rfmx/page/selector-strings-net.html>`_ comprising of result
|
|
113
|
+
name, and subblock number.
|
|
114
|
+
|
|
115
|
+
Example:
|
|
116
|
+
|
|
117
|
+
"subblock0"
|
|
118
|
+
|
|
119
|
+
"result::r1/subblock0"
|
|
120
|
+
|
|
121
|
+
You can use the :py:meth:`build_subblock_string` method to build the selector string.
|
|
122
|
+
|
|
123
|
+
timeout (float):
|
|
124
|
+
This parameter specifies the timeout for fetching the specified measurement. This value is expressed in seconds. Set
|
|
125
|
+
this value to an appropriate time, longer than expected for fetching the measurement. A value of -1 specifies that the
|
|
126
|
+
method waits until the measurement is complete. The default value is 10.
|
|
127
|
+
|
|
128
|
+
Returns:
|
|
129
|
+
Tuple (absolute_power, relative_power, error_code):
|
|
130
|
+
|
|
131
|
+
absolute_power (float):
|
|
132
|
+
This parameter returns the array of powers measured over the integration bandwidths of the carriers. The carrier power
|
|
133
|
+
is reported in dBm when you set the :py:attr:`~nirfmxlte.attributes.AttributeID.ACP_POWER_UNITS` attribute to **dBm**,
|
|
134
|
+
and in dBm/Hz when you set the ACP Pwr Units attribute to **dBm/Hz**.
|
|
135
|
+
|
|
136
|
+
relative_power (float):
|
|
137
|
+
This parameter returns the array of component carrier powers relative to their subblock powers measured over the
|
|
138
|
+
integration bandwidths of the component carriers in the subblock. This value is expressed in dB.
|
|
139
|
+
|
|
140
|
+
error_code (int):
|
|
141
|
+
Returns the status code of this method. The status code either indicates success or describes a warning condition.
|
|
142
|
+
"""
|
|
143
|
+
try:
|
|
144
|
+
self._session_function_lock.enter_read_lock()
|
|
145
|
+
_helper.validate_not_none(selector_string, "selector_string")
|
|
146
|
+
updated_selector_string = _helper.validate_and_update_selector_string(
|
|
147
|
+
selector_string, self._signal_obj
|
|
148
|
+
)
|
|
149
|
+
absolute_power, relative_power, error_code = (
|
|
150
|
+
self._interpreter.acp_fetch_measurement_array(updated_selector_string, timeout)
|
|
151
|
+
)
|
|
152
|
+
finally:
|
|
153
|
+
self._session_function_lock.exit_read_lock()
|
|
154
|
+
|
|
155
|
+
return absolute_power, relative_power, error_code
|
|
156
|
+
|
|
157
|
+
@_raise_if_disposed
|
|
158
|
+
def fetch_measurement(self, selector_string, timeout):
|
|
159
|
+
r"""Fetches the ACP component carrier measurement.
|
|
160
|
+
|
|
161
|
+
Use "carrier<*k*>" or "subblock<*n*>/carrier<*k*>" as the selector string to read results from this method.
|
|
162
|
+
|
|
163
|
+
Args:
|
|
164
|
+
selector_string (string):
|
|
165
|
+
This parameter specifies a `Selector String
|
|
166
|
+
<https://www.ni.com/docs/en-US/bundle/rfmx/page/selector-strings-net.html>`_ comprising of result
|
|
167
|
+
name, subblock number, and carrier number.
|
|
168
|
+
|
|
169
|
+
Example:
|
|
170
|
+
|
|
171
|
+
"subblock0/carrier0"
|
|
172
|
+
|
|
173
|
+
"result::r1/subblock0/carrier0"
|
|
174
|
+
|
|
175
|
+
You can use the :py:meth:`build_carrier_string` method to build the selector string.
|
|
176
|
+
|
|
177
|
+
timeout (float):
|
|
178
|
+
This parameter specifies the timeout for fetching the specified measurement. This value is expressed in seconds. Set
|
|
179
|
+
this value to an appropriate time, longer than expected for fetching the measurement. A value of -1 specifies that the
|
|
180
|
+
method waits until the measurement is complete. The default value is 10.
|
|
181
|
+
|
|
182
|
+
Returns:
|
|
183
|
+
Tuple (absolute_power, relative_power, error_code):
|
|
184
|
+
|
|
185
|
+
absolute_power (float):
|
|
186
|
+
This parameter returns the power measured over the integration bandwidth of the carrier. The carrier power is reported
|
|
187
|
+
in dBm when you set the :py:attr:`~nirfmxlte.attributes.AttributeID.ACP_POWER_UNITS` attribute to **dBm**, and in
|
|
188
|
+
dBm/Hz when you set the ACP Pwr Units attribute to **dBm/Hz**.
|
|
189
|
+
|
|
190
|
+
relative_power (float):
|
|
191
|
+
This parameter returns the component carrier power relative to its subblock power. This value is expressed in dB.
|
|
192
|
+
|
|
193
|
+
error_code (int):
|
|
194
|
+
Returns the status code of this method. The status code either indicates success or describes a warning condition.
|
|
195
|
+
"""
|
|
196
|
+
try:
|
|
197
|
+
self._session_function_lock.enter_read_lock()
|
|
198
|
+
_helper.validate_not_none(selector_string, "selector_string")
|
|
199
|
+
updated_selector_string = _helper.validate_and_update_selector_string(
|
|
200
|
+
selector_string, self._signal_obj
|
|
201
|
+
)
|
|
202
|
+
absolute_power, relative_power, error_code = self._interpreter.acp_fetch_measurement(
|
|
203
|
+
updated_selector_string, timeout
|
|
204
|
+
)
|
|
205
|
+
finally:
|
|
206
|
+
self._session_function_lock.exit_read_lock()
|
|
207
|
+
|
|
208
|
+
return absolute_power, relative_power, error_code
|