From dcfe5335bd787f303739ef63962007a627fb39d8 Mon Sep 17 00:00:00 2001 From: Rahul R Date: Wed, 25 Feb 2026 00:55:17 +0000 Subject: [PATCH 1/3] Initial commit --- generated/nirfsg/nirfsg/_library_interpreter.py | 4 ++-- generated/nirfsg/nirfsg/session.py | 10 ++++++---- src/nirfsg/metadata/functions.py | 4 ++++ .../create_deembedding_sparameter_table_array.py.mako | 6 ++++-- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/generated/nirfsg/nirfsg/_library_interpreter.py b/generated/nirfsg/nirfsg/_library_interpreter.py index 58a366dbb..30d7db3bd 100644 --- a/generated/nirfsg/nirfsg/_library_interpreter.py +++ b/generated/nirfsg/nirfsg/_library_interpreter.py @@ -240,14 +240,14 @@ def configure_software_start_trigger(self): # noqa: N802 errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return - def create_deembedding_sparameter_table_array(self, port, table_name, frequencies, sparameter_table, sparameter_table_size, number_of_ports, sparameter_orientation): # noqa: N802 + def create_deembedding_sparameter_table_array(self, port, table_name, frequencies, sparameter_table, number_of_ports, sparameter_orientation): # noqa: N802 vi_ctype = _visatype.ViSession(self._vi) # case S110 port_ctype = ctypes.create_string_buffer(port.encode(self._encoding)) # case C020 table_name_ctype = ctypes.create_string_buffer(table_name.encode(self._encoding)) # case C020 frequencies_ctype = _get_ctypes_pointer_for_buffer(value=frequencies) # case B510 frequencies_size_ctype = _visatype.ViInt32(0 if frequencies is None else len(frequencies)) # case S160 sparameter_table_ctype = _get_ctypes_pointer_for_buffer(value=sparameter_table, library_type=_complextype.NIComplexNumber) # case B510 - sparameter_table_size_ctype = _visatype.ViInt32(sparameter_table_size) # case S150 + sparameter_table_size_ctype = _visatype.ViInt32(0 if sparameter_table is None else len(sparameter_table)) # case S160 number_of_ports_ctype = _visatype.ViInt32(number_of_ports) # case S150 sparameter_orientation_ctype = _visatype.ViInt32(sparameter_orientation.value) # case S130 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) diff --git a/generated/nirfsg/nirfsg/session.py b/generated/nirfsg/nirfsg/session.py index c6eaa90c8..986e91971 100644 --- a/generated/nirfsg/nirfsg/session.py +++ b/generated/nirfsg/nirfsg/session.py @@ -6167,7 +6167,7 @@ def configure_software_start_trigger(self): self._interpreter.configure_software_start_trigger() @ivi_synchronized - def _create_deembedding_sparameter_table_array(self, port, table_name, frequencies, sparameter_table, sparameter_table_size, number_of_ports, sparameter_orientation): + def _create_deembedding_sparameter_table_array(self, port, table_name, frequencies, sparameter_table, number_of_ports, sparameter_orientation): r'''_create_deembedding_sparameter_table_array Creates an s-parameter de-embedding table for the port from the input data. @@ -6225,7 +6225,7 @@ def _create_deembedding_sparameter_table_array(self, port, table_name, frequenci raise TypeError('sparameter_table must be numpy.ndarray of dtype=complex128, is ' + str(sparameter_table.dtype)) if sparameter_table.ndim != 3: raise TypeError('sparameter_table must be numpy.ndarray of dimension=3, is ' + str(sparameter_table.ndim)) - self._interpreter.create_deembedding_sparameter_table_array(port, table_name, frequencies, sparameter_table, sparameter_table_size, number_of_ports, sparameter_orientation) + self._interpreter.create_deembedding_sparameter_table_array(port, table_name, frequencies, sparameter_table, number_of_ports, sparameter_orientation) @ivi_synchronized def create_deembedding_sparameter_table_s2p_file(self, port, table_name, s2p_file_path, sparameter_orientation): @@ -6345,13 +6345,15 @@ def create_deembedding_sparameter_table_array(self, port, table_name, frequencie +-----------------------------------------+----------------+-----------------------------------------------------+ ''' + import numpy as np + if (str(type(sparameter_table)).find("'numpy.ndarray'") != -1) or (str(type(frequencies)).find("'numpy.ndarray'") != -1): if sparameter_table.ndim == 3: if frequencies.size == sparameter_table.shape[0]: if sparameter_table.shape[1] == sparameter_table.shape[2]: number_of_ports = sparameter_table.shape[1] - sparameter_table_size = sparameter_table.size - return self._create_deembedding_sparameter_table_array(port, table_name, frequencies, sparameter_table, sparameter_table_size, number_of_ports, sparameter_orientation) + flattened_sparameter_table = np.ascontiguousarray(sparameter_table).reshape(-1) + return self._interpreter.create_deembedding_sparameter_table_array(port, table_name, frequencies, flattened_sparameter_table, number_of_ports, sparameter_orientation) else: raise ValueError("Row and column count of sparameter table should be equal. Table row count is {} and column count is {}.".format(sparameter_table.shape[1], sparameter_table.shape[2])) else: diff --git a/src/nirfsg/metadata/functions.py b/src/nirfsg/metadata/functions.py index 64416372f..c4ab0a57f 100644 --- a/src/nirfsg/metadata/functions.py +++ b/src/nirfsg/metadata/functions.py @@ -1055,6 +1055,10 @@ }, 'name': 'sparameterTable', 'numpy': True, + 'size': { + 'mechanism': 'len', + 'value': 'sparameterTableSize' + }, 'type': 'NIComplexNumber[]', 'use_in_python_api': True }, diff --git a/src/nirfsg/templates/session.py/create_deembedding_sparameter_table_array.py.mako b/src/nirfsg/templates/session.py/create_deembedding_sparameter_table_array.py.mako index b1dc85001..f5cb80a72 100644 --- a/src/nirfsg/templates/session.py/create_deembedding_sparameter_table_array.py.mako +++ b/src/nirfsg/templates/session.py/create_deembedding_sparameter_table_array.py.mako @@ -8,13 +8,15 @@ ${helper.get_function_docstring(f, False, config, indent=8)} ''' + import numpy as np + if (str(type(sparameter_table)).find("'numpy.ndarray'") != -1) or (str(type(frequencies)).find("'numpy.ndarray'") != -1): if sparameter_table.ndim == 3: if frequencies.size == sparameter_table.shape[0]: if sparameter_table.shape[1] == sparameter_table.shape[2]: number_of_ports = sparameter_table.shape[1] - sparameter_table_size = sparameter_table.size - return self._create_deembedding_sparameter_table_array(port, table_name, frequencies, sparameter_table, sparameter_table_size, number_of_ports, sparameter_orientation) + flattened_sparameter_table = np.ascontiguousarray(sparameter_table).reshape(-1) + return self._interpreter.create_deembedding_sparameter_table_array(port, table_name, frequencies, flattened_sparameter_table, number_of_ports, sparameter_orientation) else: raise ValueError("Row and column count of sparameter table should be equal. Table row count is {} and column count is {}.".format(sparameter_table.shape[1], sparameter_table.shape[2])) else: From d972e3eb81e0875af108e83e7efafcd68882ed65 Mon Sep 17 00:00:00 2001 From: Rahul R Date: Wed, 25 Feb 2026 09:06:44 +0000 Subject: [PATCH 2/3] Things to codegen after size issue is merged --- generated/nirfsg/nirfsg/_library_interpreter.py | 2 +- generated/nirfsg/nirfsg/session.py | 5 +---- .../create_deembedding_sparameter_table_array.py.mako | 5 +---- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/generated/nirfsg/nirfsg/_library_interpreter.py b/generated/nirfsg/nirfsg/_library_interpreter.py index 30d7db3bd..f79767d06 100644 --- a/generated/nirfsg/nirfsg/_library_interpreter.py +++ b/generated/nirfsg/nirfsg/_library_interpreter.py @@ -247,7 +247,7 @@ def create_deembedding_sparameter_table_array(self, port, table_name, frequencie frequencies_ctype = _get_ctypes_pointer_for_buffer(value=frequencies) # case B510 frequencies_size_ctype = _visatype.ViInt32(0 if frequencies is None else len(frequencies)) # case S160 sparameter_table_ctype = _get_ctypes_pointer_for_buffer(value=sparameter_table, library_type=_complextype.NIComplexNumber) # case B510 - sparameter_table_size_ctype = _visatype.ViInt32(0 if sparameter_table is None else len(sparameter_table)) # case S160 + sparameter_table_size_ctype = _visatype.ViInt32(0 if sparameter_table is None else sparameter_table.size) # case S160 number_of_ports_ctype = _visatype.ViInt32(number_of_ports) # case S150 sparameter_orientation_ctype = _visatype.ViInt32(sparameter_orientation.value) # case S130 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) diff --git a/generated/nirfsg/nirfsg/session.py b/generated/nirfsg/nirfsg/session.py index 986e91971..2a56c8785 100644 --- a/generated/nirfsg/nirfsg/session.py +++ b/generated/nirfsg/nirfsg/session.py @@ -6345,15 +6345,12 @@ def create_deembedding_sparameter_table_array(self, port, table_name, frequencie +-----------------------------------------+----------------+-----------------------------------------------------+ ''' - import numpy as np - if (str(type(sparameter_table)).find("'numpy.ndarray'") != -1) or (str(type(frequencies)).find("'numpy.ndarray'") != -1): if sparameter_table.ndim == 3: if frequencies.size == sparameter_table.shape[0]: if sparameter_table.shape[1] == sparameter_table.shape[2]: number_of_ports = sparameter_table.shape[1] - flattened_sparameter_table = np.ascontiguousarray(sparameter_table).reshape(-1) - return self._interpreter.create_deembedding_sparameter_table_array(port, table_name, frequencies, flattened_sparameter_table, number_of_ports, sparameter_orientation) + return self._create_deembedding_sparameter_table_array(port, table_name, frequencies, sparameter_table, number_of_ports, sparameter_orientation) else: raise ValueError("Row and column count of sparameter table should be equal. Table row count is {} and column count is {}.".format(sparameter_table.shape[1], sparameter_table.shape[2])) else: diff --git a/src/nirfsg/templates/session.py/create_deembedding_sparameter_table_array.py.mako b/src/nirfsg/templates/session.py/create_deembedding_sparameter_table_array.py.mako index f5cb80a72..c062ed3b2 100644 --- a/src/nirfsg/templates/session.py/create_deembedding_sparameter_table_array.py.mako +++ b/src/nirfsg/templates/session.py/create_deembedding_sparameter_table_array.py.mako @@ -8,15 +8,12 @@ ${helper.get_function_docstring(f, False, config, indent=8)} ''' - import numpy as np - if (str(type(sparameter_table)).find("'numpy.ndarray'") != -1) or (str(type(frequencies)).find("'numpy.ndarray'") != -1): if sparameter_table.ndim == 3: if frequencies.size == sparameter_table.shape[0]: if sparameter_table.shape[1] == sparameter_table.shape[2]: number_of_ports = sparameter_table.shape[1] - flattened_sparameter_table = np.ascontiguousarray(sparameter_table).reshape(-1) - return self._interpreter.create_deembedding_sparameter_table_array(port, table_name, frequencies, flattened_sparameter_table, number_of_ports, sparameter_orientation) + return self._create_deembedding_sparameter_table_array(port, table_name, frequencies, sparameter_table, number_of_ports, sparameter_orientation) else: raise ValueError("Row and column count of sparameter table should be equal. Table row count is {} and column count is {}.".format(sparameter_table.shape[1], sparameter_table.shape[2])) else: From ed2fc7fae6632d1f50dd7235ef31b7bb8541cc54 Mon Sep 17 00:00:00 2001 From: Rahul R Date: Fri, 6 Mar 2026 11:30:40 +0000 Subject: [PATCH 3/3] Updated file changes --- generated/nirfsg/nirfsg/_library_interpreter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generated/nirfsg/nirfsg/_library_interpreter.py b/generated/nirfsg/nirfsg/_library_interpreter.py index f79767d06..4052587cb 100644 --- a/generated/nirfsg/nirfsg/_library_interpreter.py +++ b/generated/nirfsg/nirfsg/_library_interpreter.py @@ -247,7 +247,7 @@ def create_deembedding_sparameter_table_array(self, port, table_name, frequencie frequencies_ctype = _get_ctypes_pointer_for_buffer(value=frequencies) # case B510 frequencies_size_ctype = _visatype.ViInt32(0 if frequencies is None else len(frequencies)) # case S160 sparameter_table_ctype = _get_ctypes_pointer_for_buffer(value=sparameter_table, library_type=_complextype.NIComplexNumber) # case B510 - sparameter_table_size_ctype = _visatype.ViInt32(0 if sparameter_table is None else sparameter_table.size) # case S160 + sparameter_table_size_ctype = _visatype.ViInt32(0 if sparameter_table is None else sparameter_table.size) # case S161 number_of_ports_ctype = _visatype.ViInt32(number_of_ports) # case S150 sparameter_orientation_ctype = _visatype.ViInt32(sparameter_orientation.value) # case S130 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)