nirfmxvna 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.
Files changed (38) hide show
  1. nirfmxvna/__init__.py +106 -0
  2. nirfmxvna/attributes.py +2234 -0
  3. nirfmxvna/enums.py +1048 -0
  4. nirfmxvna/errors.py +96 -0
  5. nirfmxvna/examples/nirfmxvna_calibration_with_calset_save_two_port.py +186 -0
  6. nirfmxvna/examples/nirfmxvna_pulsed_s_params.py +174 -0
  7. nirfmxvna/examples/nirfmxvna_s_params_corrected_with_calset_load_two_port_grpc.py +234 -0
  8. nirfmxvna/examples/nirfmxvna_waves.py +174 -0
  9. nirfmxvna/grpc_session_options.py +64 -0
  10. nirfmxvna/internal/_custom_types.py +13 -0
  11. nirfmxvna/internal/_grpc_stub_interpreter.py +1757 -0
  12. nirfmxvna/internal/_helper.py +387 -0
  13. nirfmxvna/internal/_library.py +3790 -0
  14. nirfmxvna/internal/_library_interpreter.py +3011 -0
  15. nirfmxvna/internal/_library_singleton.py +53 -0
  16. nirfmxvna/internal/nidevice_pb2.py +37 -0
  17. nirfmxvna/internal/nidevice_pb2_grpc.py +3 -0
  18. nirfmxvna/internal/nirfmxvna_pb2.py +1094 -0
  19. nirfmxvna/internal/nirfmxvna_pb2_grpc.py +9990 -0
  20. nirfmxvna/internal/session_pb2.py +33 -0
  21. nirfmxvna/internal/session_pb2_grpc.py +3 -0
  22. nirfmxvna/iq.py +31 -0
  23. nirfmxvna/iq_configuration.py +290 -0
  24. nirfmxvna/iq_results.py +108 -0
  25. nirfmxvna/marker.py +31 -0
  26. nirfmxvna/marker_configuration.py +429 -0
  27. nirfmxvna/marker_results.py +168 -0
  28. nirfmxvna/s_params.py +31 -0
  29. nirfmxvna/s_params_configuration.py +1656 -0
  30. nirfmxvna/s_params_results.py +244 -0
  31. nirfmxvna/vna.py +12920 -0
  32. nirfmxvna/waves.py +31 -0
  33. nirfmxvna/waves_configuration.py +1255 -0
  34. nirfmxvna/waves_results.py +235 -0
  35. nirfmxvna-26.3.0.dist-info/METADATA +228 -0
  36. nirfmxvna-26.3.0.dist-info/RECORD +38 -0
  37. nirfmxvna-26.3.0.dist-info/WHEEL +4 -0
  38. nirfmxvna-26.3.0.dist-info/licenses/LICENSE +30 -0
@@ -0,0 +1,1656 @@
1
+ """Provides methods to configure the SParams measurement."""
2
+
3
+ import functools
4
+
5
+ import nirfmxvna.attributes as attributes
6
+ import nirfmxvna.enums as enums
7
+ import nirfmxvna.errors as errors
8
+ import nirfmxvna.internal._helper as _helper
9
+
10
+
11
+ def _raise_if_disposed(f):
12
+ """From https://stackoverflow.com/questions/5929107/decorators-with-parameters."""
13
+
14
+ @functools.wraps(f)
15
+ def aux(*xs, **kws):
16
+ meas_obj = xs[0] # parameter 0 is 'self' which is the measurement object
17
+ if meas_obj._signal_obj.is_disposed:
18
+ raise Exception("Cannot access a disposed Vna signal configuration")
19
+ return f(*xs, **kws)
20
+
21
+ return aux
22
+
23
+
24
+ class SParamsConfiguration(object):
25
+ """Provides methods to configure the SParams measurement."""
26
+
27
+ def __init__(self, signal_obj):
28
+ """Provides methods to configure the SParams measurement."""
29
+ self._signal_obj = signal_obj
30
+ self._session_function_lock = signal_obj._session_function_lock
31
+ self._interpreter = signal_obj._interpreter
32
+
33
+ @_raise_if_disposed
34
+ def get_measurement_enabled(self, selector_string):
35
+ r"""Gets whether to enable the Sparams measurement.
36
+
37
+ You do not need to use a selector string to configure or read this attribute for the default signal instance.
38
+ Refer to the `Selector String <https://www.ni.com/docs/en-US/bundle/rfmx/page/selector-strings-net.html>`_ topic for
39
+ information about the string syntax for named signals.
40
+
41
+ The default value is **False**.
42
+
43
+ Args:
44
+ selector_string (string):
45
+ Pass an empty string.
46
+
47
+ Returns:
48
+ Tuple (attr_val, error_code):
49
+
50
+ attr_val (bool):
51
+ Specifies whether to enable the Sparams measurement.
52
+
53
+ error_code (int):
54
+ Returns the status code of this method. The status code either indicates success or describes a warning condition.
55
+ """
56
+ try:
57
+ self._session_function_lock.enter_read_lock()
58
+ updated_selector_string = _helper.validate_and_update_selector_string(
59
+ selector_string, self._signal_obj
60
+ )
61
+ attr_val, error_code = self._interpreter.get_attribute_i32(
62
+ updated_selector_string, attributes.AttributeID.SPARAMS_MEASUREMENT_ENABLED.value
63
+ )
64
+ attr_val = bool(attr_val)
65
+ finally:
66
+ self._session_function_lock.exit_read_lock()
67
+
68
+ return attr_val, error_code
69
+
70
+ @_raise_if_disposed
71
+ def set_measurement_enabled(self, selector_string, value):
72
+ r"""Sets whether to enable the Sparams measurement.
73
+
74
+ You do not need to use a selector string to configure or read this attribute for the default signal instance.
75
+ Refer to the `Selector String <https://www.ni.com/docs/en-US/bundle/rfmx/page/selector-strings-net.html>`_ topic for
76
+ information about the string syntax for named signals.
77
+
78
+ The default value is **False**.
79
+
80
+ Args:
81
+ selector_string (string):
82
+ Pass an empty string.
83
+
84
+ value (bool):
85
+ Specifies whether to enable the Sparams measurement.
86
+
87
+ Returns:
88
+ int:
89
+ Returns the status code of this method. The status code either indicates success or describes a warning condition.
90
+ """
91
+ try:
92
+ self._session_function_lock.enter_read_lock()
93
+ updated_selector_string = _helper.validate_and_update_selector_string(
94
+ selector_string, self._signal_obj
95
+ )
96
+ error_code = self._interpreter.set_attribute_i32(
97
+ updated_selector_string,
98
+ attributes.AttributeID.SPARAMS_MEASUREMENT_ENABLED.value,
99
+ int(value),
100
+ )
101
+ finally:
102
+ self._session_function_lock.exit_read_lock()
103
+
104
+ return error_code
105
+
106
+ @_raise_if_disposed
107
+ def get_number_of_s_parameters(self, selector_string):
108
+ r"""Gets the number of S-Parameters to measure.
109
+
110
+ **Note1**: S-Parameters of a N-port DUT can be represented by N^2 canonical S-Parameters viz. S11,
111
+ S12,...,S1N, S21, S22,...,S2N, SN1, SN2,...,SNN such that
112
+ **B = S A**
113
+ where **S** denotes the S-Parameter matrix with Sij being the element in the i\ :sup:`th`\ row and j\
114
+ :sup:`th`\ column. Similarly **A** denotes the matrix composed of the incident waves. Element Aij denotes the wave
115
+ parameter a\ :sub:`ij`\ i.e., wave measured at the reference reciever on port <i> with port <j> as the source.
116
+ Similarly **B** denotes the matrix composed of the scatterred waves. Element Bij denotes the wave parameter b\
117
+ :sub:`ij`\ i.e., wave measured at the test reciever on port <i> with port <j> as the source.
118
+
119
+ You can configure each measured S-Parameter in RFmxVNA SParams measurement to be returned in one of several
120
+ supported formats using :py:attr:`~nirfmxvna.attributes.AttributeID.SPARAMS_FORMAT` attribute. Example1: If you want to
121
+ fetch magnitude and phase information of S11, then set Number of S-Parameters attribute to 2, then for both SParam
122
+ indices 0 and 1, set Parameter attribute to "S11". Then set :py:attr:`~nirfmxvna.attributes.AttributeID.SPARAMS_FORMAT`
123
+ attribute to Magnitude for Sparam index 0 and to Phase for SParam index 1.
124
+
125
+ **Note2**: You can set many SParam indices to share the same Parameter and Format attribute values making them
126
+ duplicates of each other.
127
+
128
+ If you increase this attribute value from N to N+K, then existing N SParams are not affected but K new SParams
129
+ are added. If you reduce number of SParams from N to N-K, then last K SParams are deleted without affecting the
130
+ remaining N-K SParams.
131
+
132
+ You do not need to use a selector string to configure or read this attribute for the default signal instance.
133
+ Refer to the `Selector String <https://www.ni.com/docs/en-US/bundle/rfmx/page/selector-strings-net.html>`_ topic for
134
+ information about the string syntax for named signals.
135
+
136
+ The default value is 1.
137
+
138
+ Args:
139
+ selector_string (string):
140
+ Pass an empty string.
141
+
142
+ Returns:
143
+ Tuple (attr_val, error_code):
144
+
145
+ attr_val (int):
146
+ Specifies the number of S-Parameters to measure.
147
+
148
+ error_code (int):
149
+ Returns the status code of this method. The status code either indicates success or describes a warning condition.
150
+ """
151
+ try:
152
+ self._session_function_lock.enter_read_lock()
153
+ updated_selector_string = _helper.validate_and_update_selector_string(
154
+ selector_string, self._signal_obj
155
+ )
156
+ attr_val, error_code = self._interpreter.get_attribute_i32(
157
+ updated_selector_string, attributes.AttributeID.SPARAMS_NUMBER_OF_SPARAMETERS.value
158
+ )
159
+ finally:
160
+ self._session_function_lock.exit_read_lock()
161
+
162
+ return attr_val, error_code
163
+
164
+ @_raise_if_disposed
165
+ def set_number_of_s_parameters(self, selector_string, value):
166
+ r"""Sets the number of S-Parameters to measure.
167
+
168
+ **Note1**: S-Parameters of a N-port DUT can be represented by N^2 canonical S-Parameters viz. S11,
169
+ S12,...,S1N, S21, S22,...,S2N, SN1, SN2,...,SNN such that
170
+ **B = S A**
171
+ where **S** denotes the S-Parameter matrix with Sij being the element in the i\ :sup:`th`\ row and j\
172
+ :sup:`th`\ column. Similarly **A** denotes the matrix composed of the incident waves. Element Aij denotes the wave
173
+ parameter a\ :sub:`ij`\ i.e., wave measured at the reference reciever on port <i> with port <j> as the source.
174
+ Similarly **B** denotes the matrix composed of the scatterred waves. Element Bij denotes the wave parameter b\
175
+ :sub:`ij`\ i.e., wave measured at the test reciever on port <i> with port <j> as the source.
176
+
177
+ You can configure each measured S-Parameter in RFmxVNA SParams measurement to be returned in one of several
178
+ supported formats using :py:attr:`~nirfmxvna.attributes.AttributeID.SPARAMS_FORMAT` attribute. Example1: If you want to
179
+ fetch magnitude and phase information of S11, then set Number of S-Parameters attribute to 2, then for both SParam
180
+ indices 0 and 1, set Parameter attribute to "S11". Then set :py:attr:`~nirfmxvna.attributes.AttributeID.SPARAMS_FORMAT`
181
+ attribute to Magnitude for Sparam index 0 and to Phase for SParam index 1.
182
+
183
+ **Note2**: You can set many SParam indices to share the same Parameter and Format attribute values making them
184
+ duplicates of each other.
185
+
186
+ If you increase this attribute value from N to N+K, then existing N SParams are not affected but K new SParams
187
+ are added. If you reduce number of SParams from N to N-K, then last K SParams are deleted without affecting the
188
+ remaining N-K SParams.
189
+
190
+ You do not need to use a selector string to configure or read this attribute for the default signal instance.
191
+ Refer to the `Selector String <https://www.ni.com/docs/en-US/bundle/rfmx/page/selector-strings-net.html>`_ topic for
192
+ information about the string syntax for named signals.
193
+
194
+ The default value is 1.
195
+
196
+ Args:
197
+ selector_string (string):
198
+ Pass an empty string.
199
+
200
+ value (int):
201
+ Specifies the number of S-Parameters to measure.
202
+
203
+ Returns:
204
+ int:
205
+ Returns the status code of this method. The status code either indicates success or describes a warning condition.
206
+ """
207
+ try:
208
+ self._session_function_lock.enter_read_lock()
209
+ updated_selector_string = _helper.validate_and_update_selector_string(
210
+ selector_string, self._signal_obj
211
+ )
212
+ error_code = self._interpreter.set_attribute_i32(
213
+ updated_selector_string,
214
+ attributes.AttributeID.SPARAMS_NUMBER_OF_SPARAMETERS.value,
215
+ value,
216
+ )
217
+ finally:
218
+ self._session_function_lock.exit_read_lock()
219
+
220
+ return error_code
221
+
222
+ @_raise_if_disposed
223
+ def get_receiver_port(self, selector_string):
224
+ r"""Gets the receiver port name of the S-Parameter. S-Parameter is denoted by "S_<*receiver port name*>_<*source port
225
+ name*>".
226
+
227
+ For example, to measure S21, set this attribute to "port2".
228
+
229
+ Use "sparam<*n*>" as the selector string to configure or read this attribute.
230
+
231
+ The default value is "port1".
232
+
233
+ Args:
234
+ selector_string (string):
235
+ Pass an empty string.
236
+
237
+ Returns:
238
+ Tuple (attr_val, error_code):
239
+
240
+ attr_val (string):
241
+ Specifies the receiver port name of the S-Parameter. S-Parameter is denoted by "S_<*receiver port name*>_<*source port
242
+ name*>".
243
+
244
+ error_code (int):
245
+ Returns the status code of this method. The status code either indicates success or describes a warning condition.
246
+ """
247
+ try:
248
+ self._session_function_lock.enter_read_lock()
249
+ updated_selector_string = _helper.validate_and_update_selector_string(
250
+ selector_string, self._signal_obj
251
+ )
252
+ attr_val, error_code = self._interpreter.get_attribute_string(
253
+ updated_selector_string, attributes.AttributeID.SPARAMS_RECEIVER_PORT.value
254
+ )
255
+ finally:
256
+ self._session_function_lock.exit_read_lock()
257
+
258
+ return attr_val, error_code
259
+
260
+ @_raise_if_disposed
261
+ def set_receiver_port(self, selector_string, value):
262
+ r"""Sets the receiver port name of the S-Parameter. S-Parameter is denoted by "S_<*receiver port name*>_<*source port
263
+ name*>".
264
+
265
+ For example, to measure S21, set this attribute to "port2".
266
+
267
+ Use "sparam<*n*>" as the selector string to configure or read this attribute.
268
+
269
+ The default value is "port1".
270
+
271
+ Args:
272
+ selector_string (string):
273
+ Pass an empty string.
274
+
275
+ value (string):
276
+ Specifies the receiver port name of the S-Parameter. S-Parameter is denoted by "S_<*receiver port name*>_<*source port
277
+ name*>".
278
+
279
+ Returns:
280
+ int:
281
+ Returns the status code of this method. The status code either indicates success or describes a warning condition.
282
+ """
283
+ try:
284
+ self._session_function_lock.enter_read_lock()
285
+ updated_selector_string = _helper.validate_and_update_selector_string(
286
+ selector_string, self._signal_obj
287
+ )
288
+ _helper.validate_not_none(value, "value")
289
+ error_code = self._interpreter.set_attribute_string(
290
+ updated_selector_string, attributes.AttributeID.SPARAMS_RECEIVER_PORT.value, value
291
+ )
292
+ finally:
293
+ self._session_function_lock.exit_read_lock()
294
+
295
+ return error_code
296
+
297
+ @_raise_if_disposed
298
+ def get_source_port(self, selector_string):
299
+ r"""Gets the source port name of the S-Parameter. S-Parameter is denoted by "S_<*receiver port name*>_<*source port
300
+ name*>".
301
+
302
+ For example, to measure S21, set this attribute to "port1".
303
+
304
+ Use "sparam<*n*>" as the selector string to configure or read this attribute.
305
+
306
+ The default value is "port1".
307
+
308
+ Args:
309
+ selector_string (string):
310
+ Pass an empty string.
311
+
312
+ Returns:
313
+ Tuple (attr_val, error_code):
314
+
315
+ attr_val (string):
316
+ Specifies the source port name of the S-Parameter. S-Parameter is denoted by "S_<*receiver port name*>_<*source port
317
+ name*>".
318
+
319
+ error_code (int):
320
+ Returns the status code of this method. The status code either indicates success or describes a warning condition.
321
+ """
322
+ try:
323
+ self._session_function_lock.enter_read_lock()
324
+ updated_selector_string = _helper.validate_and_update_selector_string(
325
+ selector_string, self._signal_obj
326
+ )
327
+ attr_val, error_code = self._interpreter.get_attribute_string(
328
+ updated_selector_string, attributes.AttributeID.SPARAMS_SOURCE_PORT.value
329
+ )
330
+ finally:
331
+ self._session_function_lock.exit_read_lock()
332
+
333
+ return attr_val, error_code
334
+
335
+ @_raise_if_disposed
336
+ def set_source_port(self, selector_string, value):
337
+ r"""Sets the source port name of the S-Parameter. S-Parameter is denoted by "S_<*receiver port name*>_<*source port
338
+ name*>".
339
+
340
+ For example, to measure S21, set this attribute to "port1".
341
+
342
+ Use "sparam<*n*>" as the selector string to configure or read this attribute.
343
+
344
+ The default value is "port1".
345
+
346
+ Args:
347
+ selector_string (string):
348
+ Pass an empty string.
349
+
350
+ value (string):
351
+ Specifies the source port name of the S-Parameter. S-Parameter is denoted by "S_<*receiver port name*>_<*source port
352
+ name*>".
353
+
354
+ Returns:
355
+ int:
356
+ Returns the status code of this method. The status code either indicates success or describes a warning condition.
357
+ """
358
+ try:
359
+ self._session_function_lock.enter_read_lock()
360
+ updated_selector_string = _helper.validate_and_update_selector_string(
361
+ selector_string, self._signal_obj
362
+ )
363
+ _helper.validate_not_none(value, "value")
364
+ error_code = self._interpreter.set_attribute_string(
365
+ updated_selector_string, attributes.AttributeID.SPARAMS_SOURCE_PORT.value, value
366
+ )
367
+ finally:
368
+ self._session_function_lock.exit_read_lock()
369
+
370
+ return error_code
371
+
372
+ @_raise_if_disposed
373
+ def get_format(self, selector_string):
374
+ r"""Gets the format of S-Parameter measurement.
375
+
376
+ Use "sparam<*n*>" as the selector string to configure or read this attribute.
377
+
378
+ The default value is **Magnitude**.
379
+
380
+ +----------------------+--------------------------------------------------------------------------------------------------------------------------+
381
+ | Name (Value) | Description |
382
+ +======================+==========================================================================================================================+
383
+ | Magnitude (0) | Sets the format of the selected S-Parameter to Magnitude. You can specify SParams Magnitude Units. |
384
+ +----------------------+--------------------------------------------------------------------------------------------------------------------------+
385
+ | Phase (1) | Sets the format of the selected S-Parameter to Phase. Phase values are expressed in degrees. Phase can be represented |
386
+ | | in various, mathematically equivalent ways such as phase wrapped between the range [-180, 180) degrees, or phase can be |
387
+ | | represented in an unwrapped manner. You can specify the phase representation by configuring Sparams Phase Trace Type. |
388
+ +----------------------+--------------------------------------------------------------------------------------------------------------------------+
389
+ | Complex (2) | Sets the format of the selected S-Parameter as complex numbers in cartesian co-ordinates. |
390
+ +----------------------+--------------------------------------------------------------------------------------------------------------------------+
391
+ | SWR (3) | Sets the format of the selected S-Parameter to Standing Wave Ratio (SWR). SWR is a unitless quantity. |
392
+ +----------------------+--------------------------------------------------------------------------------------------------------------------------+
393
+ | Smith Impedance (4) | Sets the format of the selected S-Parameter to Smith Impedance. S-Parameter values are transformed into impedence |
394
+ | | values. Impedence values are expressed in ohms. You can use these values to plot on a Smith Chart. |
395
+ +----------------------+--------------------------------------------------------------------------------------------------------------------------+
396
+ | Smith Admittance (5) | Sets the format of the selected S-Parameter to Smith Admittance. S-Parameter values are transformed into admittance |
397
+ | | values. Admittance values are expressed in siemens. You can use these values to plot on an Inverted Smith Chart. |
398
+ +----------------------+--------------------------------------------------------------------------------------------------------------------------+
399
+ | Polar (6) | Sets the format of the selected S-Parameter as complex numbers in polar co-ordinates, where the radial axis (i.e., |
400
+ | | magnitude of the complex numbers) is always in linear scale and angular axis (phase) is represented in degrees and |
401
+ | | always wrapped between ±180 deg. |
402
+ +----------------------+--------------------------------------------------------------------------------------------------------------------------+
403
+ | Group Delay (7) | Sets the format of the selected S-Parameter to Group Delay. Group delay represents the time it takes for the signal to |
404
+ | | pass through a device under test. The delay is expressed in seconds. |
405
+ | | Group delay vs. frequency is derived from phase vs. frequency response. At a given frequency point, group delay is |
406
+ | | computed by selecting two nearby frequency points and taking the ratio of the phase difference to the frequency |
407
+ | | separation between them. The frequency separation between the two selected points is called the group delay aperture. |
408
+ | | You can control the aperture by first configuring SParams Group Delay Aperture Mode and once the mode is selected, you |
409
+ | | can set the aperture by configuring SParams Group Delay Aperture Points, SParams Group Delay Aperture Percentage or |
410
+ | | SParams Group Delay Aperture Frequency Span. |
411
+ | | For example, if the number of aperture points is equal to 3, then group delay at a nth frequency point is computed |
412
+ | | by selecting the (n-1)th frequency point and (n+1)th frequency point. |
413
+ +----------------------+--------------------------------------------------------------------------------------------------------------------------+
414
+
415
+ Args:
416
+ selector_string (string):
417
+ Pass an empty string.
418
+
419
+ Returns:
420
+ Tuple (attr_val, error_code):
421
+
422
+ attr_val (enums.SParamsFormat):
423
+ Specifies the format of S-Parameter measurement.
424
+
425
+ error_code (int):
426
+ Returns the status code of this method. The status code either indicates success or describes a warning condition.
427
+ """
428
+ try:
429
+ self._session_function_lock.enter_read_lock()
430
+ updated_selector_string = _helper.validate_and_update_selector_string(
431
+ selector_string, self._signal_obj
432
+ )
433
+ attr_val, error_code = self._interpreter.get_attribute_i32(
434
+ updated_selector_string, attributes.AttributeID.SPARAMS_FORMAT.value
435
+ )
436
+ attr_val = enums.SParamsFormat(attr_val)
437
+ except (KeyError, ValueError):
438
+ raise errors.DriverTooNewError() # type: ignore
439
+ finally:
440
+ self._session_function_lock.exit_read_lock()
441
+
442
+ return attr_val, error_code
443
+
444
+ @_raise_if_disposed
445
+ def set_format(self, selector_string, value):
446
+ r"""Sets the format of S-Parameter measurement.
447
+
448
+ Use "sparam<*n*>" as the selector string to configure or read this attribute.
449
+
450
+ The default value is **Magnitude**.
451
+
452
+ +----------------------+--------------------------------------------------------------------------------------------------------------------------+
453
+ | Name (Value) | Description |
454
+ +======================+==========================================================================================================================+
455
+ | Magnitude (0) | Sets the format of the selected S-Parameter to Magnitude. You can specify SParams Magnitude Units. |
456
+ +----------------------+--------------------------------------------------------------------------------------------------------------------------+
457
+ | Phase (1) | Sets the format of the selected S-Parameter to Phase. Phase values are expressed in degrees. Phase can be represented |
458
+ | | in various, mathematically equivalent ways such as phase wrapped between the range [-180, 180) degrees, or phase can be |
459
+ | | represented in an unwrapped manner. You can specify the phase representation by configuring Sparams Phase Trace Type. |
460
+ +----------------------+--------------------------------------------------------------------------------------------------------------------------+
461
+ | Complex (2) | Sets the format of the selected S-Parameter as complex numbers in cartesian co-ordinates. |
462
+ +----------------------+--------------------------------------------------------------------------------------------------------------------------+
463
+ | SWR (3) | Sets the format of the selected S-Parameter to Standing Wave Ratio (SWR). SWR is a unitless quantity. |
464
+ +----------------------+--------------------------------------------------------------------------------------------------------------------------+
465
+ | Smith Impedance (4) | Sets the format of the selected S-Parameter to Smith Impedance. S-Parameter values are transformed into impedence |
466
+ | | values. Impedence values are expressed in ohms. You can use these values to plot on a Smith Chart. |
467
+ +----------------------+--------------------------------------------------------------------------------------------------------------------------+
468
+ | Smith Admittance (5) | Sets the format of the selected S-Parameter to Smith Admittance. S-Parameter values are transformed into admittance |
469
+ | | values. Admittance values are expressed in siemens. You can use these values to plot on an Inverted Smith Chart. |
470
+ +----------------------+--------------------------------------------------------------------------------------------------------------------------+
471
+ | Polar (6) | Sets the format of the selected S-Parameter as complex numbers in polar co-ordinates, where the radial axis (i.e., |
472
+ | | magnitude of the complex numbers) is always in linear scale and angular axis (phase) is represented in degrees and |
473
+ | | always wrapped between ±180 deg. |
474
+ +----------------------+--------------------------------------------------------------------------------------------------------------------------+
475
+ | Group Delay (7) | Sets the format of the selected S-Parameter to Group Delay. Group delay represents the time it takes for the signal to |
476
+ | | pass through a device under test. The delay is expressed in seconds. |
477
+ | | Group delay vs. frequency is derived from phase vs. frequency response. At a given frequency point, group delay is |
478
+ | | computed by selecting two nearby frequency points and taking the ratio of the phase difference to the frequency |
479
+ | | separation between them. The frequency separation between the two selected points is called the group delay aperture. |
480
+ | | You can control the aperture by first configuring SParams Group Delay Aperture Mode and once the mode is selected, you |
481
+ | | can set the aperture by configuring SParams Group Delay Aperture Points, SParams Group Delay Aperture Percentage or |
482
+ | | SParams Group Delay Aperture Frequency Span. |
483
+ | | For example, if the number of aperture points is equal to 3, then group delay at a nth frequency point is computed |
484
+ | | by selecting the (n-1)th frequency point and (n+1)th frequency point. |
485
+ +----------------------+--------------------------------------------------------------------------------------------------------------------------+
486
+
487
+ Args:
488
+ selector_string (string):
489
+ Pass an empty string.
490
+
491
+ value (enums.SParamsFormat, int):
492
+ Specifies the format of S-Parameter measurement.
493
+
494
+ Returns:
495
+ int:
496
+ Returns the status code of this method. The status code either indicates success or describes a warning condition.
497
+ """
498
+ try:
499
+ self._session_function_lock.enter_read_lock()
500
+ updated_selector_string = _helper.validate_and_update_selector_string(
501
+ selector_string, self._signal_obj
502
+ )
503
+ value = value.value if type(value) is enums.SParamsFormat else value
504
+ error_code = self._interpreter.set_attribute_i32(
505
+ updated_selector_string, attributes.AttributeID.SPARAMS_FORMAT.value, value
506
+ )
507
+ finally:
508
+ self._session_function_lock.exit_read_lock()
509
+
510
+ return error_code
511
+
512
+ @_raise_if_disposed
513
+ def get_magnitude_units(self, selector_string):
514
+ r"""Gets the magnitude units for all S-Parameters for which you set
515
+ :py:attr:`~nirfmxvna.attributes.AttributeID.SPARAMS_FORMAT` attribute to **Magnitude**.
516
+
517
+ You do not need to use a selector string to configure or read this attribute for the default signal instance.
518
+ Refer to the `Selector String <https://www.ni.com/docs/en-US/bundle/rfmx/page/selector-strings-net.html>`_ topic for
519
+ information about the string syntax for named signals.
520
+
521
+ The default value is **dB**.
522
+
523
+ +--------------+-------------------------------------------------------------------------------------------------------+
524
+ | Name (Value) | Description |
525
+ +==============+=======================================================================================================+
526
+ | dB (0) | Sets S-Parameter magnitude units to dB. |
527
+ +--------------+-------------------------------------------------------------------------------------------------------+
528
+ | Linear (1) | Sets S-Parameter magnitude units to linear such that S-Parameters are reported in linear scale (V/V). |
529
+ +--------------+-------------------------------------------------------------------------------------------------------+
530
+
531
+ Args:
532
+ selector_string (string):
533
+ Pass an empty string.
534
+
535
+ Returns:
536
+ Tuple (attr_val, error_code):
537
+
538
+ attr_val (enums.SParamsMagnitudeUnits):
539
+ Specifies the magnitude units for all S-Parameters for which you set
540
+ :py:attr:`~nirfmxvna.attributes.AttributeID.SPARAMS_FORMAT` attribute to **Magnitude**.
541
+
542
+ error_code (int):
543
+ Returns the status code of this method. The status code either indicates success or describes a warning condition.
544
+ """
545
+ try:
546
+ self._session_function_lock.enter_read_lock()
547
+ updated_selector_string = _helper.validate_and_update_selector_string(
548
+ selector_string, self._signal_obj
549
+ )
550
+ attr_val, error_code = self._interpreter.get_attribute_i32(
551
+ updated_selector_string, attributes.AttributeID.SPARAMS_MAGNITUDE_UNITS.value
552
+ )
553
+ attr_val = enums.SParamsMagnitudeUnits(attr_val)
554
+ except (KeyError, ValueError):
555
+ raise errors.DriverTooNewError() # type: ignore
556
+ finally:
557
+ self._session_function_lock.exit_read_lock()
558
+
559
+ return attr_val, error_code
560
+
561
+ @_raise_if_disposed
562
+ def set_magnitude_units(self, selector_string, value):
563
+ r"""Sets the magnitude units for all S-Parameters for which you set
564
+ :py:attr:`~nirfmxvna.attributes.AttributeID.SPARAMS_FORMAT` attribute to **Magnitude**.
565
+
566
+ You do not need to use a selector string to configure or read this attribute for the default signal instance.
567
+ Refer to the `Selector String <https://www.ni.com/docs/en-US/bundle/rfmx/page/selector-strings-net.html>`_ topic for
568
+ information about the string syntax for named signals.
569
+
570
+ The default value is **dB**.
571
+
572
+ +--------------+-------------------------------------------------------------------------------------------------------+
573
+ | Name (Value) | Description |
574
+ +==============+=======================================================================================================+
575
+ | dB (0) | Sets S-Parameter magnitude units to dB. |
576
+ +--------------+-------------------------------------------------------------------------------------------------------+
577
+ | Linear (1) | Sets S-Parameter magnitude units to linear such that S-Parameters are reported in linear scale (V/V). |
578
+ +--------------+-------------------------------------------------------------------------------------------------------+
579
+
580
+ Args:
581
+ selector_string (string):
582
+ Pass an empty string.
583
+
584
+ value (enums.SParamsMagnitudeUnits, int):
585
+ Specifies the magnitude units for all S-Parameters for which you set
586
+ :py:attr:`~nirfmxvna.attributes.AttributeID.SPARAMS_FORMAT` attribute to **Magnitude**.
587
+
588
+ Returns:
589
+ int:
590
+ Returns the status code of this method. The status code either indicates success or describes a warning condition.
591
+ """
592
+ try:
593
+ self._session_function_lock.enter_read_lock()
594
+ updated_selector_string = _helper.validate_and_update_selector_string(
595
+ selector_string, self._signal_obj
596
+ )
597
+ value = value.value if type(value) is enums.SParamsMagnitudeUnits else value
598
+ error_code = self._interpreter.set_attribute_i32(
599
+ updated_selector_string, attributes.AttributeID.SPARAMS_MAGNITUDE_UNITS.value, value
600
+ )
601
+ finally:
602
+ self._session_function_lock.exit_read_lock()
603
+
604
+ return error_code
605
+
606
+ @_raise_if_disposed
607
+ def get_phase_trace_type(self, selector_string):
608
+ r"""Gets the phase type for all S-Parameters for which :py:attr:`~nirfmxvna.attributes.AttributeID.SPARAMS_FORMAT`
609
+ attribute is set to **Phase**. Phase can be represented in two mathematically equivalent ways viz. phase wrapped
610
+ between the range [-180, 180) degrees, and phase can be represented in an unwrapped manner.
611
+
612
+ You do not need to use a selector string to configure or read this attribute for the default signal instance.
613
+ Refer to the `Selector String <https://www.ni.com/docs/en-US/bundle/rfmx/page/selector-strings-net.html>`_ topic for
614
+ information about the string syntax for named signals.
615
+
616
+ The default value is **Wrapped**.
617
+
618
+ +---------------+---------------------------------------------------------------------------------+
619
+ | Name (Value) | Description |
620
+ +===============+=================================================================================+
621
+ | Wrapped (0) | The reported S-Parameter phase is wrapped between -180 degress to +180 degrees. |
622
+ +---------------+---------------------------------------------------------------------------------+
623
+ | Unwrapped (1) | The reported S-Parameter phase is unwrapped. |
624
+ +---------------+---------------------------------------------------------------------------------+
625
+
626
+ Args:
627
+ selector_string (string):
628
+ Pass an empty string.
629
+
630
+ Returns:
631
+ Tuple (attr_val, error_code):
632
+
633
+ attr_val (enums.SParamsPhaseTraceType):
634
+ Specifies the phase type for all S-Parameters for which :py:attr:`~nirfmxvna.attributes.AttributeID.SPARAMS_FORMAT`
635
+ attribute is set to **Phase**. Phase can be represented in two mathematically equivalent ways viz. phase wrapped
636
+ between the range [-180, 180) degrees, and phase can be represented in an unwrapped manner.
637
+
638
+ error_code (int):
639
+ Returns the status code of this method. The status code either indicates success or describes a warning condition.
640
+ """
641
+ try:
642
+ self._session_function_lock.enter_read_lock()
643
+ updated_selector_string = _helper.validate_and_update_selector_string(
644
+ selector_string, self._signal_obj
645
+ )
646
+ attr_val, error_code = self._interpreter.get_attribute_i32(
647
+ updated_selector_string, attributes.AttributeID.SPARAMS_PHASE_TRACE_TYPE.value
648
+ )
649
+ attr_val = enums.SParamsPhaseTraceType(attr_val)
650
+ except (KeyError, ValueError):
651
+ raise errors.DriverTooNewError() # type: ignore
652
+ finally:
653
+ self._session_function_lock.exit_read_lock()
654
+
655
+ return attr_val, error_code
656
+
657
+ @_raise_if_disposed
658
+ def set_phase_trace_type(self, selector_string, value):
659
+ r"""Sets the phase type for all S-Parameters for which :py:attr:`~nirfmxvna.attributes.AttributeID.SPARAMS_FORMAT`
660
+ attribute is set to **Phase**. Phase can be represented in two mathematically equivalent ways viz. phase wrapped
661
+ between the range [-180, 180) degrees, and phase can be represented in an unwrapped manner.
662
+
663
+ You do not need to use a selector string to configure or read this attribute for the default signal instance.
664
+ Refer to the `Selector String <https://www.ni.com/docs/en-US/bundle/rfmx/page/selector-strings-net.html>`_ topic for
665
+ information about the string syntax for named signals.
666
+
667
+ The default value is **Wrapped**.
668
+
669
+ +---------------+---------------------------------------------------------------------------------+
670
+ | Name (Value) | Description |
671
+ +===============+=================================================================================+
672
+ | Wrapped (0) | The reported S-Parameter phase is wrapped between -180 degress to +180 degrees. |
673
+ +---------------+---------------------------------------------------------------------------------+
674
+ | Unwrapped (1) | The reported S-Parameter phase is unwrapped. |
675
+ +---------------+---------------------------------------------------------------------------------+
676
+
677
+ Args:
678
+ selector_string (string):
679
+ Pass an empty string.
680
+
681
+ value (enums.SParamsPhaseTraceType, int):
682
+ Specifies the phase type for all S-Parameters for which :py:attr:`~nirfmxvna.attributes.AttributeID.SPARAMS_FORMAT`
683
+ attribute is set to **Phase**. Phase can be represented in two mathematically equivalent ways viz. phase wrapped
684
+ between the range [-180, 180) degrees, and phase can be represented in an unwrapped manner.
685
+
686
+ Returns:
687
+ int:
688
+ Returns the status code of this method. The status code either indicates success or describes a warning condition.
689
+ """
690
+ try:
691
+ self._session_function_lock.enter_read_lock()
692
+ updated_selector_string = _helper.validate_and_update_selector_string(
693
+ selector_string, self._signal_obj
694
+ )
695
+ value = value.value if type(value) is enums.SParamsPhaseTraceType else value
696
+ error_code = self._interpreter.set_attribute_i32(
697
+ updated_selector_string,
698
+ attributes.AttributeID.SPARAMS_PHASE_TRACE_TYPE.value,
699
+ value,
700
+ )
701
+ finally:
702
+ self._session_function_lock.exit_read_lock()
703
+
704
+ return error_code
705
+
706
+ @_raise_if_disposed
707
+ def get_group_delay_aperture_mode(self, selector_string):
708
+ r"""Gets the aperture mode to be used for the computation of group delay for all S-Parameters for which
709
+ :py:attr:`~nirfmxvna.attributes.AttributeID.SPARAMS_FORMAT` attribute is set to **Group Delay**.
710
+
711
+ You do not need to use a selector string to configure or read this attribute for the default signal instance.
712
+ Refer to the `Selector String <https://www.ni.com/docs/en-US/bundle/rfmx/page/selector-strings-net.html>`_ topic for
713
+ information about the string syntax for named signals.
714
+
715
+ The default value is **Points**.
716
+
717
+ +--------------------+--------------------------------------------------------------------------------------------------------------------------+
718
+ | Name (Value) | Description |
719
+ +====================+==========================================================================================================================+
720
+ | Points (0) | Sets group delay aperture mode to Points. You can specify the aperture in terms of the number of frequency points by |
721
+ | | configuring SParams Group Delay Aperture Points. |
722
+ +--------------------+--------------------------------------------------------------------------------------------------------------------------+
723
+ | Percentage (1) | Sets group delay aperture mode to Percentage. You can specify the aperture in terms of the frequency separation |
724
+ | | expressed in percentage by configuring SParams Group Delay Aperture Percentage. |
725
+ +--------------------+--------------------------------------------------------------------------------------------------------------------------+
726
+ | Frequency Span (2) | Sets group delay aperture to Frequency Span. You can specify the aperture in terms of the frequency separation by |
727
+ | | configuring SParams Group Delay Aperture Frequency Span. |
728
+ +--------------------+--------------------------------------------------------------------------------------------------------------------------+
729
+
730
+ Args:
731
+ selector_string (string):
732
+ Pass an empty string.
733
+
734
+ Returns:
735
+ Tuple (attr_val, error_code):
736
+
737
+ attr_val (enums.SParamsGroupDelayApertureMode):
738
+ Specifies the aperture mode to be used for the computation of group delay for all S-Parameters for which
739
+ :py:attr:`~nirfmxvna.attributes.AttributeID.SPARAMS_FORMAT` attribute is set to **Group Delay**.
740
+
741
+ error_code (int):
742
+ Returns the status code of this method. The status code either indicates success or describes a warning condition.
743
+ """
744
+ try:
745
+ self._session_function_lock.enter_read_lock()
746
+ updated_selector_string = _helper.validate_and_update_selector_string(
747
+ selector_string, self._signal_obj
748
+ )
749
+ attr_val, error_code = self._interpreter.get_attribute_i32(
750
+ updated_selector_string,
751
+ attributes.AttributeID.SPARAMS_GROUP_DELAY_APERTURE_MODE.value,
752
+ )
753
+ attr_val = enums.SParamsGroupDelayApertureMode(attr_val)
754
+ except (KeyError, ValueError):
755
+ raise errors.DriverTooNewError() # type: ignore
756
+ finally:
757
+ self._session_function_lock.exit_read_lock()
758
+
759
+ return attr_val, error_code
760
+
761
+ @_raise_if_disposed
762
+ def set_group_delay_aperture_mode(self, selector_string, value):
763
+ r"""Sets the aperture mode to be used for the computation of group delay for all S-Parameters for which
764
+ :py:attr:`~nirfmxvna.attributes.AttributeID.SPARAMS_FORMAT` attribute is set to **Group Delay**.
765
+
766
+ You do not need to use a selector string to configure or read this attribute for the default signal instance.
767
+ Refer to the `Selector String <https://www.ni.com/docs/en-US/bundle/rfmx/page/selector-strings-net.html>`_ topic for
768
+ information about the string syntax for named signals.
769
+
770
+ The default value is **Points**.
771
+
772
+ +--------------------+--------------------------------------------------------------------------------------------------------------------------+
773
+ | Name (Value) | Description |
774
+ +====================+==========================================================================================================================+
775
+ | Points (0) | Sets group delay aperture mode to Points. You can specify the aperture in terms of the number of frequency points by |
776
+ | | configuring SParams Group Delay Aperture Points. |
777
+ +--------------------+--------------------------------------------------------------------------------------------------------------------------+
778
+ | Percentage (1) | Sets group delay aperture mode to Percentage. You can specify the aperture in terms of the frequency separation |
779
+ | | expressed in percentage by configuring SParams Group Delay Aperture Percentage. |
780
+ +--------------------+--------------------------------------------------------------------------------------------------------------------------+
781
+ | Frequency Span (2) | Sets group delay aperture to Frequency Span. You can specify the aperture in terms of the frequency separation by |
782
+ | | configuring SParams Group Delay Aperture Frequency Span. |
783
+ +--------------------+--------------------------------------------------------------------------------------------------------------------------+
784
+
785
+ Args:
786
+ selector_string (string):
787
+ Pass an empty string.
788
+
789
+ value (enums.SParamsGroupDelayApertureMode, int):
790
+ Specifies the aperture mode to be used for the computation of group delay for all S-Parameters for which
791
+ :py:attr:`~nirfmxvna.attributes.AttributeID.SPARAMS_FORMAT` attribute is set to **Group Delay**.
792
+
793
+ Returns:
794
+ int:
795
+ Returns the status code of this method. The status code either indicates success or describes a warning condition.
796
+ """
797
+ try:
798
+ self._session_function_lock.enter_read_lock()
799
+ updated_selector_string = _helper.validate_and_update_selector_string(
800
+ selector_string, self._signal_obj
801
+ )
802
+ value = value.value if type(value) is enums.SParamsGroupDelayApertureMode else value
803
+ error_code = self._interpreter.set_attribute_i32(
804
+ updated_selector_string,
805
+ attributes.AttributeID.SPARAMS_GROUP_DELAY_APERTURE_MODE.value,
806
+ value,
807
+ )
808
+ finally:
809
+ self._session_function_lock.exit_read_lock()
810
+
811
+ return error_code
812
+
813
+ @_raise_if_disposed
814
+ def get_group_delay_aperture_points(self, selector_string):
815
+ r"""Gets the group delay aperture in terms of the number of frequency points that separates the two frequency points
816
+ for all S-Parameters for which :py:attr:`~nirfmxvna.attributes.AttributeID.SPARAMS_FORMAT` attribute is set to **Group
817
+ Delay** and :py:attr:`~nirfmxvna.attributes.AttributeID.SPARAMS_GROUP_DELAY_APERTURE_MODE` attribute is set to
818
+ **Points**. You must set the value of this attribute between 2 and the total number of frequency points in the
819
+ measurement frequency range.
820
+
821
+ You do not need to use a selector string to configure or read this attribute for the default signal instance.
822
+ Refer to the `Selector String <https://www.ni.com/docs/en-US/bundle/rfmx/page/selector-strings-net.html>`_ topic for
823
+ information about the string syntax for named signals.
824
+
825
+ The default value is 11.
826
+
827
+ Args:
828
+ selector_string (string):
829
+ Pass an empty string.
830
+
831
+ Returns:
832
+ Tuple (attr_val, error_code):
833
+
834
+ attr_val (float):
835
+ Specifies the group delay aperture in terms of the number of frequency points that separates the two frequency points
836
+ for all S-Parameters for which :py:attr:`~nirfmxvna.attributes.AttributeID.SPARAMS_FORMAT` attribute is set to **Group
837
+ Delay** and :py:attr:`~nirfmxvna.attributes.AttributeID.SPARAMS_GROUP_DELAY_APERTURE_MODE` attribute is set to
838
+ **Points**. You must set the value of this attribute between 2 and the total number of frequency points in the
839
+ measurement frequency range.
840
+
841
+ error_code (int):
842
+ Returns the status code of this method. The status code either indicates success or describes a warning condition.
843
+ """
844
+ try:
845
+ self._session_function_lock.enter_read_lock()
846
+ updated_selector_string = _helper.validate_and_update_selector_string(
847
+ selector_string, self._signal_obj
848
+ )
849
+ attr_val, error_code = self._interpreter.get_attribute_f64(
850
+ updated_selector_string,
851
+ attributes.AttributeID.SPARAMS_GROUP_DELAY_APERTURE_POINTS.value,
852
+ )
853
+ finally:
854
+ self._session_function_lock.exit_read_lock()
855
+
856
+ return attr_val, error_code
857
+
858
+ @_raise_if_disposed
859
+ def set_group_delay_aperture_points(self, selector_string, value):
860
+ r"""Sets the group delay aperture in terms of the number of frequency points that separates the two frequency points
861
+ for all S-Parameters for which :py:attr:`~nirfmxvna.attributes.AttributeID.SPARAMS_FORMAT` attribute is set to **Group
862
+ Delay** and :py:attr:`~nirfmxvna.attributes.AttributeID.SPARAMS_GROUP_DELAY_APERTURE_MODE` attribute is set to
863
+ **Points**. You must set the value of this attribute between 2 and the total number of frequency points in the
864
+ measurement frequency range.
865
+
866
+ You do not need to use a selector string to configure or read this attribute for the default signal instance.
867
+ Refer to the `Selector String <https://www.ni.com/docs/en-US/bundle/rfmx/page/selector-strings-net.html>`_ topic for
868
+ information about the string syntax for named signals.
869
+
870
+ The default value is 11.
871
+
872
+ Args:
873
+ selector_string (string):
874
+ Pass an empty string.
875
+
876
+ value (float):
877
+ Specifies the group delay aperture in terms of the number of frequency points that separates the two frequency points
878
+ for all S-Parameters for which :py:attr:`~nirfmxvna.attributes.AttributeID.SPARAMS_FORMAT` attribute is set to **Group
879
+ Delay** and :py:attr:`~nirfmxvna.attributes.AttributeID.SPARAMS_GROUP_DELAY_APERTURE_MODE` attribute is set to
880
+ **Points**. You must set the value of this attribute between 2 and the total number of frequency points in the
881
+ measurement frequency range.
882
+
883
+ Returns:
884
+ int:
885
+ Returns the status code of this method. The status code either indicates success or describes a warning condition.
886
+ """
887
+ try:
888
+ self._session_function_lock.enter_read_lock()
889
+ updated_selector_string = _helper.validate_and_update_selector_string(
890
+ selector_string, self._signal_obj
891
+ )
892
+ error_code = self._interpreter.set_attribute_f64(
893
+ updated_selector_string,
894
+ attributes.AttributeID.SPARAMS_GROUP_DELAY_APERTURE_POINTS.value,
895
+ value,
896
+ )
897
+ finally:
898
+ self._session_function_lock.exit_read_lock()
899
+
900
+ return error_code
901
+
902
+ @_raise_if_disposed
903
+ def get_group_delay_aperture_percentage(self, selector_string):
904
+ r"""Gets the group delay aperture in terms of the frequency separation between the two frequency points selected for
905
+ group delay computation, where separation is expressed as a percentage of the total measurement frequency range for all
906
+ S-Parameters for which :py:attr:`~nirfmxvna.attributes.AttributeID.SPARAMS_FORMAT` attribute is set to **Group Delay**
907
+ and :py:attr:`~nirfmxvna.attributes.AttributeID.SPARAMS_GROUP_DELAY_APERTURE_MODE` attribute is set to **Percentage**.
908
+
909
+ You do not need to use a selector string to configure or read this attribute for the default signal instance.
910
+ Refer to the `Selector String <https://www.ni.com/docs/en-US/bundle/rfmx/page/selector-strings-net.html>`_ topic for
911
+ information about the string syntax for named signals.
912
+
913
+ The default value is 5 %.
914
+
915
+ Args:
916
+ selector_string (string):
917
+ Pass an empty string.
918
+
919
+ Returns:
920
+ Tuple (attr_val, error_code):
921
+
922
+ attr_val (float):
923
+ Specifies the group delay aperture in terms of the frequency separation between the two frequency points selected for
924
+ group delay computation, where separation is expressed as a percentage of the total measurement frequency range for all
925
+ S-Parameters for which :py:attr:`~nirfmxvna.attributes.AttributeID.SPARAMS_FORMAT` attribute is set to **Group Delay**
926
+ and :py:attr:`~nirfmxvna.attributes.AttributeID.SPARAMS_GROUP_DELAY_APERTURE_MODE` attribute is set to **Percentage**.
927
+
928
+ error_code (int):
929
+ Returns the status code of this method. The status code either indicates success or describes a warning condition.
930
+ """
931
+ try:
932
+ self._session_function_lock.enter_read_lock()
933
+ updated_selector_string = _helper.validate_and_update_selector_string(
934
+ selector_string, self._signal_obj
935
+ )
936
+ attr_val, error_code = self._interpreter.get_attribute_f64(
937
+ updated_selector_string,
938
+ attributes.AttributeID.SPARAMS_GROUP_DELAY_APERTURE_PERCENTAGE.value,
939
+ )
940
+ finally:
941
+ self._session_function_lock.exit_read_lock()
942
+
943
+ return attr_val, error_code
944
+
945
+ @_raise_if_disposed
946
+ def set_group_delay_aperture_percentage(self, selector_string, value):
947
+ r"""Sets the group delay aperture in terms of the frequency separation between the two frequency points selected for
948
+ group delay computation, where separation is expressed as a percentage of the total measurement frequency range for all
949
+ S-Parameters for which :py:attr:`~nirfmxvna.attributes.AttributeID.SPARAMS_FORMAT` attribute is set to **Group Delay**
950
+ and :py:attr:`~nirfmxvna.attributes.AttributeID.SPARAMS_GROUP_DELAY_APERTURE_MODE` attribute is set to **Percentage**.
951
+
952
+ You do not need to use a selector string to configure or read this attribute for the default signal instance.
953
+ Refer to the `Selector String <https://www.ni.com/docs/en-US/bundle/rfmx/page/selector-strings-net.html>`_ topic for
954
+ information about the string syntax for named signals.
955
+
956
+ The default value is 5 %.
957
+
958
+ Args:
959
+ selector_string (string):
960
+ Pass an empty string.
961
+
962
+ value (float):
963
+ Specifies the group delay aperture in terms of the frequency separation between the two frequency points selected for
964
+ group delay computation, where separation is expressed as a percentage of the total measurement frequency range for all
965
+ S-Parameters for which :py:attr:`~nirfmxvna.attributes.AttributeID.SPARAMS_FORMAT` attribute is set to **Group Delay**
966
+ and :py:attr:`~nirfmxvna.attributes.AttributeID.SPARAMS_GROUP_DELAY_APERTURE_MODE` attribute is set to **Percentage**.
967
+
968
+ Returns:
969
+ int:
970
+ Returns the status code of this method. The status code either indicates success or describes a warning condition.
971
+ """
972
+ try:
973
+ self._session_function_lock.enter_read_lock()
974
+ updated_selector_string = _helper.validate_and_update_selector_string(
975
+ selector_string, self._signal_obj
976
+ )
977
+ error_code = self._interpreter.set_attribute_f64(
978
+ updated_selector_string,
979
+ attributes.AttributeID.SPARAMS_GROUP_DELAY_APERTURE_PERCENTAGE.value,
980
+ value,
981
+ )
982
+ finally:
983
+ self._session_function_lock.exit_read_lock()
984
+
985
+ return error_code
986
+
987
+ @_raise_if_disposed
988
+ def get_group_delay_aperture_frequency_span(self, selector_string):
989
+ r"""Gets the group delay aperture in terms of the frequency separation between the two frequency points selected for
990
+ group delay computation for all S-Parameters for which :py:attr:`~nirfmxvna.attributes.AttributeID.SPARAMS_FORMAT`
991
+ attribute is set to **Group Delay** and :py:attr:`~nirfmxvna.attributes.AttributeID.SPARAMS_GROUP_DELAY_APERTURE_MODE`
992
+ attribute is set to **Frequency Span**.
993
+
994
+ You do not need to use a selector string to configure or read this attribute for the default signal instance.
995
+ Refer to the `Selector String <https://www.ni.com/docs/en-US/bundle/rfmx/page/selector-strings-net.html>`_ topic for
996
+ information about the string syntax for named signals.
997
+
998
+ The default value is 50 MHz.
999
+
1000
+ Args:
1001
+ selector_string (string):
1002
+ Pass an empty string.
1003
+
1004
+ Returns:
1005
+ Tuple (attr_val, error_code):
1006
+
1007
+ attr_val (float):
1008
+ Specifies the group delay aperture in terms of the frequency separation between the two frequency points selected for
1009
+ group delay computation for all S-Parameters for which :py:attr:`~nirfmxvna.attributes.AttributeID.SPARAMS_FORMAT`
1010
+ attribute is set to **Group Delay** and :py:attr:`~nirfmxvna.attributes.AttributeID.SPARAMS_GROUP_DELAY_APERTURE_MODE`
1011
+ attribute is set to **Frequency Span**.
1012
+
1013
+ error_code (int):
1014
+ Returns the status code of this method. The status code either indicates success or describes a warning condition.
1015
+ """
1016
+ try:
1017
+ self._session_function_lock.enter_read_lock()
1018
+ updated_selector_string = _helper.validate_and_update_selector_string(
1019
+ selector_string, self._signal_obj
1020
+ )
1021
+ attr_val, error_code = self._interpreter.get_attribute_f64(
1022
+ updated_selector_string,
1023
+ attributes.AttributeID.SPARAMS_GROUP_DELAY_APERTURE_FREQUENCY_SPAN.value,
1024
+ )
1025
+ finally:
1026
+ self._session_function_lock.exit_read_lock()
1027
+
1028
+ return attr_val, error_code
1029
+
1030
+ @_raise_if_disposed
1031
+ def set_group_delay_aperture_frequency_span(self, selector_string, value):
1032
+ r"""Sets the group delay aperture in terms of the frequency separation between the two frequency points selected for
1033
+ group delay computation for all S-Parameters for which :py:attr:`~nirfmxvna.attributes.AttributeID.SPARAMS_FORMAT`
1034
+ attribute is set to **Group Delay** and :py:attr:`~nirfmxvna.attributes.AttributeID.SPARAMS_GROUP_DELAY_APERTURE_MODE`
1035
+ attribute is set to **Frequency Span**.
1036
+
1037
+ You do not need to use a selector string to configure or read this attribute for the default signal instance.
1038
+ Refer to the `Selector String <https://www.ni.com/docs/en-US/bundle/rfmx/page/selector-strings-net.html>`_ topic for
1039
+ information about the string syntax for named signals.
1040
+
1041
+ The default value is 50 MHz.
1042
+
1043
+ Args:
1044
+ selector_string (string):
1045
+ Pass an empty string.
1046
+
1047
+ value (float):
1048
+ Specifies the group delay aperture in terms of the frequency separation between the two frequency points selected for
1049
+ group delay computation for all S-Parameters for which :py:attr:`~nirfmxvna.attributes.AttributeID.SPARAMS_FORMAT`
1050
+ attribute is set to **Group Delay** and :py:attr:`~nirfmxvna.attributes.AttributeID.SPARAMS_GROUP_DELAY_APERTURE_MODE`
1051
+ attribute is set to **Frequency Span**.
1052
+
1053
+ Returns:
1054
+ int:
1055
+ Returns the status code of this method. The status code either indicates success or describes a warning condition.
1056
+ """
1057
+ try:
1058
+ self._session_function_lock.enter_read_lock()
1059
+ updated_selector_string = _helper.validate_and_update_selector_string(
1060
+ selector_string, self._signal_obj
1061
+ )
1062
+ error_code = self._interpreter.set_attribute_f64(
1063
+ updated_selector_string,
1064
+ attributes.AttributeID.SPARAMS_GROUP_DELAY_APERTURE_FREQUENCY_SPAN.value,
1065
+ value,
1066
+ )
1067
+ finally:
1068
+ self._session_function_lock.exit_read_lock()
1069
+
1070
+ return error_code
1071
+
1072
+ @_raise_if_disposed
1073
+ def get_math_function(self, selector_string):
1074
+ r"""Gets the mathematical operation between the configured S-Parameter and its active measurement memory. All
1075
+ mathematical operations are applied on complex data before being formatted.
1076
+
1077
+ Use "sparam<*n*>" as the selector string to configure or read this attribute.
1078
+
1079
+ The default value is **Off**.
1080
+
1081
+ +--------------+-------------------------------------------------------------------+
1082
+ | Name (Value) | Description |
1083
+ +==============+===================================================================+
1084
+ | Off (0) | No mathematical operation is performed. |
1085
+ +--------------+-------------------------------------------------------------------+
1086
+ | Add (1) | Data in measurement memory is added to S-Parameter data. |
1087
+ +--------------+-------------------------------------------------------------------+
1088
+ | Subtract (2) | Data in measurement memory is subtracted from S-Parameter data. |
1089
+ +--------------+-------------------------------------------------------------------+
1090
+ | Multiply (3) | S-Parameter data is multiplied by the data in measurement memory. |
1091
+ +--------------+-------------------------------------------------------------------+
1092
+ | Divide (4) | S-Parameter data is divided by the data in measurement memory. |
1093
+ +--------------+-------------------------------------------------------------------+
1094
+
1095
+ Args:
1096
+ selector_string (string):
1097
+ Pass an empty string.
1098
+
1099
+ Returns:
1100
+ Tuple (attr_val, error_code):
1101
+
1102
+ attr_val (enums.SParamsMathFunction):
1103
+ Specifies the mathematical operation between the configured S-Parameter and its active measurement memory. All
1104
+ mathematical operations are applied on complex data before being formatted.
1105
+
1106
+ error_code (int):
1107
+ Returns the status code of this method. The status code either indicates success or describes a warning condition.
1108
+ """
1109
+ try:
1110
+ self._session_function_lock.enter_read_lock()
1111
+ updated_selector_string = _helper.validate_and_update_selector_string(
1112
+ selector_string, self._signal_obj
1113
+ )
1114
+ attr_val, error_code = self._interpreter.get_attribute_i32(
1115
+ updated_selector_string, attributes.AttributeID.SPARAMS_MATH_FUNCTION.value
1116
+ )
1117
+ attr_val = enums.SParamsMathFunction(attr_val)
1118
+ except (KeyError, ValueError):
1119
+ raise errors.DriverTooNewError() # type: ignore
1120
+ finally:
1121
+ self._session_function_lock.exit_read_lock()
1122
+
1123
+ return attr_val, error_code
1124
+
1125
+ @_raise_if_disposed
1126
+ def set_math_function(self, selector_string, value):
1127
+ r"""Sets the mathematical operation between the configured S-Parameter and its active measurement memory. All
1128
+ mathematical operations are applied on complex data before being formatted.
1129
+
1130
+ Use "sparam<*n*>" as the selector string to configure or read this attribute.
1131
+
1132
+ The default value is **Off**.
1133
+
1134
+ +--------------+-------------------------------------------------------------------+
1135
+ | Name (Value) | Description |
1136
+ +==============+===================================================================+
1137
+ | Off (0) | No mathematical operation is performed. |
1138
+ +--------------+-------------------------------------------------------------------+
1139
+ | Add (1) | Data in measurement memory is added to S-Parameter data. |
1140
+ +--------------+-------------------------------------------------------------------+
1141
+ | Subtract (2) | Data in measurement memory is subtracted from S-Parameter data. |
1142
+ +--------------+-------------------------------------------------------------------+
1143
+ | Multiply (3) | S-Parameter data is multiplied by the data in measurement memory. |
1144
+ +--------------+-------------------------------------------------------------------+
1145
+ | Divide (4) | S-Parameter data is divided by the data in measurement memory. |
1146
+ +--------------+-------------------------------------------------------------------+
1147
+
1148
+ Args:
1149
+ selector_string (string):
1150
+ Pass an empty string.
1151
+
1152
+ value (enums.SParamsMathFunction, int):
1153
+ Specifies the mathematical operation between the configured S-Parameter and its active measurement memory. All
1154
+ mathematical operations are applied on complex data before being formatted.
1155
+
1156
+ Returns:
1157
+ int:
1158
+ Returns the status code of this method. The status code either indicates success or describes a warning condition.
1159
+ """
1160
+ try:
1161
+ self._session_function_lock.enter_read_lock()
1162
+ updated_selector_string = _helper.validate_and_update_selector_string(
1163
+ selector_string, self._signal_obj
1164
+ )
1165
+ value = value.value if type(value) is enums.SParamsMathFunction else value
1166
+ error_code = self._interpreter.set_attribute_i32(
1167
+ updated_selector_string, attributes.AttributeID.SPARAMS_MATH_FUNCTION.value, value
1168
+ )
1169
+ finally:
1170
+ self._session_function_lock.exit_read_lock()
1171
+
1172
+ return error_code
1173
+
1174
+ @_raise_if_disposed
1175
+ def get_math_active_measurement_memory(self, selector_string):
1176
+ r"""Gets the active measurement memory for performing mathematical operations when several measurement memories are
1177
+ associated with the configured S-Parameter. If only one measurement memory is associated with the configured
1178
+ S-Parameter, that measurement memory will be used for mathematical operations.
1179
+
1180
+ Use "sparam<*n*>" as the selector string to configure or read this attribute.
1181
+
1182
+ Args:
1183
+ selector_string (string):
1184
+ Pass an empty string.
1185
+
1186
+ Returns:
1187
+ Tuple (attr_val, error_code):
1188
+
1189
+ attr_val (string):
1190
+ Specifies the active measurement memory for performing mathematical operations when several measurement memories are
1191
+ associated with the configured S-Parameter. If only one measurement memory is associated with the configured
1192
+ S-Parameter, that measurement memory will be used for mathematical operations.
1193
+
1194
+ error_code (int):
1195
+ Returns the status code of this method. The status code either indicates success or describes a warning condition.
1196
+ """
1197
+ try:
1198
+ self._session_function_lock.enter_read_lock()
1199
+ updated_selector_string = _helper.validate_and_update_selector_string(
1200
+ selector_string, self._signal_obj
1201
+ )
1202
+ attr_val, error_code = self._interpreter.get_attribute_string(
1203
+ updated_selector_string,
1204
+ attributes.AttributeID.SPARAMS_MATH_ACTIVE_MEASUREMENT_MEMORY.value,
1205
+ )
1206
+ finally:
1207
+ self._session_function_lock.exit_read_lock()
1208
+
1209
+ return attr_val, error_code
1210
+
1211
+ @_raise_if_disposed
1212
+ def set_math_active_measurement_memory(self, selector_string, value):
1213
+ r"""Sets the active measurement memory for performing mathematical operations when several measurement memories are
1214
+ associated with the configured S-Parameter. If only one measurement memory is associated with the configured
1215
+ S-Parameter, that measurement memory will be used for mathematical operations.
1216
+
1217
+ Use "sparam<*n*>" as the selector string to configure or read this attribute.
1218
+
1219
+ Args:
1220
+ selector_string (string):
1221
+ Pass an empty string.
1222
+
1223
+ value (string):
1224
+ Specifies the active measurement memory for performing mathematical operations when several measurement memories are
1225
+ associated with the configured S-Parameter. If only one measurement memory is associated with the configured
1226
+ S-Parameter, that measurement memory will be used for mathematical operations.
1227
+
1228
+ Returns:
1229
+ int:
1230
+ Returns the status code of this method. The status code either indicates success or describes a warning condition.
1231
+ """
1232
+ try:
1233
+ self._session_function_lock.enter_read_lock()
1234
+ updated_selector_string = _helper.validate_and_update_selector_string(
1235
+ selector_string, self._signal_obj
1236
+ )
1237
+ _helper.validate_not_none(value, "value")
1238
+ error_code = self._interpreter.set_attribute_string(
1239
+ updated_selector_string,
1240
+ attributes.AttributeID.SPARAMS_MATH_ACTIVE_MEASUREMENT_MEMORY.value,
1241
+ value,
1242
+ )
1243
+ finally:
1244
+ self._session_function_lock.exit_read_lock()
1245
+
1246
+ return error_code
1247
+
1248
+ @_raise_if_disposed
1249
+ def get_snp_data_format(self, selector_string):
1250
+ r"""Gets the format in which the measured S-parameters are saved in a SnP file.
1251
+
1252
+ You do not need to use a selector string to configure or read this attribute for the default signal instance.
1253
+ Refer to the `Selector String <https://www.ni.com/docs/en-US/bundle/rfmx/page/selector-strings-net.html>`_ topic for
1254
+ information about the string syntax for named signals.
1255
+
1256
+ The default value is **Auto**.
1257
+
1258
+ +----------------------------+--------------------------------------------------------------------------------------------------------------------------+
1259
+ | Name (Value) | Description |
1260
+ +============================+==========================================================================================================================+
1261
+ | Auto (0) | RFmx automatically selects the appropriate SnP Data Format based on the value specified for SParams Format |
1262
+ | | attribute. |
1263
+ | | If you set SParams Format to Complex or SWR or Smith Impedence or Smith Admittance or Group Delay, S-parameters are |
1264
+ | | saved in the Real-Imaginary format. |
1265
+ | | If you set SParams Format to Magnitude, S-parameters are saved as either Log Magnitude-Angle or Linear Magnitude-Angle |
1266
+ | | according to SParams Magnitude Units. |
1267
+ | | If you set SParams Format to Phase or Polar, S-parameters are saved as Linear Magnitude-Angle by default. |
1268
+ +----------------------------+--------------------------------------------------------------------------------------------------------------------------+
1269
+ | Log Magnitude-Angle (1) | All available S-parameters are represented as a pair of columns - first column stores magnitude of a S-Parameter in log |
1270
+ | | scale (dB) and second column stores phase of the S-Parameter in degrees. |
1271
+ +----------------------------+--------------------------------------------------------------------------------------------------------------------------+
1272
+ | Real-Imaginary (2) | All available S-parameters are represented as a pair of columns - first column stores real part of the complex-valued |
1273
+ | | S-Parameter and second column stores imaginary part. |
1274
+ +----------------------------+--------------------------------------------------------------------------------------------------------------------------+
1275
+ | Linear Magnitude-Angle (3) | All available S-parameters are represented as a pair of columns - first column stores magnitude of a S-Parameter in |
1276
+ | | linear scale (V/V) and second column stores phase of the S-Parameter in degrees. |
1277
+ +----------------------------+--------------------------------------------------------------------------------------------------------------------------+
1278
+
1279
+ Args:
1280
+ selector_string (string):
1281
+ Pass an empty string.
1282
+
1283
+ Returns:
1284
+ Tuple (attr_val, error_code):
1285
+
1286
+ attr_val (enums.SParamsSnPDataFormat):
1287
+ Specifies the format in which the measured S-parameters are saved in a SnP file.
1288
+
1289
+ error_code (int):
1290
+ Returns the status code of this method. The status code either indicates success or describes a warning condition.
1291
+ """
1292
+ try:
1293
+ self._session_function_lock.enter_read_lock()
1294
+ updated_selector_string = _helper.validate_and_update_selector_string(
1295
+ selector_string, self._signal_obj
1296
+ )
1297
+ attr_val, error_code = self._interpreter.get_attribute_i32(
1298
+ updated_selector_string, attributes.AttributeID.SPARAMS_SNP_DATA_FORMAT.value
1299
+ )
1300
+ attr_val = enums.SParamsSnPDataFormat(attr_val)
1301
+ except (KeyError, ValueError):
1302
+ raise errors.DriverTooNewError() # type: ignore
1303
+ finally:
1304
+ self._session_function_lock.exit_read_lock()
1305
+
1306
+ return attr_val, error_code
1307
+
1308
+ @_raise_if_disposed
1309
+ def set_snp_data_format(self, selector_string, value):
1310
+ r"""Sets the format in which the measured S-parameters are saved in a SnP file.
1311
+
1312
+ You do not need to use a selector string to configure or read this attribute for the default signal instance.
1313
+ Refer to the `Selector String <https://www.ni.com/docs/en-US/bundle/rfmx/page/selector-strings-net.html>`_ topic for
1314
+ information about the string syntax for named signals.
1315
+
1316
+ The default value is **Auto**.
1317
+
1318
+ +----------------------------+--------------------------------------------------------------------------------------------------------------------------+
1319
+ | Name (Value) | Description |
1320
+ +============================+==========================================================================================================================+
1321
+ | Auto (0) | RFmx automatically selects the appropriate SnP Data Format based on the value specified for SParams Format |
1322
+ | | attribute. |
1323
+ | | If you set SParams Format to Complex or SWR or Smith Impedence or Smith Admittance or Group Delay, S-parameters are |
1324
+ | | saved in the Real-Imaginary format. |
1325
+ | | If you set SParams Format to Magnitude, S-parameters are saved as either Log Magnitude-Angle or Linear Magnitude-Angle |
1326
+ | | according to SParams Magnitude Units. |
1327
+ | | If you set SParams Format to Phase or Polar, S-parameters are saved as Linear Magnitude-Angle by default. |
1328
+ +----------------------------+--------------------------------------------------------------------------------------------------------------------------+
1329
+ | Log Magnitude-Angle (1) | All available S-parameters are represented as a pair of columns - first column stores magnitude of a S-Parameter in log |
1330
+ | | scale (dB) and second column stores phase of the S-Parameter in degrees. |
1331
+ +----------------------------+--------------------------------------------------------------------------------------------------------------------------+
1332
+ | Real-Imaginary (2) | All available S-parameters are represented as a pair of columns - first column stores real part of the complex-valued |
1333
+ | | S-Parameter and second column stores imaginary part. |
1334
+ +----------------------------+--------------------------------------------------------------------------------------------------------------------------+
1335
+ | Linear Magnitude-Angle (3) | All available S-parameters are represented as a pair of columns - first column stores magnitude of a S-Parameter in |
1336
+ | | linear scale (V/V) and second column stores phase of the S-Parameter in degrees. |
1337
+ +----------------------------+--------------------------------------------------------------------------------------------------------------------------+
1338
+
1339
+ Args:
1340
+ selector_string (string):
1341
+ Pass an empty string.
1342
+
1343
+ value (enums.SParamsSnPDataFormat, int):
1344
+ Specifies the format in which the measured S-parameters are saved in a SnP file.
1345
+
1346
+ Returns:
1347
+ int:
1348
+ Returns the status code of this method. The status code either indicates success or describes a warning condition.
1349
+ """
1350
+ try:
1351
+ self._session_function_lock.enter_read_lock()
1352
+ updated_selector_string = _helper.validate_and_update_selector_string(
1353
+ selector_string, self._signal_obj
1354
+ )
1355
+ value = value.value if type(value) is enums.SParamsSnPDataFormat else value
1356
+ error_code = self._interpreter.set_attribute_i32(
1357
+ updated_selector_string, attributes.AttributeID.SPARAMS_SNP_DATA_FORMAT.value, value
1358
+ )
1359
+ finally:
1360
+ self._session_function_lock.exit_read_lock()
1361
+
1362
+ return error_code
1363
+
1364
+ @_raise_if_disposed
1365
+ def get_snp_user_comment(self, selector_string):
1366
+ r"""Gets a string that is incorporated into saved SnP file. You can specify any arbitrary string to add any meta
1367
+ information that you may want to store along with the measured S-Parameters data in SnP file. RFmx automatically adds a
1368
+ special token(!) at the start of this string such that any standard SnP file parsers would ignore this line.
1369
+ Additionally, multiline comments are allowed and each line is appended with the next line escape character.
1370
+
1371
+ You do not need to use a selector string to configure or read this attribute for the default signal instance.
1372
+ Refer to the `Selector String <https://www.ni.com/docs/en-US/bundle/rfmx/page/selector-strings-net.html>`_ topic for
1373
+ information about the string syntax for named signals.
1374
+
1375
+ Args:
1376
+ selector_string (string):
1377
+ Pass an empty string.
1378
+
1379
+ Returns:
1380
+ Tuple (attr_val, error_code):
1381
+
1382
+ attr_val (string):
1383
+ Specifies a string that is incorporated into saved SnP file. You can specify any arbitrary string to add any meta
1384
+ information that you may want to store along with the measured S-Parameters data in SnP file. RFmx automatically adds a
1385
+ special token(!) at the start of this string such that any standard SnP file parsers would ignore this line.
1386
+ Additionally, multiline comments are allowed and each line is appended with the next line escape character.
1387
+
1388
+ error_code (int):
1389
+ Returns the status code of this method. The status code either indicates success or describes a warning condition.
1390
+ """
1391
+ try:
1392
+ self._session_function_lock.enter_read_lock()
1393
+ updated_selector_string = _helper.validate_and_update_selector_string(
1394
+ selector_string, self._signal_obj
1395
+ )
1396
+ attr_val, error_code = self._interpreter.get_attribute_string(
1397
+ updated_selector_string, attributes.AttributeID.SPARAMS_SNP_USER_COMMENT.value
1398
+ )
1399
+ finally:
1400
+ self._session_function_lock.exit_read_lock()
1401
+
1402
+ return attr_val, error_code
1403
+
1404
+ @_raise_if_disposed
1405
+ def set_snp_user_comment(self, selector_string, value):
1406
+ r"""Sets a string that is incorporated into saved SnP file. You can specify any arbitrary string to add any meta
1407
+ information that you may want to store along with the measured S-Parameters data in SnP file. RFmx automatically adds a
1408
+ special token(!) at the start of this string such that any standard SnP file parsers would ignore this line.
1409
+ Additionally, multiline comments are allowed and each line is appended with the next line escape character.
1410
+
1411
+ You do not need to use a selector string to configure or read this attribute for the default signal instance.
1412
+ Refer to the `Selector String <https://www.ni.com/docs/en-US/bundle/rfmx/page/selector-strings-net.html>`_ topic for
1413
+ information about the string syntax for named signals.
1414
+
1415
+ Args:
1416
+ selector_string (string):
1417
+ Pass an empty string.
1418
+
1419
+ value (string):
1420
+ Specifies a string that is incorporated into saved SnP file. You can specify any arbitrary string to add any meta
1421
+ information that you may want to store along with the measured S-Parameters data in SnP file. RFmx automatically adds a
1422
+ special token(!) at the start of this string such that any standard SnP file parsers would ignore this line.
1423
+ Additionally, multiline comments are allowed and each line is appended with the next line escape character.
1424
+
1425
+ Returns:
1426
+ int:
1427
+ Returns the status code of this method. The status code either indicates success or describes a warning condition.
1428
+ """
1429
+ try:
1430
+ self._session_function_lock.enter_read_lock()
1431
+ updated_selector_string = _helper.validate_and_update_selector_string(
1432
+ selector_string, self._signal_obj
1433
+ )
1434
+ _helper.validate_not_none(value, "value")
1435
+ error_code = self._interpreter.set_attribute_string(
1436
+ updated_selector_string,
1437
+ attributes.AttributeID.SPARAMS_SNP_USER_COMMENT.value,
1438
+ value,
1439
+ )
1440
+ finally:
1441
+ self._session_function_lock.exit_read_lock()
1442
+
1443
+ return error_code
1444
+
1445
+ @_raise_if_disposed
1446
+ def get_snp_ports(self, selector_string):
1447
+ r"""Gets the ports for which the measured S-parameters are saved to file.
1448
+
1449
+ You do not need to use a selector string to configure or read this attribute for the default signal instance.
1450
+ Refer to the `Selector String <https://www.ni.com/docs/en-US/bundle/rfmx/page/selector-strings-net.html>`_ topic for
1451
+ information about the string syntax for named signals.
1452
+
1453
+ Args:
1454
+ selector_string (string):
1455
+ Pass an empty string.
1456
+
1457
+ Returns:
1458
+ Tuple (attr_val, error_code):
1459
+
1460
+ attr_val (string):
1461
+ Specifies the ports for which the measured S-parameters are saved to file.
1462
+
1463
+ error_code (int):
1464
+ Returns the status code of this method. The status code either indicates success or describes a warning condition.
1465
+ """
1466
+ try:
1467
+ self._session_function_lock.enter_read_lock()
1468
+ updated_selector_string = _helper.validate_and_update_selector_string(
1469
+ selector_string, self._signal_obj
1470
+ )
1471
+ attr_val, error_code = self._interpreter.get_attribute_string(
1472
+ updated_selector_string, attributes.AttributeID.SPARAMS_SNP_PORTS.value
1473
+ )
1474
+ finally:
1475
+ self._session_function_lock.exit_read_lock()
1476
+
1477
+ return attr_val, error_code
1478
+
1479
+ @_raise_if_disposed
1480
+ def set_snp_ports(self, selector_string, value):
1481
+ r"""Sets the ports for which the measured S-parameters are saved to file.
1482
+
1483
+ You do not need to use a selector string to configure or read this attribute for the default signal instance.
1484
+ Refer to the `Selector String <https://www.ni.com/docs/en-US/bundle/rfmx/page/selector-strings-net.html>`_ topic for
1485
+ information about the string syntax for named signals.
1486
+
1487
+ Args:
1488
+ selector_string (string):
1489
+ Pass an empty string.
1490
+
1491
+ value (string):
1492
+ Specifies the ports for which the measured S-parameters are saved to file.
1493
+
1494
+ Returns:
1495
+ int:
1496
+ Returns the status code of this method. The status code either indicates success or describes a warning condition.
1497
+ """
1498
+ try:
1499
+ self._session_function_lock.enter_read_lock()
1500
+ updated_selector_string = _helper.validate_and_update_selector_string(
1501
+ selector_string, self._signal_obj
1502
+ )
1503
+ _helper.validate_not_none(value, "value")
1504
+ error_code = self._interpreter.set_attribute_string(
1505
+ updated_selector_string, attributes.AttributeID.SPARAMS_SNP_PORTS.value, value
1506
+ )
1507
+ finally:
1508
+ self._session_function_lock.exit_read_lock()
1509
+
1510
+ return error_code
1511
+
1512
+ @_raise_if_disposed
1513
+ def configure_s_parameter(self, selector_string, s_parameter):
1514
+ r"""Configures the S-Parameter to be measured in format S<*receiver port number*><*source port number*>
1515
+
1516
+ Use "sparam<*n*>" as the selector string to configure this method.
1517
+
1518
+ This method sets :py:attr:`~nirfmxvna.attributes.AttributeID.SPARAMS_SOURCE_PORT` and
1519
+ :py:attr:`~nirfmxvna.attributes.AttributeID.SPARAMS_RECEIVER_PORT` attributes.
1520
+
1521
+ **Supported devices**: NI PXIe-5633
1522
+
1523
+ Args:
1524
+ selector_string (string):
1525
+ This parameter specifies a selector string comprising of result name, and S-Parameter number.
1526
+
1527
+ Example:
1528
+
1529
+ "sparam0"
1530
+
1531
+ "result::r1/sparam0"
1532
+
1533
+ You can use the :py:meth:`build_s_parameter_string` method to build the selector string.
1534
+
1535
+ s_parameter (string):
1536
+ This parameter specifies the S-Parameter to be measured in format S<*receiver port number*><*source port number*>.
1537
+
1538
+ Returns:
1539
+ int:
1540
+ Returns the status code of this method. The status code either indicates success or describes a warning condition.
1541
+ """
1542
+ try:
1543
+ self._session_function_lock.enter_read_lock()
1544
+ _helper.validate_not_none(selector_string, "selector_string")
1545
+ _helper.validate_not_none(s_parameter, "s_parameter")
1546
+ updated_selector_string = _helper.validate_and_update_selector_string(
1547
+ selector_string, self._signal_obj
1548
+ )
1549
+ error_code = self._interpreter.s_params_configure_s_parameter(
1550
+ updated_selector_string, s_parameter
1551
+ )
1552
+ finally:
1553
+ self._session_function_lock.exit_read_lock()
1554
+
1555
+ return error_code
1556
+
1557
+ @_raise_if_disposed
1558
+ def export_to_snp_file(self, selector_string, snp_file_path):
1559
+ r"""Exports the measured S-parameters to a SnP file.
1560
+
1561
+ You can set format of the exported S-Parameters using
1562
+ :py:attr:`~nirfmxvna.attributes.AttributeID.SPARAMS_SNP_DATA_FORMAT` attribute, use
1563
+ :py:attr:`~nirfmxvna.attributes.AttributeID.SPARAMS_SNP_USER_COMMENT` attribute to add any additional comments and use
1564
+ :py:attr:`~nirfmxvna.attributes.AttributeID.SPARAMS_SNP_PORTS` attribute to specify a subset of VNA ports. This method
1565
+ exports the S-Parameters associated with :py:attr:`~nirfmxvna.attributes.AttributeID.SPARAMS_SNP_PORTS`.
1566
+
1567
+ For a N-port VNA, assume that you measure S11, S12, …, S1M, S21, S22, ..., S2M, SM1, SM2, ..., SMM parameters,
1568
+ where M<=N. SnP file export behaviors for various scenarios are as follows:
1569
+
1570
+ **Case 1:** You specify file extension as S<N>P. S-Parameter data for ports M+1, M+2, .., N in the exported
1571
+ file are zero-filled when S-Parameter data is in linear format, and are filled with -200 dB magnitude and 45 degrees
1572
+ angle in log format.
1573
+
1574
+ **Example:** For a 2-Port VNA, if you measure only S11 and export the S-Parameters to a *.s2p file, then
1575
+ resulting file will contain measured S11 data and zero-filled S21, S12 and S22 data.
1576
+
1577
+ **Case 2:** You specify file extension as S<M>P. Resulting *.s<M>p file contains S-Parameters S11, …, SMM data.
1578
+
1579
+ **Example:** For a 2-Port VNA, if you measure only S11 and export the S-Parameters to a *.s1p file, then
1580
+ resulting file will contain measured S11 data
1581
+
1582
+ Args:
1583
+ selector_string (string):
1584
+ This parameter specifies a selector string comprising of result name.
1585
+
1586
+ Example:
1587
+
1588
+ ""
1589
+
1590
+ "result::r1"
1591
+
1592
+ You can use the :py:meth:`build_s_parameter_string` method to build the selector string.
1593
+
1594
+ snp_file_path (string):
1595
+ This parameter Specifies the full path to the exported *.snp file. If the specified file doesn't exist, RFmx creates a
1596
+ new file, whereas contents of an already existing file are overwritten.
1597
+
1598
+ Returns:
1599
+ int:
1600
+ Returns the status code of this method. The status code either indicates success or describes a warning condition.
1601
+ """
1602
+ try:
1603
+ self._session_function_lock.enter_read_lock()
1604
+ _helper.validate_not_none(selector_string, "selector_string")
1605
+ _helper.validate_not_none(snp_file_path, "snp_file_path")
1606
+ updated_selector_string = _helper.validate_and_update_selector_string(
1607
+ selector_string, self._signal_obj
1608
+ )
1609
+ error_code = self._interpreter.s_params_export_to_snp_file(
1610
+ updated_selector_string, snp_file_path
1611
+ )
1612
+ finally:
1613
+ self._session_function_lock.exit_read_lock()
1614
+
1615
+ return error_code
1616
+
1617
+ @_raise_if_disposed
1618
+ def get_s_parameter(self, selector_string):
1619
+ r"""Returns the S-Parameter being measured in format S(receiver port number)(source port number)
1620
+
1621
+ Use "sparam(n)" as the selector string for this method.
1622
+
1623
+ **Supported devices**: NI PXIe-5633
1624
+
1625
+ Args:
1626
+ selector_string (string):
1627
+ This parameter specifies a selector string comprising of result name, and S-Parameter number.
1628
+
1629
+ Example:
1630
+
1631
+ \"sparam0\"
1632
+
1633
+ \"result::r1/sparam0\"
1634
+
1635
+ You can use the :py:meth:`build_s_parameter_string` method to build the selector string.
1636
+
1637
+ Returns:
1638
+ Tuple (s_parameter, error_code):
1639
+
1640
+ s_parameter (string):
1641
+ This parameter returns the S-Parameter being measured in format S<*receiver port number*><*source port number*>.
1642
+
1643
+ error_code (int):
1644
+ Returns the status code of this method. The status code either indicates success or describes a warning condition.
1645
+ """
1646
+ try:
1647
+ self._session_function_lock.enter_read_lock()
1648
+ _helper.validate_not_none(selector_string, "selector_string")
1649
+ updated_selector_string = _helper.validate_and_update_selector_string(
1650
+ selector_string, self._signal_obj
1651
+ )
1652
+ s_parameter, error_code = self._interpreter.get_s_parameter(updated_selector_string)
1653
+ finally:
1654
+ self._session_function_lock.exit_read_lock()
1655
+
1656
+ return s_parameter, error_code