Skip to content

Commit 6ca1890

Browse files
authored
Enable deembedding methods and more misc changes (#2123)
* deembedding and misc changes * fixed flake errors * fixes based on review comments --------- Co-authored-by: vnktshr21 <[email protected]>
1 parent 97dc7b8 commit 6ca1890

File tree

16 files changed

+1089
-691
lines changed

16 files changed

+1089
-691
lines changed

docs/nirfsg/class.rst

Lines changed: 265 additions & 267 deletions
Large diffs are not rendered by default.

docs/nirfsg/enums.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -626,12 +626,12 @@ GenerationMode
626626

627627

628628

629-
IQOutPortTermCfg
630-
----------------
629+
IQOutPortTerminalConfiguration
630+
------------------------------
631631

632-
.. py:class:: IQOutPortTermCfg
632+
.. py:class:: IQOutPortTerminalConfiguration
633633
634-
.. py:attribute:: IQOutPortTermCfg.DIFFERENTIAL
634+
.. py:attribute:: IQOutPortTerminalConfiguration.DIFFERENTIAL
635635
636636
637637
@@ -641,7 +641,7 @@ IQOutPortTermCfg
641641

642642

643643

644-
.. py:attribute:: IQOutPortTermCfg.SINGLE_ENDED
644+
.. py:attribute:: IQOutPortTerminalConfiguration.SINGLE_ENDED
645645
646646
647647

docs/nirfsg/rep_caps.rst

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,17 +113,17 @@ ports
113113
passes a string of :python:`'0, 1, 2'` to the set attribute function.
114114

115115

116-
lo_channels
117-
-----------
116+
los
117+
---
118118

119-
.. py:attribute:: nirfsg.Session.lo_channels[]
119+
.. py:attribute:: nirfsg.Session.los[]
120120
121121
If no prefix is added to the items in the parameter, the correct prefix will be added when
122122
the driver function call is made.
123123

124124
.. code:: python
125125
126-
session.lo_channels['0-2'].channel_enabled = True
126+
session.los['0-2'].channel_enabled = True
127127
128128
passes a string of :python:`'LO0, LO1, LO2'` to the set attribute function.
129129

@@ -134,9 +134,33 @@ lo_channels
134134

135135
.. code:: python
136136
137-
session.lo_channels['LO0-LO2'].channel_enabled = True
137+
session.los['LO0-LO2'].channel_enabled = True
138138
139139
passes a string of :python:`'LO0, LO1, LO2'` to the set attribute function.
140140

141141

142+
device_temperatures
143+
-------------------
144+
145+
.. py:attribute:: nirfsg.Session.device_temperatures[]
146+
147+
.. code:: python
148+
149+
session.device_temperatures['0-2'].channel_enabled = True
150+
151+
passes a string of :python:`'0, 1, 2'` to the set attribute function.
152+
153+
154+
channels
155+
--------
156+
157+
.. py:attribute:: nirfsg.Session.channels[]
158+
159+
.. code:: python
160+
161+
session.channels['0-2'].channel_enabled = True
162+
163+
passes a string of :python:`'0, 1, 2'` to the set attribute function.
164+
165+
142166

generated/nirfsg/nirfsg/_library.py

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ def __init__(self, ctypes_library):
4949
self.niRFSG_ConfigureRefClock_cfunc = None
5050
self.niRFSG_ConfigureSoftwareScriptTrigger_cfunc = None
5151
self.niRFSG_ConfigureSoftwareStartTrigger_cfunc = None
52+
self.niRFSG_CreateDeembeddingSparameterTableArray_cfunc = None
5253
self.niRFSG_CreateDeembeddingSparameterTableS2PFile_cfunc = None
5354
self.niRFSG_DeleteAllDeembeddingTables_cfunc = None
5455
self.niRFSG_DeleteDeembeddingTable_cfunc = None
@@ -57,7 +58,6 @@ def __init__(self, ctypes_library):
5758
self.niRFSG_DisableStartTrigger_cfunc = None
5859
self.niRFSG_ErrorMessage_cfunc = None
5960
self.niRFSG_ErrorQuery_cfunc = None
60-
self.niRFSG_ExportSignal_cfunc = None
6161
self.niRFSG_GetAllNamedWaveformNames_cfunc = None
6262
self.niRFSG_GetAllScriptNames_cfunc = None
6363
self.niRFSG_GetAttributeViBoolean_cfunc = None
@@ -67,6 +67,8 @@ def __init__(self, ctypes_library):
6767
self.niRFSG_GetAttributeViSession_cfunc = None
6868
self.niRFSG_GetAttributeViString_cfunc = None
6969
self.niRFSG_GetChannelName_cfunc = None
70+
self.niRFSG_GetDeembeddingSparameters_cfunc = None
71+
self.niRFSG_GetDeembeddingTableNumberOfPorts_cfunc = None
7072
self.niRFSG_GetError_cfunc = None
7173
self.niRFSG_GetExternalCalibrationLastDateAndTime_cfunc = None
7274
self.niRFSG_GetMaxSettablePower_cfunc = None
@@ -353,6 +355,14 @@ def niRFSG_ConfigureSoftwareStartTrigger(self, vi): # noqa: N802
353355
self.niRFSG_ConfigureSoftwareStartTrigger_cfunc.restype = ViStatus # noqa: F405
354356
return self.niRFSG_ConfigureSoftwareStartTrigger_cfunc(vi)
355357

358+
def niRFSG_CreateDeembeddingSparameterTableArray(self, vi, port, table_name, frequencies, frequencies_size, sparameter_table, sparameter_table_size, number_of_ports, sparameter_orientation): # noqa: N802
359+
with self._func_lock:
360+
if self.niRFSG_CreateDeembeddingSparameterTableArray_cfunc is None:
361+
self.niRFSG_CreateDeembeddingSparameterTableArray_cfunc = self._get_library_function('niRFSG_CreateDeembeddingSparameterTableArray')
362+
self.niRFSG_CreateDeembeddingSparameterTableArray_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ctypes.POINTER(ViReal64), ViInt32, ctypes.POINTER(NIComplexNumber), ViInt32, ViInt32, ViInt32] # noqa: F405
363+
self.niRFSG_CreateDeembeddingSparameterTableArray_cfunc.restype = ViStatus # noqa: F405
364+
return self.niRFSG_CreateDeembeddingSparameterTableArray_cfunc(vi, port, table_name, frequencies, frequencies_size, sparameter_table, sparameter_table_size, number_of_ports, sparameter_orientation)
365+
356366
def niRFSG_CreateDeembeddingSparameterTableS2PFile(self, vi, port, table_name, s2p_file_path, sparameter_orientation): # noqa: N802
357367
with self._func_lock:
358368
if self.niRFSG_CreateDeembeddingSparameterTableS2PFile_cfunc is None:
@@ -417,14 +427,6 @@ def niRFSG_ErrorQuery(self, vi, error_code, error_message): # noqa: N802
417427
self.niRFSG_ErrorQuery_cfunc.restype = ViStatus # noqa: F405
418428
return self.niRFSG_ErrorQuery_cfunc(vi, error_code, error_message)
419429

420-
def niRFSG_ExportSignal(self, vi, signal, signal_identifier, output_terminal): # noqa: N802
421-
with self._func_lock:
422-
if self.niRFSG_ExportSignal_cfunc is None:
423-
self.niRFSG_ExportSignal_cfunc = self._get_library_function('niRFSG_ExportSignal')
424-
self.niRFSG_ExportSignal_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar)] # noqa: F405
425-
self.niRFSG_ExportSignal_cfunc.restype = ViStatus # noqa: F405
426-
return self.niRFSG_ExportSignal_cfunc(vi, signal, signal_identifier, output_terminal)
427-
428430
def niRFSG_GetAllNamedWaveformNames(self, vi, waveform_names, buffer_size, actual_buffer_size): # noqa: N802
429431
with self._func_lock:
430432
if self.niRFSG_GetAllNamedWaveformNames_cfunc is None:
@@ -497,6 +499,22 @@ def niRFSG_GetChannelName(self, vi, index, buffer_size, name): # noqa: N802
497499
self.niRFSG_GetChannelName_cfunc.restype = ViStatus # noqa: F405
498500
return self.niRFSG_GetChannelName_cfunc(vi, index, buffer_size, name)
499501

502+
def niRFSG_GetDeembeddingSparameters(self, vi, sparameters, sparameter_array_size, number_of_sparameters, number_of_ports): # noqa: N802
503+
with self._func_lock:
504+
if self.niRFSG_GetDeembeddingSparameters_cfunc is None:
505+
self.niRFSG_GetDeembeddingSparameters_cfunc = self._get_library_function('niRFSG_GetDeembeddingSparameters')
506+
self.niRFSG_GetDeembeddingSparameters_cfunc.argtypes = [ViSession, ctypes.POINTER(NIComplexNumber), ViInt32, ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32)] # noqa: F405
507+
self.niRFSG_GetDeembeddingSparameters_cfunc.restype = ViStatus # noqa: F405
508+
return self.niRFSG_GetDeembeddingSparameters_cfunc(vi, sparameters, sparameter_array_size, number_of_sparameters, number_of_ports)
509+
510+
def niRFSG_GetDeembeddingTableNumberOfPorts(self, vi, number_of_ports): # noqa: N802
511+
with self._func_lock:
512+
if self.niRFSG_GetDeembeddingTableNumberOfPorts_cfunc is None:
513+
self.niRFSG_GetDeembeddingTableNumberOfPorts_cfunc = self._get_library_function('niRFSG_GetDeembeddingTableNumberOfPorts')
514+
self.niRFSG_GetDeembeddingTableNumberOfPorts_cfunc.argtypes = [ViSession, ctypes.POINTER(ViInt32)] # noqa: F405
515+
self.niRFSG_GetDeembeddingTableNumberOfPorts_cfunc.restype = ViStatus # noqa: F405
516+
return self.niRFSG_GetDeembeddingTableNumberOfPorts_cfunc(vi, number_of_ports)
517+
500518
def niRFSG_GetError(self, vi, error_code, error_description_buffer_size, error_description): # noqa: N802
501519
with self._func_lock:
502520
if self.niRFSG_GetError_cfunc is None:

generated/nirfsg/nirfsg/_library_interpreter.py

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,20 @@ def configure_software_start_trigger(self): # noqa: N802
315315
errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
316316
return
317317

318+
def create_deembedding_sparameter_table_array(self, port, table_name, frequencies, sparameter_table, sparameter_table_size, number_of_ports, sparameter_orientation): # noqa: N802
319+
vi_ctype = _visatype.ViSession(self._vi) # case S110
320+
port_ctype = ctypes.create_string_buffer(port.encode(self._encoding)) # case C020
321+
table_name_ctype = ctypes.create_string_buffer(table_name.encode(self._encoding)) # case C020
322+
frequencies_ctype = _get_ctypes_pointer_for_buffer(value=frequencies) # case B510
323+
frequencies_size_ctype = _visatype.ViInt32(0 if frequencies is None else len(frequencies)) # case S160
324+
sparameter_table_ctype = _get_ctypes_pointer_for_buffer(value=sparameter_table, library_type=_complextype.NIComplexNumber) # case B510
325+
sparameter_table_size_ctype = _visatype.ViInt32(sparameter_table_size) # case S150
326+
number_of_ports_ctype = _visatype.ViInt32(number_of_ports) # case S150
327+
sparameter_orientation_ctype = _visatype.ViInt32(sparameter_orientation.value) # case S130
328+
error_code = self._library.niRFSG_CreateDeembeddingSparameterTableArray(vi_ctype, port_ctype, table_name_ctype, frequencies_ctype, frequencies_size_ctype, sparameter_table_ctype, sparameter_table_size_ctype, number_of_ports_ctype, sparameter_orientation_ctype)
329+
errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
330+
return
331+
318332
def create_deembedding_sparameter_table_s2p_file(self, port, table_name, s2p_file_path, sparameter_orientation): # noqa: N802
319333
vi_ctype = _visatype.ViSession(self._vi) # case S110
320334
port_ctype = ctypes.create_string_buffer(port.encode(self._encoding)) # case C020
@@ -374,15 +388,6 @@ def error_query(self): # noqa: N802
374388
errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
375389
return int(error_code_ctype.value), error_message_ctype.value.decode(self._encoding)
376390

377-
def export_signal(self, signal, signal_identifier, output_terminal): # noqa: N802
378-
vi_ctype = _visatype.ViSession(self._vi) # case S110
379-
signal_ctype = _visatype.ViInt32(signal.value) # case S130
380-
signal_identifier_ctype = ctypes.create_string_buffer(signal_identifier.encode(self._encoding)) # case C020
381-
output_terminal_ctype = ctypes.create_string_buffer(output_terminal.encode(self._encoding)) # case C020
382-
error_code = self._library.niRFSG_ExportSignal(vi_ctype, signal_ctype, signal_identifier_ctype, output_terminal_ctype)
383-
errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
384-
return
385-
386391
def get_all_named_waveform_names(self): # noqa: N802
387392
vi_ctype = _visatype.ViSession(self._vi) # case S110
388393
waveform_names_ctype = None # case C050
@@ -481,6 +486,23 @@ def get_channel_name(self, index): # noqa: N802
481486
errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
482487
return name_ctype.value.decode(self._encoding)
483488

489+
def get_deembedding_sparameters(self, sparameters, sparameter_array_size): # noqa: N802
490+
vi_ctype = _visatype.ViSession(self._vi) # case S110
491+
sparameters_ctype = _get_ctypes_pointer_for_buffer(value=sparameters, library_type=_complextype.NIComplexNumber) # case B510
492+
sparameter_array_size_ctype = _visatype.ViInt32(sparameter_array_size) # case S150
493+
number_of_sparameters_ctype = _visatype.ViInt32() # case S220
494+
number_of_ports_ctype = _visatype.ViInt32() # case S220
495+
error_code = self._library.niRFSG_GetDeembeddingSparameters(vi_ctype, sparameters_ctype, sparameter_array_size_ctype, None if number_of_sparameters_ctype is None else (ctypes.pointer(number_of_sparameters_ctype)), None if number_of_ports_ctype is None else (ctypes.pointer(number_of_ports_ctype)))
496+
errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
497+
return int(number_of_ports_ctype.value)
498+
499+
def get_deembedding_table_number_of_ports(self): # noqa: N802
500+
vi_ctype = _visatype.ViSession(self._vi) # case S110
501+
number_of_ports_ctype = _visatype.ViInt32() # case S220
502+
error_code = self._library.niRFSG_GetDeembeddingTableNumberOfPorts(vi_ctype, None if number_of_ports_ctype is None else (ctypes.pointer(number_of_ports_ctype)))
503+
errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
504+
return int(number_of_ports_ctype.value)
505+
484506
def get_error(self): # noqa: N802
485507
vi_ctype = _visatype.ViSession(self._vi) # case S110
486508
error_code_ctype = _visatype.ViStatus() # case S220

generated/nirfsg/nirfsg/enums.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ class GenerationMode(Enum):
273273
'''
274274

275275

276-
class IQOutPortTermCfg(Enum):
276+
class IQOutPortTerminalConfiguration(Enum):
277277
DIFFERENTIAL = 15000
278278
r'''
279279
Sets the terminal configuration to differential.

0 commit comments

Comments
 (0)