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,429 @@
1
+ """Provides methods to configure the Marker measurement."""
2
+
3
+ import functools
4
+
5
+ import nirfmxvna.enums as enums
6
+ import nirfmxvna.errors as errors
7
+ import nirfmxvna.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 Vna signal configuration")
18
+ return f(*xs, **kws)
19
+
20
+ return aux
21
+
22
+
23
+ class MarkerConfiguration(object):
24
+ """Provides methods to configure the Marker measurement."""
25
+
26
+ def __init__(self, signal_obj):
27
+ """Provides methods to configure the Marker measurement."""
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 configure_number_of_markers(self, selector_string, number_of_markers):
34
+ r"""Configures the number of markers.
35
+
36
+ Args:
37
+ selector_string (string):
38
+ Pass an empty string.
39
+ The signal name that is passed when creating the signal configuration is used.
40
+
41
+ number_of_markers (int):
42
+ This parameter specifies the number of markers. If you increase number of markers from N to N+K, then existing N
43
+ markers are not affected but K new markers are added. If you reduce number of markers from N to N-K, then last K
44
+ markers are deleted without affecting the remaining N-K markers.
45
+
46
+ Returns:
47
+ int:
48
+ Returns the status code of this method. The status code either indicates success or describes a warning condition.
49
+ """
50
+ try:
51
+ self._session_function_lock.enter_read_lock()
52
+ _helper.validate_not_none(selector_string, "selector_string")
53
+ updated_selector_string = _helper.validate_and_update_selector_string(
54
+ selector_string, self._signal_obj
55
+ )
56
+ error_code = self._interpreter.marker_configure_number_of_markers(
57
+ updated_selector_string, number_of_markers
58
+ )
59
+ finally:
60
+ self._session_function_lock.exit_read_lock()
61
+
62
+ return error_code
63
+
64
+ @_raise_if_disposed
65
+ def configure_type(self, selector_string, marker_type):
66
+ r"""Configures the marker type.
67
+ Use "marker<*n*>" as the selector string to configure this method.
68
+
69
+ Args:
70
+ selector_string (string):
71
+ Specifies a selector string. Pass an empty string.
72
+
73
+ marker_type (enums.MarkerType, int):
74
+ This parameter specifies whether the marker is disabled (Off) or is enabled (On) as a normal marker, delta marker or a
75
+ fixed marker. The default value is **Off**.
76
+
77
+ +--------------+-------------------------------------------+
78
+ | Name (Value) | Description |
79
+ +==============+===========================================+
80
+ | Off (0) | The marker is disabled. |
81
+ +--------------+-------------------------------------------+
82
+ | Normal (1) | The marker is enabled as a normal marker. |
83
+ +--------------+-------------------------------------------+
84
+ | Delta (3) | The marker is enabled as a delta marker. |
85
+ +--------------+-------------------------------------------+
86
+ | Fixed (4) | The marker is enabled as a fixed marker. |
87
+ +--------------+-------------------------------------------+
88
+
89
+ Returns:
90
+ int:
91
+ Returns the status code of this method. The status code either indicates success or describes a warning condition.
92
+ """
93
+ try:
94
+ self._session_function_lock.enter_read_lock()
95
+ _helper.validate_not_none(selector_string, "selector_string")
96
+ marker_type = (
97
+ marker_type.value if type(marker_type) is enums.MarkerType else marker_type
98
+ )
99
+ updated_selector_string = _helper.validate_and_update_selector_string(
100
+ selector_string, self._signal_obj
101
+ )
102
+ error_code = self._interpreter.marker_configure_type(
103
+ updated_selector_string, marker_type
104
+ )
105
+ finally:
106
+ self._session_function_lock.exit_read_lock()
107
+
108
+ return error_code
109
+
110
+ @_raise_if_disposed
111
+ def configure_reference_marker(self, selector_string, reference_marker):
112
+ r"""Configures an associated reference marker for a delta marker. Markers with Marker Type attribute set to Delta must be
113
+ associated with a reference marker. You cannot associate a reference marker for other markers whose Marker Type is not
114
+ Delta.
115
+
116
+ Use "marker<*n*>" as the selector string to configure this method.
117
+
118
+ Args:
119
+ selector_string (string):
120
+ Specifies a selector string. Pass an empty string.
121
+
122
+ reference_marker (int):
123
+ This parameter specifies the marker index to be used as reference for the specified delta marker. All types of markers
124
+ including **Normal**, **Delta** and **Fixed** can be used as a reference marker.
125
+
126
+ Returns:
127
+ int:
128
+ Returns the status code of this method. The status code either indicates success or describes a warning condition.
129
+ """
130
+ try:
131
+ self._session_function_lock.enter_read_lock()
132
+ _helper.validate_not_none(selector_string, "selector_string")
133
+ updated_selector_string = _helper.validate_and_update_selector_string(
134
+ selector_string, self._signal_obj
135
+ )
136
+ error_code = self._interpreter.marker_configure_reference_marker(
137
+ updated_selector_string, reference_marker
138
+ )
139
+ finally:
140
+ self._session_function_lock.exit_read_lock()
141
+
142
+ return error_code
143
+
144
+ @_raise_if_disposed
145
+ def configure_x(self, selector_string, marker_x):
146
+ r"""Configures the X value of the marker. You must configure the X value of reference marker or perform any marker search
147
+ operation on the reference marker before configuring the X value for the **Delta** marker.
148
+
149
+ Use "marker<*n*>" as the selector string to configure this method.
150
+
151
+ Args:
152
+ selector_string (string):
153
+ Specifies a selector string. Pass an empty string.
154
+
155
+ marker_x (float):
156
+ This parameter specifies the X value of the marker on the trace when you set the Marker Type to **Normal** or
157
+ **Fixed**. The X value of the delta marker is relative to the X value of the reference marker when you set the Marker
158
+ Type to **Delta**.
159
+
160
+ Returns:
161
+ int:
162
+ Returns the status code of this method. The status code either indicates success or describes a warning condition.
163
+ """
164
+ try:
165
+ self._session_function_lock.enter_read_lock()
166
+ _helper.validate_not_none(selector_string, "selector_string")
167
+ updated_selector_string = _helper.validate_and_update_selector_string(
168
+ selector_string, self._signal_obj
169
+ )
170
+ error_code = self._interpreter.marker_configure_x(updated_selector_string, marker_x)
171
+ finally:
172
+ self._session_function_lock.exit_read_lock()
173
+
174
+ return error_code
175
+
176
+ @_raise_if_disposed
177
+ def configure_y(self, selector_string, marker_y1, marker_y2):
178
+ r"""Configures the Y value of the marker. You can configure the Y location of **Fixed** markers only. Y value can be a real
179
+ or a complex number depending on format of the selected measurement for the configured data source. Y is a complex
180
+ number for Complex, Smith and Polar formats. For all other formats, Y is a real number.
181
+
182
+ If Y value is a complex number, use Marker Y1 and Marker Y2 to set its real and imaginary components
183
+ respectively. If Y value is a real number, use Marker Y1 to set the Y location and set Marker Y2 to 0.
184
+
185
+ When you want to use a **Fixed** marker as a reference marker for a Delta marker, then you must configure the Y
186
+ value of the **Fixed** reference marker by calling this method or by performing any marker search operation on the
187
+ reference marker before configuring the X value of the **Delta** marker.
188
+
189
+ Use "marker<*n*>" as the selector string to configure this method.
190
+
191
+ Args:
192
+ selector_string (string):
193
+ Specifies a selector string. Pass an empty string.
194
+
195
+ marker_y1 (float):
196
+ This parameter specifies the Y1 component of the **(Fixed)** marker's Y value.
197
+
198
+ marker_y2 (float):
199
+ This parameter specifies the Y2 component of the **(Fixed)** marker's Y value..
200
+
201
+ Returns:
202
+ int:
203
+ Returns the status code of this method. The status code either indicates success or describes a warning condition.
204
+ """
205
+ try:
206
+ self._session_function_lock.enter_read_lock()
207
+ _helper.validate_not_none(selector_string, "selector_string")
208
+ updated_selector_string = _helper.validate_and_update_selector_string(
209
+ selector_string, self._signal_obj
210
+ )
211
+ error_code = self._interpreter.marker_configure_y(
212
+ updated_selector_string, marker_y1, marker_y2
213
+ )
214
+ finally:
215
+ self._session_function_lock.exit_read_lock()
216
+
217
+ return error_code
218
+
219
+ @_raise_if_disposed
220
+ def configure_data_source(self, selector_string, data_source):
221
+ r"""Configures the data source on which marker operations are performed.
222
+ Use "marker<*n*>" as the selector string to configure this method.
223
+
224
+ Args:
225
+ selector_string (string):
226
+ Specifies a selector string. Pass an empty string.
227
+
228
+ data_source (string):
229
+ This parameter specifies the measurement or memory data on which markers are placed. If you want to place markers on
230
+ **SParams** measurement data, then specify this parameter as "sparam<*n*>".
231
+ If you want to place markers on **SParams** measurement memory data, then specify this parameter as
232
+ "sparam<*n*>/measmem::<*measMemoryName*>". Similarly, if you want to place markers on **Wave** measurement data, then
233
+ specify this parameter as "wave<*n*>".
234
+
235
+ Returns:
236
+ int:
237
+ Returns the status code of this method. The status code either indicates success or describes a warning condition.
238
+ """
239
+ try:
240
+ self._session_function_lock.enter_read_lock()
241
+ _helper.validate_not_none(selector_string, "selector_string")
242
+ _helper.validate_not_none(data_source, "data_source")
243
+ updated_selector_string = _helper.validate_and_update_selector_string(
244
+ selector_string, self._signal_obj
245
+ )
246
+ error_code = self._interpreter.marker_configure_data_source(
247
+ updated_selector_string, data_source
248
+ )
249
+ finally:
250
+ self._session_function_lock.exit_read_lock()
251
+
252
+ return error_code
253
+
254
+ @_raise_if_disposed
255
+ def configure_peak_search_threshold(self, selector_string, threshold_enabled, threshold):
256
+ r"""Configures the peak-search threshold. When peak-thresholding is enabled, Marker Search method in peak search mode finds
257
+ the peaks that exceed this value and discards all other peaks.
258
+
259
+ Use "marker<*n*>" as the selector string to configure this method.
260
+
261
+ Args:
262
+ selector_string (string):
263
+ Specifies a selector string. Pass an empty string.
264
+
265
+ threshold_enabled (enums.MarkerPeakSearchThresholdEnabled, int):
266
+ This parameter specifies whether :py:meth:`marker_search` finds a peak above specified Threshold or finds a peak
267
+ without considering any Threshold constraint.
268
+
269
+ +--------------+-----------------------------+
270
+ | Name (Value) | Description |
271
+ +==============+=============================+
272
+ | False (0) | Disables peak-thresholding. |
273
+ +--------------+-----------------------------+
274
+ | True (1) | Enables peak-thresholding. |
275
+ +--------------+-----------------------------+
276
+
277
+ threshold (float):
278
+ This parameter specifies the threshold value that a valid peak must exceed when you use :py:meth:`marker_search` to
279
+ find peaks. The threshold is expressed in the same units as the source data.
280
+
281
+ Returns:
282
+ int:
283
+ Returns the status code of this method. The status code either indicates success or describes a warning condition.
284
+ """
285
+ try:
286
+ self._session_function_lock.enter_read_lock()
287
+ _helper.validate_not_none(selector_string, "selector_string")
288
+ threshold_enabled = (
289
+ threshold_enabled.value
290
+ if type(threshold_enabled) is enums.MarkerPeakSearchThresholdEnabled
291
+ else threshold_enabled
292
+ )
293
+ updated_selector_string = _helper.validate_and_update_selector_string(
294
+ selector_string, self._signal_obj
295
+ )
296
+ error_code = self._interpreter.marker_configure_peak_search_threshold(
297
+ updated_selector_string, threshold_enabled, threshold
298
+ )
299
+ finally:
300
+ self._session_function_lock.exit_read_lock()
301
+
302
+ return error_code
303
+
304
+ @_raise_if_disposed
305
+ def configure_peak_search_excursion(
306
+ self, selector_string, peak_excursion_enabled, peak_excursion
307
+ ):
308
+ r"""Configures the peak-search excursion. When peak-excursion is enabled, peak search using Marker Search method finds a
309
+ peak such that the data value rises and falls around the peak by at least the specified peak excursion value.
310
+
311
+ Use "marker<*n*>" as the selector string to configure this method.
312
+
313
+ Args:
314
+ selector_string (string):
315
+ Specifies a selector string. Pass an empty string.
316
+
317
+ peak_excursion_enabled (enums.MarkerPeakSearchExcursionEnabled, int):
318
+ This parameter specifies whether :py:meth:`marker_search` finds a peak such that the data value rises and falls around
319
+ the peak by atleast the specified peak excursion value or finds a peak without considering any peak excursion
320
+ constraint.
321
+
322
+ +--------------+------------------------------+
323
+ | Name (Value) | Description |
324
+ +==============+==============================+
325
+ | False (0) | Disables the peak excursion. |
326
+ +--------------+------------------------------+
327
+ | True (1) | Enables the peak excursion. |
328
+ +--------------+------------------------------+
329
+
330
+ peak_excursion (float):
331
+ This parameter specifies the peak excursion value that :py:meth:`marker_search` uses to find a peak such that the data
332
+ value rises and falls around the peak by atleast the specified peak excursion value. The threshold is expressed in the
333
+ same units as the source data.
334
+
335
+ Returns:
336
+ int:
337
+ Returns the status code of this method. The status code either indicates success or describes a warning condition.
338
+ """
339
+ try:
340
+ self._session_function_lock.enter_read_lock()
341
+ _helper.validate_not_none(selector_string, "selector_string")
342
+ peak_excursion_enabled = (
343
+ peak_excursion_enabled.value
344
+ if type(peak_excursion_enabled) is enums.MarkerPeakSearchExcursionEnabled
345
+ else peak_excursion_enabled
346
+ )
347
+ updated_selector_string = _helper.validate_and_update_selector_string(
348
+ selector_string, self._signal_obj
349
+ )
350
+ error_code = self._interpreter.marker_configure_peak_search_excursion(
351
+ updated_selector_string, peak_excursion_enabled, peak_excursion
352
+ )
353
+ finally:
354
+ self._session_function_lock.exit_read_lock()
355
+
356
+ return error_code
357
+
358
+ @_raise_if_disposed
359
+ def configure_mode(self, selector_string, marker_mode):
360
+ r"""Configures the marker mode.
361
+ Use "marker<*n*>" as the selector string to configure this method.
362
+
363
+ Args:
364
+ selector_string (string):
365
+ Specifies a selector string. Pass an empty string.
366
+
367
+ marker_mode (enums.MarkerMode, int):
368
+ This parameter specifies the mode for placing the marker.
369
+
370
+ +----------------+-----------------------------------------------------------------------------------------------------------------------+
371
+ | Name (Value) | Description |
372
+ +================+=======================================================================================================================+
373
+ | Continuous (0) | Marker can be placed at any point and its response value is obtained by interpolation of actual measured data points. |
374
+ +----------------+-----------------------------------------------------------------------------------------------------------------------+
375
+ | Discrete (1) | Marker can be placed only at actual measured data points. |
376
+ +----------------+-----------------------------------------------------------------------------------------------------------------------+
377
+
378
+ Returns:
379
+ int:
380
+ Returns the status code of this method. The status code either indicates success or describes a warning condition.
381
+ """
382
+ try:
383
+ self._session_function_lock.enter_read_lock()
384
+ _helper.validate_not_none(selector_string, "selector_string")
385
+ marker_mode = (
386
+ marker_mode.value if type(marker_mode) is enums.MarkerMode else marker_mode
387
+ )
388
+ updated_selector_string = _helper.validate_and_update_selector_string(
389
+ selector_string, self._signal_obj
390
+ )
391
+ error_code = self._interpreter.marker_configure_mode(
392
+ updated_selector_string, marker_mode
393
+ )
394
+ finally:
395
+ self._session_function_lock.exit_read_lock()
396
+
397
+ return error_code
398
+
399
+ @_raise_if_disposed
400
+ def configure_target_value(self, selector_string, target_value):
401
+ r"""Configures the target value for the specified marker when performing Target search using Marker Search method.
402
+
403
+ Use "marker<*n*>" as the selector string to configure this method.
404
+
405
+ Args:
406
+ selector_string (string):
407
+ Specifies a selector string. Pass an empty string.
408
+
409
+ target_value (float):
410
+ This parameter specifies the target value for target search. The target value is expressed in the same units as the
411
+ source data.
412
+
413
+ Returns:
414
+ int:
415
+ Returns the status code of this method. The status code either indicates success or describes a warning condition.
416
+ """
417
+ try:
418
+ self._session_function_lock.enter_read_lock()
419
+ _helper.validate_not_none(selector_string, "selector_string")
420
+ updated_selector_string = _helper.validate_and_update_selector_string(
421
+ selector_string, self._signal_obj
422
+ )
423
+ error_code = self._interpreter.marker_configure_target_value(
424
+ updated_selector_string, target_value
425
+ )
426
+ finally:
427
+ self._session_function_lock.exit_read_lock()
428
+
429
+ return error_code
@@ -0,0 +1,168 @@
1
+ """Provides methods to fetch and read the Marker measurement results."""
2
+
3
+ import functools
4
+
5
+ import nirfmxvna.enums as enums
6
+ import nirfmxvna.errors as errors
7
+ import nirfmxvna.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 Vna signal configuration")
18
+ return f(*xs, **kws)
19
+
20
+ return aux
21
+
22
+
23
+ class MarkerResults(object):
24
+ """Provides methods to fetch and read the Marker measurement results."""
25
+
26
+ def __init__(self, signal_obj):
27
+ """Provides methods to fetch and read the Marker measurement results."""
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 marker_search(self, selector_string, search_mode):
34
+ r"""Performs the marker search operation that you specify using Search Mode.
35
+
36
+ .. note::
37
+ Marker search operation is performed on real-valued data only. No search operation is performed on complex-valued data.
38
+
39
+ Args:
40
+ selector_string (string):
41
+ Specifies a selector string. Pass an empty string.
42
+
43
+ search_mode (enums.MarkerSearchMode, int):
44
+ This parameter specifies the search-target. If search is successful, RFmx updates the marker X and Y values to the
45
+ location at which search-target is found.
46
+
47
+ +-----------------------+--------------------------------------------------------------------------------------------------------------------------+
48
+ | Name (Value) | Description |
49
+ +=======================+==========================================================================================================================+
50
+ | None (0) | No search operation is performed. |
51
+ +-----------------------+--------------------------------------------------------------------------------------------------------------------------+
52
+ | Max (1) | Moves the marker to the highest measured value on the configured data source. |
53
+ +-----------------------+--------------------------------------------------------------------------------------------------------------------------+
54
+ | Min (2) | Moves the marker to the lowest measured value on the configured data source. |
55
+ +-----------------------+--------------------------------------------------------------------------------------------------------------------------+
56
+ | Peak (3) | Moves the marker to the highest peak that satisfies peak threshold and peak excursion criteria. |
57
+ +-----------------------+--------------------------------------------------------------------------------------------------------------------------+
58
+ | Next Peak (4) | Moves the marker to the next peak that satisfies peak threshold and peak excursion criteria. |
59
+ +-----------------------+--------------------------------------------------------------------------------------------------------------------------+
60
+ | Next Left Peak (5) | Moves the marker to the next left peak that satisfies peak threshold and peak excursion criteria. |
61
+ +-----------------------+--------------------------------------------------------------------------------------------------------------------------+
62
+ | Next Right Peak (6) | Moves the marker to the next right peak that satisfies peak threshold and peak excursion criteria. |
63
+ +-----------------------+--------------------------------------------------------------------------------------------------------------------------+
64
+ | Target (7) | Moves the marker to the first right target encountered from the current marker position, wraps around if no target |
65
+ | | found. If marker mode is Discrete,marker moves to the data point closest to the first right target. |
66
+ +-----------------------+--------------------------------------------------------------------------------------------------------------------------+
67
+ | Next Left Target (8) | Moves the marker to the next left target encountered from the current marker position. If marker mode is |
68
+ | | Discrete,marker moves to the data point closest to the next left target. |
69
+ +-----------------------+--------------------------------------------------------------------------------------------------------------------------+
70
+ | Next Right Target (9) | Moves the marker to the next right target encountered from the current marker position. If marker mode is |
71
+ | | Discrete,marker moves to the data point closest to the next right target. |
72
+ +-----------------------+--------------------------------------------------------------------------------------------------------------------------+
73
+
74
+ Returns:
75
+ int:
76
+ Returns the status code of this method. The status code either indicates success or describes a warning condition.
77
+ """
78
+ try:
79
+ self._session_function_lock.enter_read_lock()
80
+ _helper.validate_not_none(selector_string, "selector_string")
81
+ search_mode = (
82
+ search_mode.value if type(search_mode) is enums.MarkerSearchMode else search_mode
83
+ )
84
+ updated_selector_string = _helper.validate_and_update_selector_string(
85
+ selector_string, self._signal_obj
86
+ )
87
+ error_code = self._interpreter.marker_marker_search(
88
+ updated_selector_string, search_mode
89
+ )
90
+ finally:
91
+ self._session_function_lock.exit_read_lock()
92
+
93
+ return error_code
94
+
95
+ @_raise_if_disposed
96
+ def fetch_x(self, selector_string):
97
+ r"""Returns the X value of the marker. X value of the **Delta** marker is relative to its reference marker.
98
+
99
+ Args:
100
+ selector_string (string):
101
+ Specifies a selector string. Pass an empty string.
102
+
103
+ Returns:
104
+ Tuple (marker_x, error_code):
105
+
106
+ marker_x (float):
107
+ This parameter returns the marker X value.
108
+
109
+ error_code (int):
110
+ Returns the status code of this method. The status code either indicates success or describes a warning condition.
111
+ """
112
+ try:
113
+ self._session_function_lock.enter_read_lock()
114
+ _helper.validate_not_none(selector_string, "selector_string")
115
+ updated_selector_string = _helper.validate_and_update_selector_string(
116
+ selector_string, self._signal_obj
117
+ )
118
+ marker_x, error_code = self._interpreter.marker_fetch_x(updated_selector_string)
119
+ finally:
120
+ self._session_function_lock.exit_read_lock()
121
+
122
+ return marker_x, error_code
123
+
124
+ @_raise_if_disposed
125
+ def fetch_y(self, selector_string):
126
+ r"""Returns the Y value of the marker. Y value of a **Delta** marker is relative to its reference marker.
127
+
128
+ Y value can be a real or a complex number depending on format of the selected measurement for the configured data
129
+ source. Y is a complex number for Complex, Smith and Polar formats. For all other formats, Y is a real number. If Y
130
+ value is a complex number, Marker Y1 and Marker Y2 return its real and imaginary components respectively. If Y value is
131
+ a real number, Marker Y1 returns the Y location and Marker Y2 returns 0.
132
+
133
+ Args:
134
+ selector_string (string):
135
+ Specifies a selector string. Pass an empty string.
136
+
137
+ Returns:
138
+ Tuple (marker_y1, marker_y2, error_code):
139
+
140
+ marker_y1 (float):
141
+ This parameter returns the Y1 component of marker's Y value.
142
+
143
+ marker_y2 (float):
144
+ This parameter returns the Y2 component of marker's Y value.
145
+
146
+ Y value is always returned as two components (Y1,Y2). The format of the Y value depends on the format of the
147
+ selected measurement.
148
+
149
+ If the format is Complex, Smith or Polar (Y1,Y2) are (Real, Imaginary).
150
+
151
+ For all other formats (Y1,Y2) are (Value,0).
152
+
153
+ error_code (int):
154
+ Returns the status code of this method. The status code either indicates success or describes a warning condition.
155
+ """
156
+ try:
157
+ self._session_function_lock.enter_read_lock()
158
+ _helper.validate_not_none(selector_string, "selector_string")
159
+ updated_selector_string = _helper.validate_and_update_selector_string(
160
+ selector_string, self._signal_obj
161
+ )
162
+ marker_y1, marker_y2, error_code = self._interpreter.marker_fetch_y(
163
+ updated_selector_string
164
+ )
165
+ finally:
166
+ self._session_function_lock.exit_read_lock()
167
+
168
+ return marker_y1, marker_y2, error_code
nirfmxvna/s_params.py ADDED
@@ -0,0 +1,31 @@
1
+ """Represents the SParams measurement."""
2
+
3
+ import functools
4
+
5
+ import nirfmxvna.s_params_configuration as configuration
6
+ import nirfmxvna.s_params_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 Vna signal configuration")
17
+ return f(*xs, **kws)
18
+
19
+ return aux
20
+
21
+
22
+ class SParams(object):
23
+ """Represents the SParams measurement."""
24
+
25
+ def __init__(self, signal_obj):
26
+ """Represents the SParams 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.SParamsConfiguration(signal_obj) # type: ignore
31
+ self.results = results.SParamsResults(signal_obj) # type: ignore