From 442117a08a029469c0ae45f1ea65b7a7d179efcd Mon Sep 17 00:00:00 2001 From: mohit-emerson Date: Fri, 23 Oct 2026 11:44:39 +0000 Subject: [PATCH 1/6] deembedding changes --- docs/nirfsa/class.rst | 132 ++++++++++++---- docs/nirfsa/enums.rst | 4 +- .../nirfsa/nirfsa/_grpc_stub_interpreter.py | 12 ++ generated/nirfsa/nirfsa/_library.py | 18 +++ .../nirfsa/nirfsa/_library_interpreter.py | 14 ++ generated/nirfsa/nirfsa/enums.py | 4 +- generated/nirfsa/nirfsa/session.py | 146 +++++++++++++----- .../nirfsa/nirfsa/unit_tests/_mock_helper.py | 18 +++ src/nirfsa/metadata/attributes.py | 8 +- src/nirfsa/metadata/enums.py | 4 +- src/nirfsa/metadata/functions.py | 123 ++++++++++++--- 11 files changed, 382 insertions(+), 101 deletions(-) diff --git a/docs/nirfsa/class.rst b/docs/nirfsa/class.rst index f2b59ed34..a8ecbcf1c 100644 --- a/docs/nirfsa/class.rst +++ b/docs/nirfsa/class.rst @@ -302,12 +302,14 @@ configure_deembedding_table_interpolation_linear .. py:method:: configure_deembedding_table_interpolation_linear(port, table_name, format) - Selects the linear interpolation method. + Selects the linear interpolation method for the specified port or calibration plane. If the carrier frequency does not match a row in the de-embedding table, NI-RFSA performs a linear interpolation based on the entries in the de-embedding table to determine the parameters to use for de-embedding. **Supported Devices**: PXIe-5830/5831/5832/5840/5841/5842/5860 + Multiple calibration planes are supported only on PXIe-5840/5841/5842/5860. + @@ -315,7 +317,7 @@ configure_deembedding_table_interpolation_linear :param port: - Specifies the name of the port. The only valid value for the PXIe-5840/5841/5842/5860 is "" (empty string). + Specifies the port or calibration plane using the format calplane::/port::. Devices that donot have multiple ports, use only calibration plane, for example: calplane::. If no calibration plane name is specified, the default calibration plane instance is used. The default value is (empty string). @@ -324,7 +326,7 @@ configure_deembedding_table_interpolation_linear :param table_name: - Specifies the name of the table. + Specifies the name of the de-embedding table. @@ -355,12 +357,14 @@ configure_deembedding_table_interpolation_nearest .. py:method:: configure_deembedding_table_interpolation_nearest(port, table_name) - Selects the nearest interpolation method. + Selects the nearest interpolation method for the specified port or calibration plane. NI-RFSA uses the parameters of the table nearest to the carrier frequency for de-embedding. **Supported Devices**: PXIe-5830/5831/5832/5840/5841/5842/5860 + Multiple calibration planes are supported only on PXIe-5840/5841/5842/5860. + @@ -368,7 +372,7 @@ configure_deembedding_table_interpolation_nearest :param port: - Specifies the name of the port. The only valid value for the PXIe-5840/5841/5842/5860 is "" (empty string). + Specifies the port or calibration plane using the format calplane::/port::. Devices that donot have multiple ports, use only calibration plane, for example: calplane::. If no calibration plane name is specified, the default calibration plane instance is used. The default value is (empty string). @@ -377,7 +381,7 @@ configure_deembedding_table_interpolation_nearest :param table_name: - Specifies the name of the table. + Specifies the name of the de-embedding table. @@ -391,12 +395,14 @@ configure_deembedding_table_interpolation_spline .. py:method:: configure_deembedding_table_interpolation_spline(port, table_name) - Selects the spline interpolation method. + Selects the spline interpolation method for the specified port or calibration plane. If the carrier frequency does not match a row in the de-embedding table, NI-RFSA performs a spline interpolation based on the entries in the de-embedding table to determine the parameters to use for de-embedding. **Supported Devices**: PXIe-5830/5831/5832/5840/5841/5842/5860 + Multiple calibration planes are supported only on PXIe-5840/5841/5842/5860. + @@ -404,7 +410,7 @@ configure_deembedding_table_interpolation_spline :param port: - Specifies the name of the port. The only valid value for the PXIe-5840/5841/5842/5860 is "" (empty string). + Specifies the port or calibration plane using the format calplane::/port::. Devices that donot have multiple ports, use only calibration plane, for example: calplane::. If no calibration plane name is specified, the default calibration plane instance is used. The default value is (empty string). @@ -413,7 +419,7 @@ configure_deembedding_table_interpolation_spline :param table_name: - Specifies the name of the table. + Specifies the name of the de-embedding table. @@ -1066,12 +1072,22 @@ create_deembedding_sparameter_table_s2p_file .. py:method:: create_deembedding_sparameter_table_s2p_file(port, table_name, s2p_file_path, sparameter_orientation) - Creates an S-parameter de-embedding table for the port based on the specified S2P file. + Creates an S-parameter de-embedding table for the specified port or calibration plane based on the specified S2P file. - If you only create one table for a port, NI-RFSA automatically selects that table to de-embed the measurement. + A calibration plane can be specified using the format calplane::/port::. + + The calibration plane is created within the context of the specified port. If a calibration plane name is not provided, NI-RFSA uses the default calibration plane for the specified port. + + For devices that do not have multiple ports, use only the calibration plane portion of the selector, for example calplane::. + + Creating the first de-embedding table for a calibration plane on a port enables that calibration plane by default. + + If only one de-embedding table exists for a port or calibration plane, NI-RFSA automatically selects that table when performing de-embedding. **Supported Devices**: PXIe-5830/5831/5832/5840/5841/5842/5860 + Multiple calibration planes are supported only on PXIe-5840/5841/5842/5860. + **Related Topics** `De-embedding Overview `_ @@ -1085,7 +1101,7 @@ create_deembedding_sparameter_table_s2p_file :param port: - Specifies the name of the port. The only valid value for the PXIe-5840/5841/5842/5860 is "" (empty string). + Accepts either a port name or a calibration plane selector. Use calplane::/port:: to target a calibration plane for that port. For PXIe-5840/5841/5842/5860 devices, the supported values are an empty string or calplane::. @@ -1094,7 +1110,7 @@ create_deembedding_sparameter_table_s2p_file :param table_name: - Specifies the name of the table. The name must be unique for a given port, but not across ports. If you use the same name as an existing table, the table is replaced. + Specifies the name of the de-embedding table. If a table with the same name already exists in the calibration plane for the specified port, the existing table is replaced. @@ -1103,7 +1119,7 @@ create_deembedding_sparameter_table_s2p_file :param s2p_file_path: - Specifies the path to the S2P file that contains de-embedding information for the specified port. + Specifies the path to the S2P file that contains de-embedding information for the specified port or calibration plane. @@ -1132,7 +1148,7 @@ delete_all_deembedding_tables .. py:method:: delete_all_deembedding_tables() - Deletes all configured de-embedding tables for the session. + Deletes all de-embedding tables configured for the current session. **Supported Devices**: PXIe-5830/5831/5832/5840/5841/5842/5860 @@ -1147,10 +1163,12 @@ delete_deembedding_table .. py:method:: delete_deembedding_table(port, table_name) - Deletes the selected de-embedding table for a given port. + Deletes the selected de-embedding table for the specified port or calibration plane. **Supported Devices**: PXIe-5830/5831/5832/5840/5841/5842/5860 + Multiple calibration planes are supported only on PXIe-5840/5841/5842/5860. + @@ -1158,7 +1176,7 @@ delete_deembedding_table :param port: - Specifies the name of the port. The only valid value for the PXIe-5840/5841/5842/5860 is "" (empty string). + Accepts either a port name or a calibration plane selector. Use calplane::/port:: to target a calibration plane for that port. For PXIe-5840/5841/5842/5860 devices, the supported values are an empty string or calplane::. @@ -1167,7 +1185,7 @@ delete_deembedding_table :param table_name: - Specifies the name of the table. + Specifies the name of the de-embedding table. @@ -1195,6 +1213,31 @@ disable_advance_trigger +disable_calibration_plane +------------------------- + + .. py:currentmodule:: nirfsa.Session + + .. py:method:: disable_calibration_plane() + + Disables the calibration plane for the specified channel for de-embedding. + + **Supported Devices**: PXIe-5830/5831/5832/5840/5841/5842/5860 + + + + + .. tip:: This method can be called on specific channels within your :py:class:`nirfsa.Session` instance. + Use Python index notation on the repeated capabilities container channels to specify a subset, + and then call this method on the result. + + Example: :py:meth:`my_session.channels[ ... ].disable_calibration_plane` + + To call the method on all channels, you can call it directly on the :py:class:`nirfsa.Session`. + + Example: :py:meth:`my_session.disable_calibration_plane` + + disable_ref_trigger ------------------- @@ -1237,6 +1280,31 @@ disable_start_trigger +enable_calibration_plane +------------------------ + + .. py:currentmodule:: nirfsa.Session + + .. py:method:: enable_calibration_plane() + + Enables the calibration plane for the specified channel for de-embedding. + + **Supported Devices**: PXIe-5830/5831/5832/5840/5841/5842/5860 + + + + + .. tip:: This method can be called on specific channels within your :py:class:`nirfsa.Session` instance. + Use Python index notation on the repeated capabilities container channels to specify a subset, + and then call this method on the result. + + Example: :py:meth:`my_session.channels[ ... ].enable_calibration_plane` + + To call the method on all channels, you can call it directly on the :py:class:`nirfsa.Session`. + + Example: :py:meth:`my_session.enable_calibration_plane` + + enable_session_access --------------------- @@ -3246,7 +3314,7 @@ deembedding_compensation_gain .. py:attribute:: deembedding_compensation_gain - Returns the de-embedding gain applied to compensate for the mismatch on the specified port. Use the Active Channel property to specify the name of the port to configure for de-embedding. + Returns the de-embedding gain applied to compensate for the effects of the external network on the selected port. Use the Active Channel property to specify the name of the port to configure for de-embedding. If de-embedding is enabled, NI-RFSA uses the returned compensation gain to remove the effects of the external network between the instrument and the DUT. @@ -3275,9 +3343,9 @@ deembedding_selected_table .. py:attribute:: deembedding_selected_table - Selects the de-embedding table to apply to the measurements on the specified port. + Selects the de-embedding table to apply to the measurements on the specified port or calibration plane. - To use this property, you must use the channelName parameter of the :py:meth:`nirfsa.Session._set_attribute_vi_string` method to specify the name of the port to configure for de-embedding. + To use this property, you must use the channelName parameter of the :py:meth:`nirfsa.Session._set_attribute_vi_string` method to specify the port or calibration plane selector to configure for de-embedding. If de-embedding is enabled, NI-RFSA uses the specified table to remove the effects of the external network between the instrument and the DUT. @@ -3338,17 +3406,17 @@ deembedding_type **Defined Values**: - +-------------------------------------------------------+-------------------------------------------------------------------------+ - | Name | Description | - +=======================================================+=========================================================================+ - | :py:data:`~nirfsa.DeembeddingType.NONE` | De-embedding is not applied to the measurement. | - +-------------------------------------------------------+-------------------------------------------------------------------------+ - | :py:data:`~nirfsa.DeembeddingType.SCALAR` | De-embeds the measurement using only the gain term. | - +-------------------------------------------------------+-------------------------------------------------------------------------+ - | :py:data:`~nirfsa.DeembeddingType.VECTOR` | De-embeds the measurement using the gain term and the reflection term. | - +-------------------------------------------------------+-------------------------------------------------------------------------+ - | :py:data:`~nirfsa.DeembeddingType.AMPLITUDE_FLATNESS` | De-embeds the measurement using wideband amplitude flatness correction. | - +-------------------------------------------------------+-------------------------------------------------------------------------+ + +-------------------------------------------------------+-------------------------------------------------------------------------------------------------+ + | Name | Description | + +=======================================================+=================================================================================================+ + | :py:data:`~nirfsa.DeembeddingType.NONE` | De-embedding is not applied to the measurement. | + +-------------------------------------------------------+-------------------------------------------------------------------------------------------------+ + | :py:data:`~nirfsa.DeembeddingType.SCALAR` | De-embeds the measurement using only the gain term at center frequency. | + +-------------------------------------------------------+-------------------------------------------------------------------------------------------------+ + | :py:data:`~nirfsa.DeembeddingType.VECTOR` | De-embeds the measurement using the gain term and the reflection term. | + +-------------------------------------------------------+-------------------------------------------------------------------------------------------------+ + | :py:data:`~nirfsa.DeembeddingType.AMPLITUDE_FLATNESS` | De-embeds the measurement using the gain term across the instantaneous bandwidth of the device. | + +-------------------------------------------------------+-------------------------------------------------------------------------------------------------+ .. tip:: This property can be set/get on specific ports within your :py:class:`nirfsa.Session` instance. diff --git a/docs/nirfsa/enums.rst b/docs/nirfsa/enums.rst index 830ea32c0..318280cc7 100644 --- a/docs/nirfsa/enums.rst +++ b/docs/nirfsa/enums.rst @@ -375,7 +375,7 @@ DeembeddingType - De-embeds the measurement using only the gain term. + De-embeds the measurement using only the gain term at center frequency. @@ -395,7 +395,7 @@ DeembeddingType - De-embeds the measurement using wideband amplitude flatness correction. + De-embeds the measurement using the gain term across the instantaneous bandwidth of the device. diff --git a/generated/nirfsa/nirfsa/_grpc_stub_interpreter.py b/generated/nirfsa/nirfsa/_grpc_stub_interpreter.py index e23c12a58..f6164be09 100644 --- a/generated/nirfsa/nirfsa/_grpc_stub_interpreter.py +++ b/generated/nirfsa/nirfsa/_grpc_stub_interpreter.py @@ -226,6 +226,12 @@ def disable_advance_trigger(self): # noqa: N802 grpc_types.DisableAdvanceTriggerRequest(vi=self._vi), ) + def disable_calibration_plane(self, channel_name): # noqa: N802 + self._invoke( + self._client.DisableCalibrationPlane, + grpc_types.DisableCalibrationPlaneRequest(vi=self._vi, channel_name=channel_name), + ) + def disable_ref_trigger(self): # noqa: N802 self._invoke( self._client.DisableRefTrigger, @@ -238,6 +244,12 @@ def disable_start_trigger(self): # noqa: N802 grpc_types.DisableStartTriggerRequest(vi=self._vi), ) + def enable_calibration_plane(self, channel_name): # noqa: N802 + self._invoke( + self._client.EnableCalibrationPlane, + grpc_types.EnableCalibrationPlaneRequest(vi=self._vi, channel_name=channel_name), + ) + def enable_session_access(self, enable): # noqa: N802 self._invoke( self._client.EnableSessionAccess, diff --git a/generated/nirfsa/nirfsa/_library.py b/generated/nirfsa/nirfsa/_library.py index c5a2bebf1..ee7365820 100644 --- a/generated/nirfsa/nirfsa/_library.py +++ b/generated/nirfsa/nirfsa/_library.py @@ -49,8 +49,10 @@ def __init__(self, ctypes_library): self.niRFSA_DeleteAllDeembeddingTables_cfunc = None self.niRFSA_DeleteDeembeddingTable_cfunc = None self.niRFSA_DisableAdvanceTrigger_cfunc = None + self.niRFSA_DisableCalibrationPlane_cfunc = None self.niRFSA_DisableRefTrigger_cfunc = None self.niRFSA_DisableStartTrigger_cfunc = None + self.niRFSA_EnableCalibrationPlane_cfunc = None self.niRFSA_EnableSessionAccess_cfunc = None self.niRFSA_ErrorMessage_cfunc = None self.niRFSA_FetchIQMultiRecordComplexF32_cfunc = None @@ -292,6 +294,14 @@ def niRFSA_DisableAdvanceTrigger(self, vi): # noqa: N802 self.niRFSA_DisableAdvanceTrigger_cfunc.restype = ViStatus # noqa: F405 return self.niRFSA_DisableAdvanceTrigger_cfunc(vi) + def niRFSA_DisableCalibrationPlane(self, vi, channel_name): # noqa: N802 + with self._func_lock: + if self.niRFSA_DisableCalibrationPlane_cfunc is None: + self.niRFSA_DisableCalibrationPlane_cfunc = self._get_library_function('niRFSA_DisableCalibrationPlane') + self.niRFSA_DisableCalibrationPlane_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar)] # noqa: F405 + self.niRFSA_DisableCalibrationPlane_cfunc.restype = ViStatus # noqa: F405 + return self.niRFSA_DisableCalibrationPlane_cfunc(vi, channel_name) + def niRFSA_DisableRefTrigger(self, vi): # noqa: N802 with self._func_lock: if self.niRFSA_DisableRefTrigger_cfunc is None: @@ -308,6 +318,14 @@ def niRFSA_DisableStartTrigger(self, vi): # noqa: N802 self.niRFSA_DisableStartTrigger_cfunc.restype = ViStatus # noqa: F405 return self.niRFSA_DisableStartTrigger_cfunc(vi) + def niRFSA_EnableCalibrationPlane(self, vi, channel_name): # noqa: N802 + with self._func_lock: + if self.niRFSA_EnableCalibrationPlane_cfunc is None: + self.niRFSA_EnableCalibrationPlane_cfunc = self._get_library_function('niRFSA_EnableCalibrationPlane') + self.niRFSA_EnableCalibrationPlane_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar)] # noqa: F405 + self.niRFSA_EnableCalibrationPlane_cfunc.restype = ViStatus # noqa: F405 + return self.niRFSA_EnableCalibrationPlane_cfunc(vi, channel_name) + def niRFSA_EnableSessionAccess(self, vi, enable): # noqa: N802 with self._func_lock: if self.niRFSA_EnableSessionAccess_cfunc is None: diff --git a/generated/nirfsa/nirfsa/_library_interpreter.py b/generated/nirfsa/nirfsa/_library_interpreter.py index 6918f1533..5f2af5255 100644 --- a/generated/nirfsa/nirfsa/_library_interpreter.py +++ b/generated/nirfsa/nirfsa/_library_interpreter.py @@ -278,6 +278,13 @@ def disable_advance_trigger(self): # noqa: N802 errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return + def disable_calibration_plane(self, channel_name): # noqa: N802 + vi_ctype = _visatype.ViSession(self._vi) # case S110 + channel_name_ctype = ctypes.create_string_buffer(channel_name.encode(self._encoding)) # case C010 + error_code = self._library.niRFSA_DisableCalibrationPlane(vi_ctype, channel_name_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + return + def disable_ref_trigger(self): # noqa: N802 vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niRFSA_DisableRefTrigger(vi_ctype) @@ -290,6 +297,13 @@ def disable_start_trigger(self): # noqa: N802 errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return + def enable_calibration_plane(self, channel_name): # noqa: N802 + vi_ctype = _visatype.ViSession(self._vi) # case S110 + channel_name_ctype = ctypes.create_string_buffer(channel_name.encode(self._encoding)) # case C010 + error_code = self._library.niRFSA_EnableCalibrationPlane(vi_ctype, channel_name_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + return + def enable_session_access(self, enable): # noqa: N802 vi_ctype = _visatype.ViSession(self._vi) # case S110 enable_ctype = _visatype.ViBoolean(enable) # case S150 diff --git a/generated/nirfsa/nirfsa/enums.py b/generated/nirfsa/nirfsa/enums.py index d16310aa5..27c8f83d7 100644 --- a/generated/nirfsa/nirfsa/enums.py +++ b/generated/nirfsa/nirfsa/enums.py @@ -162,7 +162,7 @@ class DeembeddingType(Enum): ''' SCALAR = 3901 r''' - De-embeds the measurement using only the gain term. + De-embeds the measurement using only the gain term at center frequency. ''' VECTOR = 3902 r''' @@ -170,7 +170,7 @@ class DeembeddingType(Enum): ''' AMPLITUDE_FLATNESS = 3903 r''' - De-embeds the measurement using wideband amplitude flatness correction. + De-embeds the measurement using the gain term across the instantaneous bandwidth of the device. ''' diff --git a/generated/nirfsa/nirfsa/session.py b/generated/nirfsa/nirfsa/session.py index 4ca713878..fd675cb8c 100644 --- a/generated/nirfsa/nirfsa/session.py +++ b/generated/nirfsa/nirfsa/session.py @@ -440,7 +440,7 @@ class _SessionBase(object): deembedding_compensation_gain = _attributes.AttributeViReal64(1150325) '''Type: float - Returns the de-embedding gain applied to compensate for the mismatch on the specified port. Use the Active Channel property to specify the name of the port to configure for de-embedding. + Returns the de-embedding gain applied to compensate for the effects of the external network on the selected port. Use the Active Channel property to specify the name of the port to configure for de-embedding. If de-embedding is enabled, NI-RFSA uses the returned compensation gain to remove the effects of the external network between the instrument and the DUT. @@ -449,9 +449,9 @@ class _SessionBase(object): deembedding_selected_table = _attributes.AttributeViString(1150308) '''Type: str - Selects the de-embedding table to apply to the measurements on the specified port. + Selects the de-embedding table to apply to the measurements on the specified port or calibration plane. - To use this property, you must use the channelName parameter of the _set_attribute_vi_string method to specify the name of the port to configure for de-embedding. + To use this property, you must use the channelName parameter of the _set_attribute_vi_string method to specify the port or calibration plane selector to configure for de-embedding. If de-embedding is enabled, NI-RFSA uses the specified table to remove the effects of the external network between the instrument and the DUT. @@ -490,17 +490,17 @@ class _SessionBase(object): **Defined Values**: - +------------------------------------+-------------------------------------------------------------------------+ - | Name | Description | - +====================================+=========================================================================+ - | DeembeddingType.NONE | De-embedding is not applied to the measurement. | - +------------------------------------+-------------------------------------------------------------------------+ - | DeembeddingType.SCALAR | De-embeds the measurement using only the gain term. | - +------------------------------------+-------------------------------------------------------------------------+ - | DeembeddingType.VECTOR | De-embeds the measurement using the gain term and the reflection term. | - +------------------------------------+-------------------------------------------------------------------------+ - | DeembeddingType.AMPLITUDE_FLATNESS | De-embeds the measurement using wideband amplitude flatness correction. | - +------------------------------------+-------------------------------------------------------------------------+ + +------------------------------------+-------------------------------------------------------------------------------------------------+ + | Name | Description | + +====================================+=================================================================================================+ + | DeembeddingType.NONE | De-embedding is not applied to the measurement. | + +------------------------------------+-------------------------------------------------------------------------------------------------+ + | DeembeddingType.SCALAR | De-embeds the measurement using only the gain term at center frequency. | + +------------------------------------+-------------------------------------------------------------------------------------------------+ + | DeembeddingType.VECTOR | De-embeds the measurement using the gain term and the reflection term. | + +------------------------------------+-------------------------------------------------------------------------------------------------+ + | DeembeddingType.AMPLITUDE_FLATNESS | De-embeds the measurement using the gain term across the instantaneous bandwidth of the device. | + +------------------------------------+-------------------------------------------------------------------------------------------------+ Tip: This property can be set/get on specific ports within your :py:class:`nirfsa.Session` instance. @@ -5026,6 +5026,48 @@ def _configure_spectrum_frequency_start_stop(self, start_frequency, stop_frequen ''' self._interpreter.configure_spectrum_frequency_start_stop(self._repeated_capability, start_frequency, stop_frequency) + @ivi_synchronized + def disable_calibration_plane(self): + r'''disable_calibration_plane + + Disables the calibration plane for the specified channel for de-embedding. + + **Supported Devices**: PXIe-5830/5831/5832/5840/5841/5842/5860 + + Tip: + This method can be called on specific channels within your :py:class:`nirfsa.Session` instance. + Use Python index notation on the repeated capabilities container channels to specify a subset, + and then call this method on the result. + + Example: :py:meth:`my_session.channels[ ... ].disable_calibration_plane` + + To call the method on all channels, you can call it directly on the :py:class:`nirfsa.Session`. + + Example: :py:meth:`my_session.disable_calibration_plane` + ''' + self._interpreter.disable_calibration_plane(self._repeated_capability) + + @ivi_synchronized + def enable_calibration_plane(self): + r'''enable_calibration_plane + + Enables the calibration plane for the specified channel for de-embedding. + + **Supported Devices**: PXIe-5830/5831/5832/5840/5841/5842/5860 + + Tip: + This method can be called on specific channels within your :py:class:`nirfsa.Session` instance. + Use Python index notation on the repeated capabilities container channels to specify a subset, + and then call this method on the result. + + Example: :py:meth:`my_session.channels[ ... ].enable_calibration_plane` + + To call the method on all channels, you can call it directly on the :py:class:`nirfsa.Session`. + + Example: :py:meth:`my_session.enable_calibration_plane` + ''' + self._interpreter.enable_calibration_plane(self._repeated_capability) + def error_message(self, error_code): r'''error_message @@ -6964,16 +7006,18 @@ def commit(self): def configure_deembedding_table_interpolation_linear(self, port, table_name, format): r'''configure_deembedding_table_interpolation_linear - Selects the linear interpolation method. + Selects the linear interpolation method for the specified port or calibration plane. If the carrier frequency does not match a row in the de-embedding table, NI-RFSA performs a linear interpolation based on the entries in the de-embedding table to determine the parameters to use for de-embedding. **Supported Devices**: PXIe-5830/5831/5832/5840/5841/5842/5860 + Multiple calibration planes are supported only on PXIe-5840/5841/5842/5860. + Args: - port (str): Specifies the name of the port. The only valid value for the PXIe-5840/5841/5842/5860 is "" (empty string). + port (str): Specifies the port or calibration plane using the format calplane::/port::. Devices that donot have multiple ports, use only calibration plane, for example: calplane::. If no calibration plane name is specified, the default calibration plane instance is used. The default value is (empty string). - table_name (str): Specifies the name of the table. + table_name (str): Specifies the name of the de-embedding table. format (enums.LinearInterpolationFormat): Specifies the format of parameters to interpolate. **Defined Values** : @@ -6996,16 +7040,18 @@ def configure_deembedding_table_interpolation_linear(self, port, table_name, for def configure_deembedding_table_interpolation_nearest(self, port, table_name): r'''configure_deembedding_table_interpolation_nearest - Selects the nearest interpolation method. + Selects the nearest interpolation method for the specified port or calibration plane. NI-RFSA uses the parameters of the table nearest to the carrier frequency for de-embedding. **Supported Devices**: PXIe-5830/5831/5832/5840/5841/5842/5860 + Multiple calibration planes are supported only on PXIe-5840/5841/5842/5860. + Args: - port (str): Specifies the name of the port. The only valid value for the PXIe-5840/5841/5842/5860 is "" (empty string). + port (str): Specifies the port or calibration plane using the format calplane::/port::. Devices that donot have multiple ports, use only calibration plane, for example: calplane::. If no calibration plane name is specified, the default calibration plane instance is used. The default value is (empty string). - table_name (str): Specifies the name of the table. + table_name (str): Specifies the name of the de-embedding table. ''' self._interpreter.configure_deembedding_table_interpolation_nearest(port, table_name) @@ -7014,16 +7060,18 @@ def configure_deembedding_table_interpolation_nearest(self, port, table_name): def configure_deembedding_table_interpolation_spline(self, port, table_name): r'''configure_deembedding_table_interpolation_spline - Selects the spline interpolation method. + Selects the spline interpolation method for the specified port or calibration plane. If the carrier frequency does not match a row in the de-embedding table, NI-RFSA performs a spline interpolation based on the entries in the de-embedding table to determine the parameters to use for de-embedding. **Supported Devices**: PXIe-5830/5831/5832/5840/5841/5842/5860 + Multiple calibration planes are supported only on PXIe-5840/5841/5842/5860. + Args: - port (str): Specifies the name of the port. The only valid value for the PXIe-5840/5841/5842/5860 is "" (empty string). + port (str): Specifies the port or calibration plane using the format calplane::/port::. Devices that donot have multiple ports, use only calibration plane, for example: calplane::. If no calibration plane name is specified, the default calibration plane instance is used. The default value is (empty string). - table_name (str): Specifies the name of the table. + table_name (str): Specifies the name of the de-embedding table. ''' self._interpreter.configure_deembedding_table_interpolation_spline(port, table_name) @@ -7408,20 +7456,32 @@ def configure_software_edge_start_trigger(self): 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. + Creates an S-parameter de-embedding table for the specified port or calibration plane from the input data. - If you only create one table for a port, NI-RFSA automatically selects that table to de-embed the measurement. + A calibration plane can be specified using the format calplane::/port::. - **Supported Devices** : PXIe-5830/5831/5832/5840/5841/5842/5860 + The calibration plane is created within the context of the specified port. If a calibration plane name is not provided, NI-RFSA uses the default calibration plane for the specified port. + + For devices that do not have multiple ports, use only the calibration plane portion of the selector, for example calplane::. + + Creating the first de-embedding table for a calibration plane on a port enables that calibration plane by default. + + If only one de-embedding table exists for a port or calibration plane, NI-RFSA automatically selects that table when performing de-embedding. + + **Supported Devices**: PXIe-5830/5831/5832/5840/5841/5842/5860 + + Multiple calibration planes are supported only on PXIe-5840/5841/5842/5860. **Related Topics** `De-embedding Overview `_ + `S-parameters `_ + Args: - port (str): Specifies the name of the port. The only valid value for the PXIe-5840/5841/5842/5860 is "" (empty string). + port (str): Accepts either a port name or a calibration plane selector. Use calplane::/port:: to target a calibration plane for that port. For PXIe-5840/5841/5842/5860 devices, the supported values are an empty string or calplane::. - table_name (str): Specifies the name of the table. The name must be unique for a given port, but not across ports. If you use the same name as an existing table, the table is replaced. + table_name (str): Specifies the name of the de-embedding table. If a table with the same name already exists in the calibration plane for the specified port, the existing table is replaced. frequencies (numpy.array(dtype=numpy.float64)): Specifies the frequencies for the SPARAMETER_TABLE rows. Frequencies must be unique and in ascending order. @@ -7469,12 +7529,22 @@ def _create_deembedding_sparameter_table_array(self, port, table_name, frequenci def create_deembedding_sparameter_table_s2p_file(self, port, table_name, s2p_file_path, sparameter_orientation): r'''create_deembedding_sparameter_table_s2p_file - Creates an S-parameter de-embedding table for the port based on the specified S2P file. + Creates an S-parameter de-embedding table for the specified port or calibration plane based on the specified S2P file. - If you only create one table for a port, NI-RFSA automatically selects that table to de-embed the measurement. + A calibration plane can be specified using the format calplane::/port::. + + The calibration plane is created within the context of the specified port. If a calibration plane name is not provided, NI-RFSA uses the default calibration plane for the specified port. + + For devices that do not have multiple ports, use only the calibration plane portion of the selector, for example calplane::. + + Creating the first de-embedding table for a calibration plane on a port enables that calibration plane by default. + + If only one de-embedding table exists for a port or calibration plane, NI-RFSA automatically selects that table when performing de-embedding. **Supported Devices**: PXIe-5830/5831/5832/5840/5841/5842/5860 + Multiple calibration planes are supported only on PXIe-5840/5841/5842/5860. + **Related Topics** `De-embedding Overview `_ @@ -7482,11 +7552,11 @@ def create_deembedding_sparameter_table_s2p_file(self, port, table_name, s2p_fil `S-parameters `_ Args: - port (str): Specifies the name of the port. The only valid value for the PXIe-5840/5841/5842/5860 is "" (empty string). + port (str): Accepts either a port name or a calibration plane selector. Use calplane::/port:: to target a calibration plane for that port. For PXIe-5840/5841/5842/5860 devices, the supported values are an empty string or calplane::. - table_name (str): Specifies the name of the table. The name must be unique for a given port, but not across ports. If you use the same name as an existing table, the table is replaced. + table_name (str): Specifies the name of the de-embedding table. If a table with the same name already exists in the calibration plane for the specified port, the existing table is replaced. - s2p_file_path (str): Specifies the path to the S2P file that contains de-embedding information for the specified port. + s2p_file_path (str): Specifies the path to the S2P file that contains de-embedding information for the specified port or calibration plane. sparameter_orientation (enums.SparameterOrientation): Specifies the orientation of the data in the S2P file relative to the port on the DUT port. **Defined Values** : @@ -7507,7 +7577,7 @@ def create_deembedding_sparameter_table_s2p_file(self, port, table_name, s2p_fil def delete_all_deembedding_tables(self): r'''delete_all_deembedding_tables - Deletes all configured de-embedding tables for the session. + Deletes all de-embedding tables configured for the current session. **Supported Devices**: PXIe-5830/5831/5832/5840/5841/5842/5860 ''' @@ -7517,14 +7587,16 @@ def delete_all_deembedding_tables(self): def delete_deembedding_table(self, port, table_name): r'''delete_deembedding_table - Deletes the selected de-embedding table for a given port. + Deletes the selected de-embedding table for the specified port or calibration plane. **Supported Devices**: PXIe-5830/5831/5832/5840/5841/5842/5860 + Multiple calibration planes are supported only on PXIe-5840/5841/5842/5860. + Args: - port (str): Specifies the name of the port. The only valid value for the PXIe-5840/5841/5842/5860 is "" (empty string). + port (str): Accepts either a port name or a calibration plane selector. Use calplane::/port:: to target a calibration plane for that port. For PXIe-5840/5841/5842/5860 devices, the supported values are an empty string or calplane::. - table_name (str): Specifies the name of the table. + table_name (str): Specifies the name of the de-embedding table. ''' self._interpreter.delete_deembedding_table(port, table_name) diff --git a/generated/nirfsa/nirfsa/unit_tests/_mock_helper.py b/generated/nirfsa/nirfsa/unit_tests/_mock_helper.py index 579b09b47..874b00f2f 100644 --- a/generated/nirfsa/nirfsa/unit_tests/_mock_helper.py +++ b/generated/nirfsa/nirfsa/unit_tests/_mock_helper.py @@ -63,10 +63,14 @@ def __init__(self): self._defaults['DeleteDeembeddingTable']['return'] = 0 self._defaults['DisableAdvanceTrigger'] = {} self._defaults['DisableAdvanceTrigger']['return'] = 0 + self._defaults['DisableCalibrationPlane'] = {} + self._defaults['DisableCalibrationPlane']['return'] = 0 self._defaults['DisableRefTrigger'] = {} self._defaults['DisableRefTrigger']['return'] = 0 self._defaults['DisableStartTrigger'] = {} self._defaults['DisableStartTrigger']['return'] = 0 + self._defaults['EnableCalibrationPlane'] = {} + self._defaults['EnableCalibrationPlane']['return'] = 0 self._defaults['EnableSessionAccess'] = {} self._defaults['EnableSessionAccess']['return'] = 0 self._defaults['ErrorMessage'] = {} @@ -341,6 +345,11 @@ def niRFSA_DisableAdvanceTrigger(self, vi): # noqa: N802 return self._defaults['DisableAdvanceTrigger']['return'] return self._defaults['DisableAdvanceTrigger']['return'] + def niRFSA_DisableCalibrationPlane(self, vi, channel_name): # noqa: N802 + if self._defaults['DisableCalibrationPlane']['return'] != 0: + return self._defaults['DisableCalibrationPlane']['return'] + return self._defaults['DisableCalibrationPlane']['return'] + def niRFSA_DisableRefTrigger(self, vi): # noqa: N802 if self._defaults['DisableRefTrigger']['return'] != 0: return self._defaults['DisableRefTrigger']['return'] @@ -351,6 +360,11 @@ def niRFSA_DisableStartTrigger(self, vi): # noqa: N802 return self._defaults['DisableStartTrigger']['return'] return self._defaults['DisableStartTrigger']['return'] + def niRFSA_EnableCalibrationPlane(self, vi, channel_name): # noqa: N802 + if self._defaults['EnableCalibrationPlane']['return'] != 0: + return self._defaults['EnableCalibrationPlane']['return'] + return self._defaults['EnableCalibrationPlane']['return'] + def niRFSA_EnableSessionAccess(self, vi, enable): # noqa: N802 if self._defaults['EnableSessionAccess']['return'] != 0: return self._defaults['EnableSessionAccess']['return'] @@ -939,10 +953,14 @@ def set_side_effects_and_return_values(self, mock_library): mock_library.niRFSA_DeleteDeembeddingTable.return_value = 0 mock_library.niRFSA_DisableAdvanceTrigger.side_effect = MockFunctionCallError("niRFSA_DisableAdvanceTrigger") mock_library.niRFSA_DisableAdvanceTrigger.return_value = 0 + mock_library.niRFSA_DisableCalibrationPlane.side_effect = MockFunctionCallError("niRFSA_DisableCalibrationPlane") + mock_library.niRFSA_DisableCalibrationPlane.return_value = 0 mock_library.niRFSA_DisableRefTrigger.side_effect = MockFunctionCallError("niRFSA_DisableRefTrigger") mock_library.niRFSA_DisableRefTrigger.return_value = 0 mock_library.niRFSA_DisableStartTrigger.side_effect = MockFunctionCallError("niRFSA_DisableStartTrigger") mock_library.niRFSA_DisableStartTrigger.return_value = 0 + mock_library.niRFSA_EnableCalibrationPlane.side_effect = MockFunctionCallError("niRFSA_EnableCalibrationPlane") + mock_library.niRFSA_EnableCalibrationPlane.return_value = 0 mock_library.niRFSA_EnableSessionAccess.side_effect = MockFunctionCallError("niRFSA_EnableSessionAccess") mock_library.niRFSA_EnableSessionAccess.return_value = 0 mock_library.niRFSA_ErrorMessage.side_effect = MockFunctionCallError("niRFSA_ErrorMessage") diff --git a/src/nirfsa/metadata/attributes.py b/src/nirfsa/metadata/attributes.py index 4fd281640..952ed8a9e 100644 --- a/src/nirfsa/metadata/attributes.py +++ b/src/nirfsa/metadata/attributes.py @@ -3990,7 +3990,7 @@ ], [ 'NIRFSA_VAL_DEEMBEDDING_TYPE_SCALAR', - 'De-embeds the measurement using only the gain term.' + 'De-embeds the measurement using only the gain term at center frequency.' ], [ 'NIRFSA_VAL_DEEMBEDDING_TYPE_VECTOR', @@ -3998,7 +3998,7 @@ ], [ 'NIRFSA_VAL_DEEMBEDDING_TYPE_AMPLITUDE_FLATNESS', - 'De-embeds the measurement using wideband amplitude flatness correction.' + 'De-embeds the measurement using the gain term across the instantaneous bandwidth of the device.' ] ], 'table_header': [ @@ -4018,7 +4018,7 @@ 'access': 'read-write', 'codegen_method': 'public', 'documentation': { - 'description': 'Selects the de-embedding table to apply to the measurements on the specified port.\n\nTo use this attribute, you must use the channelName parameter of the nirfsa_SetAttributeViString function to specify the name of the port to configure for de-embedding.\n\nIf de-embedding is enabled, NI-RFSA uses the specified table to remove the effects of the external network between the instrument and the DUT.\n\nUse the nirfsa_CreateDeembeddingSparameterTableArray function to create tables.\n\n**Supported Devices**: PXIe-5830/5831/5832/5840/5841/5842/5860' + 'description': 'Selects the de-embedding table to apply to the measurements on the specified port or calibration plane.\n\nTo use this attribute, you must use the channelName parameter of the nirfsa_SetAttributeViString function to specify the port or calibration plane selector to configure for de-embedding.\n\nIf de-embedding is enabled, NI-RFSA uses the specified table to remove the effects of the external network between the instrument and the DUT.\n\nUse the nirfsa_CreateDeembeddingSparameterTableArray function to create tables.\n\n**Supported Devices**: PXIe-5830/5831/5832/5840/5841/5842/5860' }, 'lv_property': 'De-embedding:Selected Table', 'name': 'DEEMBEDDING_SELECTED_TABLE', @@ -4108,7 +4108,7 @@ 'access': 'read only', 'codegen_method': 'public', 'documentation': { - 'description': 'Returns the de-embedding gain applied to compensate for the mismatch on the specified port. Use the Active Channel property to specify the name of the port to configure for de-embedding.\n\nIf de-embedding is enabled, NI-RFSA uses the returned compensation gain to remove the effects of the external network between the instrument and the DUT.\n\n**Supported Devices**: PXIe-5830/5831/5840/5841/5842/5860' + 'description': 'Returns the de-embedding gain applied to compensate for the effects of the external network on the selected port. Use the Active Channel property to specify the name of the port to configure for de-embedding.\n\nIf de-embedding is enabled, NI-RFSA uses the returned compensation gain to remove the effects of the external network between the instrument and the DUT.\n\n**Supported Devices**: PXIe-5830/5831/5840/5841/5842/5860' }, 'lv_property': 'De-embedding:Compensation Gain', 'name': 'DEEMBEDDING_COMPENSATION_GAIN', diff --git a/src/nirfsa/metadata/enums.py b/src/nirfsa/metadata/enums.py index 6cd57f144..8ca801995 100644 --- a/src/nirfsa/metadata/enums.py +++ b/src/nirfsa/metadata/enums.py @@ -273,7 +273,7 @@ }, { 'documentation': { - 'description': 'De-embeds the measurement using only the gain term.' + 'description': 'De-embeds the measurement using only the gain term at center frequency.' }, 'name': 'NIRFSA_VAL_DEEMBEDDING_TYPE_SCALAR', 'value': 3901 @@ -287,7 +287,7 @@ }, { 'documentation': { - 'description': 'De-embeds the measurement using wideband amplitude flatness correction.' + 'description': 'De-embeds the measurement using the gain term across the instantaneous bandwidth of the device.' }, 'name': 'NIRFSA_VAL_DEEMBEDDING_TYPE_AMPLITUDE_FLATNESS', 'value': 3903 diff --git a/src/nirfsa/metadata/functions.py b/src/nirfsa/metadata/functions.py index 198d5089d..929c57711 100644 --- a/src/nirfsa/metadata/functions.py +++ b/src/nirfsa/metadata/functions.py @@ -186,7 +186,7 @@ 'ConfigureDeembeddingTableInterpolationLinear': { 'codegen_method': 'public', 'documentation': { - 'description': '\nSelects the linear interpolation method.\n\nIf the carrier frequency does not match a row in the de-embedding table, NI-RFSA performs a linear interpolation based on the entries in the de-embedding table to determine the parameters to use for de-embedding.\n\n**Supported Devices**: PXIe-5830/5831/5832/5840/5841/5842/5860', + 'description': 'Selects the linear interpolation method for the specified port or calibration plane.\n\nIf the carrier frequency does not match a row in the de-embedding table, NI-RFSA performs a linear interpolation based on the entries in the de-embedding table to determine the parameters to use for de-embedding.\n\n**Supported Devices**: PXIe-5830/5831/5832/5840/5841/5842/5860\n\nMultiple calibration planes are supported only on PXIe-5840/5841/5842/5860.' }, 'included_in_proto': True, 'is_error_handling': False, @@ -212,7 +212,7 @@ { 'direction': 'in', 'documentation': { - 'description': 'Specifies the name of the port. The only valid value for the PXIe-5840/5841/5842/5860 is "" (empty string).', + 'description': 'Specifies the port or calibration plane using the format calplane::/port::. Devices that donot have multiple ports, use only calibration plane, for example: calplane::. If no calibration plane name is specified, the default calibration plane instance is used. The default value is (empty string).' }, 'name': 'port', 'type': 'ViConstString', @@ -222,7 +222,7 @@ { 'direction': 'in', 'documentation': { - 'description': 'Specifies the name of the table.', + 'description': 'Specifies the name of the de-embedding table.' }, 'name': 'tableName', 'type': 'ViConstString', @@ -265,7 +265,7 @@ 'ConfigureDeembeddingTableInterpolationNearest': { 'codegen_method': 'public', 'documentation': { - 'description': '\nSelects the nearest interpolation method.\n\nNI-RFSA uses the parameters of the table nearest to the carrier frequency for de-embedding.\n\n**Supported Devices**: PXIe-5830/5831/5832/5840/5841/5842/5860', + 'description': 'Selects the nearest interpolation method for the specified port or calibration plane.\n\nNI-RFSA uses the parameters of the table nearest to the carrier frequency for de-embedding.\n\n**Supported Devices**: PXIe-5830/5831/5832/5840/5841/5842/5860\n\nMultiple calibration planes are supported only on PXIe-5840/5841/5842/5860.' }, 'included_in_proto': True, 'is_error_handling': False, @@ -291,7 +291,7 @@ { 'direction': 'in', 'documentation': { - 'description': 'Specifies the name of the port. The only valid value for the PXIe-5840/5841/5842/5860 is "" (empty string).', + 'description': 'Specifies the port or calibration plane using the format calplane::/port::. Devices that donot have multiple ports, use only calibration plane, for example: calplane::. If no calibration plane name is specified, the default calibration plane instance is used. The default value is (empty string).' }, 'name': 'port', 'type': 'ViConstString', @@ -301,7 +301,7 @@ { 'direction': 'in', 'documentation': { - 'description': 'Specifies the name of the table.', + 'description': 'Specifies the name of the de-embedding table.' }, 'name': 'tableName', 'type': 'ViConstString', @@ -315,7 +315,7 @@ 'ConfigureDeembeddingTableInterpolationSpline': { 'codegen_method': 'public', 'documentation': { - 'description': '\nSelects the spline interpolation method.\n\nIf the carrier frequency does not match a row in the de-embedding table, NI-RFSA performs a spline interpolation based on the entries in the de-embedding table to determine the parameters to use for de-embedding.\n\n**Supported Devices**: PXIe-5830/5831/5832/5840/5841/5842/5860', + 'description': 'Selects the spline interpolation method for the specified port or calibration plane.\n\nIf the carrier frequency does not match a row in the de-embedding table, NI-RFSA performs a spline interpolation based on the entries in the de-embedding table to determine the parameters to use for de-embedding.\n\n**Supported Devices**: PXIe-5830/5831/5832/5840/5841/5842/5860\n\nMultiple calibration planes are supported only on PXIe-5840/5841/5842/5860.' }, 'included_in_proto': True, 'is_error_handling': False, @@ -341,7 +341,7 @@ { 'direction': 'in', 'documentation': { - 'description': 'Specifies the name of the port. The only valid value for the PXIe-5840/5841/5842/5860 is "" (empty string).', + 'description': 'Specifies the port or calibration plane using the format calplane::/port::. Devices that donot have multiple ports, use only calibration plane, for example: calplane::. If no calibration plane name is specified, the default calibration plane instance is used. The default value is (empty string).' }, 'name': 'port', 'type': 'ViConstString', @@ -351,7 +351,7 @@ { 'direction': 'in', 'documentation': { - 'description': 'Specifies the name of the table.', + 'description': 'Specifies the name of the de-embedding table.' }, 'name': 'tableName', 'type': 'ViConstString', @@ -977,7 +977,7 @@ 'CreateDeembeddingSparameterTableArray': { 'codegen_method': 'private', 'documentation': { - 'description': '\nCreates an s-parameter de-embedding table for the port from the input data.\n\nIf you only create one table for a port, NI-RFSA automatically selects that table to de-embed the measurement.\n\n**Supported Devices** : PXIe-5830/5831/5832/5840/5841/5842/5860\n\n**Related Topics**\n\n`De-embedding Overview `_', + 'description': 'Creates an S-parameter de-embedding table for the specified port or calibration plane from the input data.\n\nA calibration plane can be specified using the format calplane::/port::.\n\nThe calibration plane is created within the context of the specified port. If a calibration plane name is not provided, NI-RFSA uses the default calibration plane for the specified port.\n\nFor devices that do not have multiple ports, use only the calibration plane portion of the selector, for example calplane::.\n\nCreating the first de-embedding table for a calibration plane on a port enables that calibration plane by default.\n\nIf only one de-embedding table exists for a port or calibration plane, NI-RFSA automatically selects that table when performing de-embedding.\n\n**Supported Devices**: PXIe-5830/5831/5832/5840/5841/5842/5860\n\nMultiple calibration planes are supported only on PXIe-5840/5841/5842/5860.\n\n**Related Topics**\n\n`De-embedding Overview `_\n\n`S-parameters `_' }, 'included_in_proto': True, 'method_templates': [ @@ -1002,7 +1002,7 @@ { 'direction': 'in', 'documentation': { - 'description': 'Specifies the name of the port. The only valid value for the PXIe-5840/5841/5842/5860 is "" (empty string).', + 'description': 'Accepts either a port name or a calibration plane selector. Use calplane::/port:: to target a calibration plane for that port. For PXIe-5840/5841/5842/5860 devices, the supported values are an empty string or calplane::.' }, 'name': 'port', 'type': 'ViConstString', @@ -1012,7 +1012,7 @@ { 'direction': 'in', 'documentation': { - 'description': 'Specifies the name of the table. The name must be unique for a given port, but not across ports. If you use the same name as an existing table, the table is replaced.', + 'description': 'Specifies the name of the de-embedding table. If a table with the same name already exists in the calibration plane for the specified port, the existing table is replaced.' }, 'name': 'tableName', 'type': 'ViConstString', @@ -1109,7 +1109,7 @@ 'CreateDeembeddingSparameterTableS2PFile': { 'codegen_method': 'public', 'documentation': { - 'description': '\nCreates an S-parameter de-embedding table for the port based on the specified S2P file.\n\nIf you only create one table for a port, NI-RFSA automatically selects that table to de-embed the measurement.\n\n**Supported Devices**: PXIe-5830/5831/5832/5840/5841/5842/5860\n\n**Related Topics**\n\n`De-embedding Overview `_\n\n`S-parameters `_', + 'description': 'Creates an S-parameter de-embedding table for the specified port or calibration plane based on the specified S2P file.\n\nA calibration plane can be specified using the format calplane::/port::.\n\nThe calibration plane is created within the context of the specified port. If a calibration plane name is not provided, NI-RFSA uses the default calibration plane for the specified port.\n\nFor devices that do not have multiple ports, use only the calibration plane portion of the selector, for example calplane::.\n\nCreating the first de-embedding table for a calibration plane on a port enables that calibration plane by default.\n\nIf only one de-embedding table exists for a port or calibration plane, NI-RFSA automatically selects that table when performing de-embedding.\n\n**Supported Devices**: PXIe-5830/5831/5832/5840/5841/5842/5860\n\nMultiple calibration planes are supported only on PXIe-5840/5841/5842/5860.\n\n**Related Topics**\n\n`De-embedding Overview `_\n\n`S-parameters `_' }, 'included_in_proto': True, 'is_error_handling': False, @@ -1135,7 +1135,7 @@ { 'direction': 'in', 'documentation': { - 'description': 'Specifies the name of the port. The only valid value for the PXIe-5840/5841/5842/5860 is "" (empty string).', + 'description': 'Accepts either a port name or a calibration plane selector. Use calplane::/port:: to target a calibration plane for that port. For PXIe-5840/5841/5842/5860 devices, the supported values are an empty string or calplane::.' }, 'name': 'port', 'type': 'ViConstString', @@ -1145,7 +1145,7 @@ { 'direction': 'in', 'documentation': { - 'description': 'Specifies the name of the table. The name must be unique for a given port, but not across ports. If you use the same name as an existing table, the table is replaced.', + 'description': 'Specifies the name of the de-embedding table. If a table with the same name already exists in the calibration plane for the specified port, the existing table is replaced.' }, 'name': 'tableName', 'type': 'ViConstString', @@ -1155,7 +1155,7 @@ { 'direction': 'in', 'documentation': { - 'description': 'Specifies the path to the S2P file that contains de-embedding information for the specified port.', + 'description': 'Specifies the path to the S2P file that contains de-embedding information for the specified port or calibration plane.' }, 'name': 's2pFilePath', 'type': 'ViConstString', @@ -1194,7 +1194,7 @@ 'DeleteAllDeembeddingTables': { 'codegen_method': 'public', 'documentation': { - 'description': '\nDeletes all configured de-embedding tables for the session.\n\n**Supported Devices**: PXIe-5830/5831/5832/5840/5841/5842/5860', + 'description': 'Deletes all de-embedding tables configured for the current session.\n\n**Supported Devices**: PXIe-5830/5831/5832/5840/5841/5842/5860' }, 'included_in_proto': True, 'is_error_handling': False, @@ -1224,7 +1224,7 @@ 'DeleteDeembeddingTable': { 'codegen_method': 'public', 'documentation': { - 'description': '\nDeletes the selected de-embedding table for a given port.\n\n**Supported Devices**: PXIe-5830/5831/5832/5840/5841/5842/5860', + 'description': 'Deletes the selected de-embedding table for the specified port or calibration plane.\n\n**Supported Devices**: PXIe-5830/5831/5832/5840/5841/5842/5860\n\nMultiple calibration planes are supported only on PXIe-5840/5841/5842/5860.' }, 'included_in_proto': True, 'is_error_handling': False, @@ -1250,7 +1250,7 @@ { 'direction': 'in', 'documentation': { - 'description': 'Specifies the name of the port. The only valid value for the PXIe-5840/5841/5842/5860 is "" (empty string).', + 'description': 'Accepts either a port name or a calibration plane selector. Use calplane::/port:: to target a calibration plane for that port. For PXIe-5840/5841/5842/5860 devices, the supported values are an empty string or calplane::.' }, 'name': 'port', 'type': 'ViConstString', @@ -1260,7 +1260,7 @@ { 'direction': 'in', 'documentation': { - 'description': 'Specifies the name of the table.', + 'description': 'Specifies the name of the de-embedding table.' }, 'name': 'tableName', 'type': 'ViConstString', @@ -1301,6 +1301,46 @@ 'returns': 'ViStatus', 'use_session_lock': True }, + 'DisableCalibrationPlane': { + 'codegen_method': 'public', + 'documentation': { + 'description': 'Disables the calibration plane for the specified channel for de-embedding.\n\n**Supported Devices**: PXIe-5830/5831/5832/5840/5841/5842/5860' + }, + 'included_in_proto': True, + 'is_error_handling': False, + 'method_templates': [ + { + 'documentation_filename': 'default_method', + 'library_interpreter_filename': 'default_method', + 'method_python_name_suffix': '', + 'session_filename': 'default_method' + } + ], + 'parameters': [ + { + 'direction': 'in', + 'documentation': { + 'description': 'Identifies your instrument session. NIRFSA_ATTR_VI is obtained from the nirfsa_Init or nirfsa_InitWithOptions function.' + }, + 'name': 'vi', + 'type': 'ViSession', + 'use_array': False, + 'use_in_python_api': True + }, + { + 'direction': 'in', + 'documentation': { + 'description': 'Specifies the selector identifying the calibration plane and port.' + }, + 'name': 'channelName', + 'type': 'ViConstString', + 'use_array': False, + 'use_in_python_api': True + } + ], + 'returns': 'ViStatus', + 'use_session_lock': True + }, 'DisableRefTrigger': { 'codegen_method': 'public', 'documentation': { @@ -1361,6 +1401,46 @@ 'returns': 'ViStatus', 'use_session_lock': True }, + 'EnableCalibrationPlane': { + 'codegen_method': 'public', + 'documentation': { + 'description': 'Enables the calibration plane for the specified channel for de-embedding.\n\n**Supported Devices**: PXIe-5830/5831/5832/5840/5841/5842/5860' + }, + 'included_in_proto': True, + 'is_error_handling': False, + 'method_templates': [ + { + 'documentation_filename': 'default_method', + 'library_interpreter_filename': 'default_method', + 'method_python_name_suffix': '', + 'session_filename': 'default_method' + } + ], + 'parameters': [ + { + 'direction': 'in', + 'documentation': { + 'description': 'Identifies your instrument session. NIRFSA_ATTR_VI is obtained from the nirfsa_Init or nirfsa_InitWithOptions function.' + }, + 'name': 'vi', + 'type': 'ViSession', + 'use_array': False, + 'use_in_python_api': True + }, + { + 'direction': 'in', + 'documentation': { + 'description': 'Specifies the selector identifying the calibration plane and port.' + }, + 'name': 'channelName', + 'type': 'ViConstString', + 'use_array': False, + 'use_in_python_api': True + } + ], + 'returns': 'ViStatus', + 'use_session_lock': True + }, 'EnableSessionAccess': { 'codegen_method': 'public', 'documentation': { @@ -2844,8 +2924,7 @@ 'GetDeembeddingSparameters': { 'codegen_method': 'private', 'documentation': { - 'description': '\nReturns the S-parameters used for de-embedding a measurement on the selected port.\n\nThis includes interpolation of the parameters based on the configured carrier frequency. This function returns an empty array if no de-embedding is done.\n\nIf you want to call this function just to get the required buffer size, you can pass 0 for **S-parameter Size** and VI_NULL for the **S-parameters** buffer.\n\n**Supported Devices** : PXIe-5830/5831/5832/5840/5841/5842/5860', - 'note': 'The port orientation for the returned S-parameters is normalized to NIRFSA_VAL_PORT1_TOWARDS_DUT.' + 'description': 'Returns the S-parameters used for de-embedding on the selected port.\n\nThis includes interpolation of the parameters based on the configured carrier frequency. This function returns an empty array if no de-embedding is done.\n\nIf you want to call this function just to get the required buffer size, you can pass 0 for **S-parameter Size** and VI_NULL for the **S-parameters** buffer.\n\n----\n\nThe port orientation for the returned S-parameters is normalized to NIRFSA_VAL_PORT2_TOWARDS_DUT.\n\n----\n\n**Supported Devices**: PXIe-5830/5831/5832/5840/5841/5842/5860' }, 'included_in_proto': True, 'method_templates': [ From 602f79b773b049d5ba426bd746467f8b1df4f44b Mon Sep 17 00:00:00 2001 From: mohit-emerson Date: Fri, 23 Oct 2026 13:24:23 +0000 Subject: [PATCH 2/6] rfsa calplane rep cap , test --- docs/nirfsa/class.rst | 40 +++++++++---------- docs/nirfsa/rep_caps.rst | 26 ++++++++++++ generated/nirfsa/nirfsa/session.py | 23 ++++++----- src/nirfsa/metadata/attributes.py | 3 +- src/nirfsa/metadata/config.py | 4 ++ src/nirfsa/metadata/functions.py | 8 ++++ src/nirfsa/system_tests/test_system_nirfsa.py | 23 +++++++++++ 7 files changed, 95 insertions(+), 32 deletions(-) diff --git a/docs/nirfsa/class.rst b/docs/nirfsa/class.rst index a8ecbcf1c..4c85dd84c 100644 --- a/docs/nirfsa/class.rst +++ b/docs/nirfsa/class.rst @@ -1227,13 +1227,13 @@ disable_calibration_plane - .. tip:: This method can be called on specific channels within your :py:class:`nirfsa.Session` instance. - Use Python index notation on the repeated capabilities container channels to specify a subset, + .. tip:: This method can be called on specific calplanes within your :py:class:`nirfsa.Session` instance. + Use Python index notation on the repeated capabilities container calplanes to specify a subset, and then call this method on the result. - Example: :py:meth:`my_session.channels[ ... ].disable_calibration_plane` + Example: :py:meth:`my_session.calplanes[ ... ].disable_calibration_plane` - To call the method on all channels, you can call it directly on the :py:class:`nirfsa.Session`. + To call the method on all calplanes, you can call it directly on the :py:class:`nirfsa.Session`. Example: :py:meth:`my_session.disable_calibration_plane` @@ -1294,13 +1294,13 @@ enable_calibration_plane - .. tip:: This method can be called on specific channels within your :py:class:`nirfsa.Session` instance. - Use Python index notation on the repeated capabilities container channels to specify a subset, + .. tip:: This method can be called on specific calplanes within your :py:class:`nirfsa.Session` instance. + Use Python index notation on the repeated capabilities container calplanes to specify a subset, and then call this method on the result. - Example: :py:meth:`my_session.channels[ ... ].enable_calibration_plane` + Example: :py:meth:`my_session.calplanes[ ... ].enable_calibration_plane` - To call the method on all channels, you can call it directly on the :py:class:`nirfsa.Session`. + To call the method on all calplanes, you can call it directly on the :py:class:`nirfsa.Session`. Example: :py:meth:`my_session.enable_calibration_plane` @@ -3356,26 +3356,26 @@ deembedding_selected_table - .. tip:: This property can be set/get on specific ports within your :py:class:`nirfsa.Session` instance. - Use Python index notation on the repeated capabilities container ports to specify a subset. + .. tip:: This property can be set/get on specific ports or calplanes within your :py:class:`nirfsa.Session` instance. + Use Python index notation on the repeated capabilities container ports or calplanes to specify a subset. Example: :py:attr:`my_session.ports[ ... ].deembedding_selected_table` - To set/get on all ports, you can call the property directly on the :py:class:`nirfsa.Session`. + To set/get on all ports or calplanes, you can call the property directly on the :py:class:`nirfsa.Session`. Example: :py:attr:`my_session.deembedding_selected_table` The following table lists the characteristics of this property. - +-----------------------+------------+ - | Characteristic | Value | - +=======================+============+ - | Datatype | str | - +-----------------------+------------+ - | Permissions | read-write | - +-----------------------+------------+ - | Repeated Capabilities | ports | - +-----------------------+------------+ + +-----------------------+------------------+ + | Characteristic | Value | + +=======================+==================+ + | Datatype | str | + +-----------------------+------------------+ + | Permissions | read-write | + +-----------------------+------------------+ + | Repeated Capabilities | ports, calplanes | + +-----------------------+------------------+ .. tip:: This property corresponds to the following LabVIEW Property or C Attribute: diff --git a/docs/nirfsa/rep_caps.rst b/docs/nirfsa/rep_caps.rst index 70a6a514b..486b213b8 100644 --- a/docs/nirfsa/rep_caps.rst +++ b/docs/nirfsa/rep_caps.rst @@ -85,4 +85,30 @@ channels passes a string of :python:`'0, 1, 2'` to the set attribute function. +calplanes +--------- + + .. py:attribute:: nirfsa.Session.calplanes[] + + If no prefix is added to the items in the parameter, the correct prefix will be added when + the driver function call is made. + + .. code:: python + + session.calplanes['0-2'].channel_enabled = True + + passes a string of :python:`'calplane::0, calplane::1, calplane::2'` to the set attribute function. + + If an invalid repeated capability is passed to the driver, the driver will return an error. + + You can also explicitly use the prefix as part of the parameter, but it must be the correct prefix + for the specific repeated capability. + + .. code:: python + + session.calplanes['calplane::0-calplane::2'].channel_enabled = True + + passes a string of :python:`'calplane::0, calplane::1, calplane::2'` to the set attribute function. + + diff --git a/generated/nirfsa/nirfsa/session.py b/generated/nirfsa/nirfsa/session.py index fd675cb8c..f7fd7ee41 100644 --- a/generated/nirfsa/nirfsa/session.py +++ b/generated/nirfsa/nirfsa/session.py @@ -460,12 +460,12 @@ class _SessionBase(object): **Supported Devices**: PXIe-5830/5831/5832/5840/5841/5842/5860 Tip: - This property can be set/get on specific ports within your :py:class:`nirfsa.Session` instance. - Use Python index notation on the repeated capabilities container ports to specify a subset. + This property can be set/get on specific ports or calplanes within your :py:class:`nirfsa.Session` instance. + Use Python index notation on the repeated capabilities container ports or calplanes to specify a subset. Example: :py:attr:`my_session.ports[ ... ].deembedding_selected_table` - To set/get on all ports, you can call the property directly on the :py:class:`nirfsa.Session`. + To set/get on all ports or calplanes, you can call the property directly on the :py:class:`nirfsa.Session`. Example: :py:attr:`my_session.deembedding_selected_table` ''' @@ -4876,6 +4876,7 @@ def __init__(self, repeated_capability_list, all_channels_in_session, interprete self.los = _RepeatedCapabilities(self, 'LO', repeated_capability_list) self.device_temperatures = _RepeatedCapabilities(self, '', repeated_capability_list) self.channels = _RepeatedCapabilities(self, '', repeated_capability_list) + self.calplanes = _RepeatedCapabilities(self, 'calplane::', repeated_capability_list) # Finally, set _is_frozen to True which is used to prevent clients from accidentally adding # members when trying to set a property with a typo. @@ -5035,13 +5036,13 @@ def disable_calibration_plane(self): **Supported Devices**: PXIe-5830/5831/5832/5840/5841/5842/5860 Tip: - This method can be called on specific channels within your :py:class:`nirfsa.Session` instance. - Use Python index notation on the repeated capabilities container channels to specify a subset, + This method can be called on specific calplanes within your :py:class:`nirfsa.Session` instance. + Use Python index notation on the repeated capabilities container calplanes to specify a subset, and then call this method on the result. - Example: :py:meth:`my_session.channels[ ... ].disable_calibration_plane` + Example: :py:meth:`my_session.calplanes[ ... ].disable_calibration_plane` - To call the method on all channels, you can call it directly on the :py:class:`nirfsa.Session`. + To call the method on all calplanes, you can call it directly on the :py:class:`nirfsa.Session`. Example: :py:meth:`my_session.disable_calibration_plane` ''' @@ -5056,13 +5057,13 @@ def enable_calibration_plane(self): **Supported Devices**: PXIe-5830/5831/5832/5840/5841/5842/5860 Tip: - This method can be called on specific channels within your :py:class:`nirfsa.Session` instance. - Use Python index notation on the repeated capabilities container channels to specify a subset, + This method can be called on specific calplanes within your :py:class:`nirfsa.Session` instance. + Use Python index notation on the repeated capabilities container calplanes to specify a subset, and then call this method on the result. - Example: :py:meth:`my_session.channels[ ... ].enable_calibration_plane` + Example: :py:meth:`my_session.calplanes[ ... ].enable_calibration_plane` - To call the method on all channels, you can call it directly on the :py:class:`nirfsa.Session`. + To call the method on all calplanes, you can call it directly on the :py:class:`nirfsa.Session`. Example: :py:meth:`my_session.enable_calibration_plane` ''' diff --git a/src/nirfsa/metadata/attributes.py b/src/nirfsa/metadata/attributes.py index 952ed8a9e..d8c2a6282 100644 --- a/src/nirfsa/metadata/attributes.py +++ b/src/nirfsa/metadata/attributes.py @@ -4023,7 +4023,8 @@ 'lv_property': 'De-embedding:Selected Table', 'name': 'DEEMBEDDING_SELECTED_TABLE', 'supported_rep_caps': [ - 'ports' + 'ports', + 'calplanes' ], 'type': 'ViString' }, diff --git a/src/nirfsa/metadata/config.py b/src/nirfsa/metadata/config.py index ab275faf1..2d0842b18 100644 --- a/src/nirfsa/metadata/config.py +++ b/src/nirfsa/metadata/config.py @@ -82,6 +82,10 @@ { 'prefix': '', 'python_name': 'channels' + }, + { + 'prefix': 'calplane::', + 'python_name': 'calplanes' } ], 'session_class_description': 'An NI-RFSA session to the NI-RFSA driver', diff --git a/src/nirfsa/metadata/functions.py b/src/nirfsa/metadata/functions.py index 929c57711..1eef18af6 100644 --- a/src/nirfsa/metadata/functions.py +++ b/src/nirfsa/metadata/functions.py @@ -1306,6 +1306,7 @@ 'documentation': { 'description': 'Disables the calibration plane for the specified channel for de-embedding.\n\n**Supported Devices**: PXIe-5830/5831/5832/5840/5841/5842/5860' }, + 'has_repeated_capability': True, 'included_in_proto': True, 'is_error_handling': False, 'method_templates': [ @@ -1332,12 +1333,15 @@ 'documentation': { 'description': 'Specifies the selector identifying the calibration plane and port.' }, + 'is_repeated_capability': True, 'name': 'channelName', + 'repeated_capability_type': 'calplanes', 'type': 'ViConstString', 'use_array': False, 'use_in_python_api': True } ], + 'repeated_capability_type': 'calplanes', 'returns': 'ViStatus', 'use_session_lock': True }, @@ -1406,6 +1410,7 @@ 'documentation': { 'description': 'Enables the calibration plane for the specified channel for de-embedding.\n\n**Supported Devices**: PXIe-5830/5831/5832/5840/5841/5842/5860' }, + 'has_repeated_capability': True, 'included_in_proto': True, 'is_error_handling': False, 'method_templates': [ @@ -1432,12 +1437,15 @@ 'documentation': { 'description': 'Specifies the selector identifying the calibration plane and port.' }, + 'is_repeated_capability': True, 'name': 'channelName', + 'repeated_capability_type': 'calplanes', 'type': 'ViConstString', 'use_array': False, 'use_in_python_api': True } ], + 'repeated_capability_type': 'calplanes', 'returns': 'ViStatus', 'use_session_lock': True }, diff --git a/src/nirfsa/system_tests/test_system_nirfsa.py b/src/nirfsa/system_tests/test_system_nirfsa.py index 34deeb428..f09b80154 100644 --- a/src/nirfsa/system_tests/test_system_nirfsa.py +++ b/src/nirfsa/system_tests/test_system_nirfsa.py @@ -599,6 +599,29 @@ def test_delete_all_deembedding_tables(self, rfsa_device_session): rfsa_device_session.create_deembedding_sparameter_table_array('', 'myTable2', frequencies, sparameter_tables, nirfsa.SparameterOrientation.PORT2_TOWARDS_DUT) rfsa_device_session.delete_all_deembedding_tables() + def test_deembedding_compensation_gain_changes_with_enabled_calibration_planes(self, rfsa_device_session): + frequencies = np.array([1e9, 2e9, 3e9], dtype=np.float64) + sparametertables1 = np.array([[[0.1 + 0.0j, 0.5 + 0.0j], [0.5 + 0.0j, 0.1 + 0.0j]], [[0.1 + 0.0j, 0.45 + 0.0j], [0.45 + 0.0j, 0.1 + 0.0j]], [[0.1 + 0.0j, 0.4 + 0.0j], [0.4 + 0.0j, 0.1 + 0.0j]]], dtype=np.complex128) + sparametertables2 = np.array([[[0.2 + 0.0j, 0.25 + 0.0j], [0.25 + 0.0j, 0.2 + 0.0j]], [[0.2 + 0.0j, 0.2 + 0.0j], [0.2 + 0.0j, 0.2 + 0.0j]], [[0.2 + 0.0j, 0.15 + 0.0j], [0.15 + 0.0j, 0.2 + 0.0j]]], dtype=np.complex128) + rfsa_device_session.create_deembedding_sparameter_table_array('calplane::plane1', 'table1', frequencies, sparametertables1, nirfsa.SparameterOrientation.PORT2_TOWARDS_DUT) + rfsa_device_session.create_deembedding_sparameter_table_array('calplane::plane2', 'table2', frequencies, sparametertables2, nirfsa.SparameterOrientation.PORT2_TOWARDS_DUT) + rfsa_device_session.calplanes['plane1'].deembedding_selected_table = 'table1' + rfsa_device_session.calplanes['plane2'].deembedding_selected_table = 'table2' + rfsa_device_session.center_frequency = 2e9 + rfsa_device_session.commit() + gain_both_enabled = rfsa_device_session.deembedding_compensation_gain + rfsa_device_session.calplanes['plane2'].disable_calibration_plane() + rfsa_device_session.commit() + gain_only_plane1_enabled = rfsa_device_session.deembedding_compensation_gain + rfsa_device_session.calplanes['plane1'].disable_calibration_plane() + rfsa_device_session.commit() + gain_both_disabled = rfsa_device_session.deembedding_compensation_gain + rfsa_device_session.calplanes['plane2'].enable_calibration_plane() + rfsa_device_session.commit() + gain_only_plane2_enabled = rfsa_device_session.deembedding_compensation_gain + + assert len({gain_both_enabled, gain_only_plane1_enabled, gain_only_plane2_enabled, gain_both_disabled}) == 4 + class TestLibrary(SystemTests): @pytest.fixture(scope='class') From 55576a7216b7bfc7eceb9a17d5180adc24414ae0 Mon Sep 17 00:00:00 2001 From: mohit-emerson Date: Fri, 23 Oct 2026 14:50:46 +0000 Subject: [PATCH 3/6] test changes --- src/nirfsa/system_tests/test_system_nirfsa.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/nirfsa/system_tests/test_system_nirfsa.py b/src/nirfsa/system_tests/test_system_nirfsa.py index f09b80154..5d33169b6 100644 --- a/src/nirfsa/system_tests/test_system_nirfsa.py +++ b/src/nirfsa/system_tests/test_system_nirfsa.py @@ -608,16 +608,17 @@ def test_deembedding_compensation_gain_changes_with_enabled_calibration_planes(s rfsa_device_session.calplanes['plane1'].deembedding_selected_table = 'table1' rfsa_device_session.calplanes['plane2'].deembedding_selected_table = 'table2' rfsa_device_session.center_frequency = 2e9 - rfsa_device_session.commit() + gain_both_enabled = rfsa_device_session.deembedding_compensation_gain rfsa_device_session.calplanes['plane2'].disable_calibration_plane() - rfsa_device_session.commit() + +# assert here only gain_only_plane1_enabled = rfsa_device_session.deembedding_compensation_gain rfsa_device_session.calplanes['plane1'].disable_calibration_plane() - rfsa_device_session.commit() + gain_both_disabled = rfsa_device_session.deembedding_compensation_gain rfsa_device_session.calplanes['plane2'].enable_calibration_plane() - rfsa_device_session.commit() + gain_only_plane2_enabled = rfsa_device_session.deembedding_compensation_gain assert len({gain_both_enabled, gain_only_plane1_enabled, gain_only_plane2_enabled, gain_both_disabled}) == 4 From ff6883faa4096a43f48aef0b7fad45fa6be24ad2 Mon Sep 17 00:00:00 2001 From: mohit-emerson Date: Mon, 26 Oct 2026 08:06:55 +0000 Subject: [PATCH 4/6] rfsa test --- src/nirfsa/system_tests/test_system_nirfsa.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/nirfsa/system_tests/test_system_nirfsa.py b/src/nirfsa/system_tests/test_system_nirfsa.py index 5d33169b6..148956661 100644 --- a/src/nirfsa/system_tests/test_system_nirfsa.py +++ b/src/nirfsa/system_tests/test_system_nirfsa.py @@ -608,20 +608,17 @@ def test_deembedding_compensation_gain_changes_with_enabled_calibration_planes(s rfsa_device_session.calplanes['plane1'].deembedding_selected_table = 'table1' rfsa_device_session.calplanes['plane2'].deembedding_selected_table = 'table2' rfsa_device_session.center_frequency = 2e9 - gain_both_enabled = rfsa_device_session.deembedding_compensation_gain rfsa_device_session.calplanes['plane2'].disable_calibration_plane() - -# assert here only gain_only_plane1_enabled = rfsa_device_session.deembedding_compensation_gain + assert gain_only_plane1_enabled != gain_both_enabled rfsa_device_session.calplanes['plane1'].disable_calibration_plane() - gain_both_disabled = rfsa_device_session.deembedding_compensation_gain + assert gain_both_disabled != gain_only_plane1_enabled rfsa_device_session.calplanes['plane2'].enable_calibration_plane() - gain_only_plane2_enabled = rfsa_device_session.deembedding_compensation_gain - - assert len({gain_both_enabled, gain_only_plane1_enabled, gain_only_plane2_enabled, gain_both_disabled}) == 4 + assert gain_only_plane2_enabled != gain_both_disabled + assert gain_only_plane2_enabled != gain_only_plane1_enabled class TestLibrary(SystemTests): From e284399d8ff8afe0ad54369f9972f7377deac288 Mon Sep 17 00:00:00 2001 From: mohit-emerson Date: Mon, 26 Oct 2026 08:31:00 +0000 Subject: [PATCH 5/6] changelog updated --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index cfa7540d4..70f3dec21 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1742,6 +1742,8 @@ #### [nirfsa] Unreleased - Added - (Common) Added `nitlsconfig[grpc]>=1.0.0a2` to the optional gRPC dependencies. + - Added new `enable_calibration_plane` and `disable_calibration_plane` functions. + - Added `calplanes` repeated capability support for `deembedding_selected_table` attribute. - Changed - Removed - Removed invalid enum value `None` from enum `LoSource` From b120c9674914149c4277d910f2ac85ffd86790a7 Mon Sep 17 00:00:00 2001 From: mohit-emerson Date: Mon, 26 Oct 2026 10:34:57 +0000 Subject: [PATCH 6/6] InvalidRepeatedCapabilityError rep removed --- build/templates/_converters.py.mako | 13 ++++++ docs/nirfsa/errors.rst | 10 ----- generated/nirfsa/nirfsa/_converters.py | 8 ++-- generated/nirfsa/nirfsa/errors.py | 7 ---- .../unit_tests/test_repeated_capabilities.py | 42 +++++++++++++++++++ src/nirfsa/metadata/config.py | 1 - src/nirfsa/system_tests/test_system_nirfsa.py | 10 ++--- .../unit_tests/test_repeated_capabilities.py | 42 +++++++++++++++++++ 8 files changed, 105 insertions(+), 28 deletions(-) create mode 100644 generated/nirfsa/nirfsa/unit_tests/test_repeated_capabilities.py create mode 100644 src/nirfsa/unit_tests/test_repeated_capabilities.py diff --git a/build/templates/_converters.py.mako b/build/templates/_converters.py.mako index 2ee4ba663..963fabcfb 100644 --- a/build/templates/_converters.py.mako +++ b/build/templates/_converters.py.mako @@ -5,13 +5,17 @@ ${template_parameters['encoding_tag']} config = template_parameters['metadata'].config module_name = config['module_name'] extra_errors_used = config['extra_errors_used'] + # Drivers that have repeated capabilities but do not generate InvalidRepeatedCapabilityError pass repeated capabilities they cannot parse to the driver as-is + validate_repeated_capabilities = 'InvalidRepeatedCapabilityError' in extra_errors_used or len(config['repeated_capabilities']) == 0 enums = config['enums'] %>\ import ${module_name}._visatype as _visatype % if any(helper.enum_uses_converter(enums[enum_name]) for enum_name in helper.filter_codegen_enums(enums)): import ${module_name}.enums as enums % endif +% if validate_repeated_capabilities: import ${module_name}.errors as errors +% endif import array import collections @@ -51,7 +55,11 @@ def _convert_repeated_capabilities(arg, prefix): # noqa: F811 - (slice(0, 1), '2', [4, '5-6'], '7-9', '11:14', '16, 17') --> ['0', '2', '4', '5', '6', '7', '8', '9', '11', '12', '13', '14', '16', '17'] ''' +% if validate_repeated_capabilities: raise errors.InvalidRepeatedCapabilityError('Invalid type', type(arg)) +% else: + raise TypeError('Invalid type for a repeated capability: {}'.format(type(arg))) +% endif @_convert_repeated_capabilities.register(numbers.Integral) # noqa: F811 @@ -77,9 +85,14 @@ def _(repeated_capability, prefix): # We remove any prefix and change ':' to '-' r = repeated_capability.strip().replace(prefix, '').replace(':', '-') rc = r.split('-') +% if validate_repeated_capabilities: if len(rc) > 1: if len(rc) > 2: raise errors.InvalidRepeatedCapabilityError("Multiple '-' or ':'", repeated_capability) +% else: + # Only a simple range can be expanded. Anything else, such as 'calplane::plane1/port::if1', is returned as-is + if len(rc) == 2: +% endif try: start = int(rc[0]) end = int(rc[1]) diff --git a/docs/nirfsa/errors.rst b/docs/nirfsa/errors.rst index f0071083f..bc911845e 100644 --- a/docs/nirfsa/errors.rst +++ b/docs/nirfsa/errors.rst @@ -57,16 +57,6 @@ DriverTooNewError An error due to the NI-RFSA driver runtime being too new for this module. -InvalidRepeatedCapabilityError ------------------------------- - - .. py:currentmodule:: nirfsa.errors - - .. exception:: InvalidRepeatedCapabilityError - - An error due to an invalid character in a repeated capability - - SelfTestError ------------- diff --git a/generated/nirfsa/nirfsa/_converters.py b/generated/nirfsa/nirfsa/_converters.py index 03b820e26..040bbb2ff 100644 --- a/generated/nirfsa/nirfsa/_converters.py +++ b/generated/nirfsa/nirfsa/_converters.py @@ -1,7 +1,6 @@ # -*- coding: utf-8 -*- # This file was generated import nirfsa._visatype as _visatype -import nirfsa.errors as errors import array import collections @@ -41,7 +40,7 @@ def _convert_repeated_capabilities(arg, prefix): # noqa: F811 - (slice(0, 1), '2', [4, '5-6'], '7-9', '11:14', '16, 17') --> ['0', '2', '4', '5', '6', '7', '8', '9', '11', '12', '13', '14', '16', '17'] ''' - raise errors.InvalidRepeatedCapabilityError('Invalid type', type(arg)) + raise TypeError('Invalid type for a repeated capability: {}'.format(type(arg))) @_convert_repeated_capabilities.register(numbers.Integral) # noqa: F811 @@ -67,9 +66,8 @@ def _(repeated_capability, prefix): # We remove any prefix and change ':' to '-' r = repeated_capability.strip().replace(prefix, '').replace(':', '-') rc = r.split('-') - if len(rc) > 1: - if len(rc) > 2: - raise errors.InvalidRepeatedCapabilityError("Multiple '-' or ':'", repeated_capability) + # Only a simple range can be expanded. Anything else, such as 'calplane::plane1/port::if1', is returned as-is + if len(rc) == 2: try: start = int(rc[0]) end = int(rc[1]) diff --git a/generated/nirfsa/nirfsa/errors.py b/generated/nirfsa/nirfsa/errors.py index a559fa37f..579833a54 100644 --- a/generated/nirfsa/nirfsa/errors.py +++ b/generated/nirfsa/nirfsa/errors.py @@ -85,13 +85,6 @@ def __init__(self): super(DriverTooNewError, self).__init__('The NI-RFSA runtime returned an unexpected value. This can occur if it is too new for the nirfsa Python module. Upgrade the nirfsa Python module.') -class InvalidRepeatedCapabilityError(Error): - '''An error due to an invalid character in a repeated capability''' - - def __init__(self, invalid_character, invalid_string): - super(InvalidRepeatedCapabilityError, self).__init__('An invalid character ({}) was found in repeated capability string ({})'.format(invalid_character, invalid_string)) - - class SelfTestError(Error): '''An error due to a failed self-test''' diff --git a/generated/nirfsa/nirfsa/unit_tests/test_repeated_capabilities.py b/generated/nirfsa/nirfsa/unit_tests/test_repeated_capabilities.py new file mode 100644 index 000000000..09149105d --- /dev/null +++ b/generated/nirfsa/nirfsa/unit_tests/test_repeated_capabilities.py @@ -0,0 +1,42 @@ +import nirfsa._converters as _converters +import nirfsa.errors +import nirfsa.session +import pytest + + +def test_invalid_repeated_capability_error_is_not_defined(): + assert not hasattr(nirfsa.errors, 'InvalidRepeatedCapabilityError') + + +def test_string_with_multiple_separators_is_passed_through_unchanged(): + assert _converters.convert_repeated_capabilities('calplane::plane1/port::if1') == ['calplane::plane1/port::if1'] + assert _converters.convert_repeated_capabilities('1-2-3') == ['1-2-3'] + + +def test_string_with_prefix_is_passed_through_unchanged(): + assert _converters.convert_repeated_capabilities('plane1', prefix='calplane::') == ['calplane::plane1'] + assert _converters.convert_repeated_capabilities('calplane::plane1', prefix='calplane::') == ['calplane::plane1'] + + +def test_simple_ranges_and_lists_are_still_expanded(): + assert _converters.convert_repeated_capabilities('0-2', prefix='LO') == ['LO0', 'LO1', 'LO2'] + assert _converters.convert_repeated_capabilities('LO0:LO2', prefix='LO') == ['LO0', 'LO1', 'LO2'] + assert _converters.convert_repeated_capabilities('0,1', prefix='LO') == ['LO0', 'LO1'] + assert _converters.convert_repeated_capabilities([0, '1'], prefix='LO') == ['LO0', 'LO1'] + assert _converters.convert_repeated_capabilities(range(2), prefix='LO') == ['LO0', 'LO1'] + assert _converters.convert_repeated_capabilities(None) == [] + + +@pytest.mark.parametrize('invalid_repeated_capability', [1.5, {}, object()]) +def test_unsupported_type_raises_type_error(invalid_repeated_capability): + with pytest.raises(TypeError): + _converters.convert_repeated_capabilities(invalid_repeated_capability) + + +def test_session_repeated_capabilities_send_selector_to_driver_as_written(): + session = nirfsa.session._SessionBase(repeated_capability_list=[], all_channels_in_session=None, interpreter=None) + assert session.ports['if1']._repeated_capability == 'if1' + assert session.ports['calplane::plane1/port::if1']._repeated_capability == 'calplane::plane1/port::if1' + assert session.channels['calplane::plane1/port::if1']._repeated_capability == 'calplane::plane1/port::if1' + assert session.calplanes['plane1']._repeated_capability == 'calplane::plane1' + assert session.calplanes['plane1'].ports['port::if1']._repeated_capability == 'calplane::plane1/port::if1' diff --git a/src/nirfsa/metadata/config.py b/src/nirfsa/metadata/config.py index 2d0842b18..1570d1395 100644 --- a/src/nirfsa/metadata/config.py +++ b/src/nirfsa/metadata/config.py @@ -42,7 +42,6 @@ '_TOWARDS_DUT' ], 'extra_errors_used': [ - 'InvalidRepeatedCapabilityError', 'SelfTestError' ], 'grpc_service_class_prefix': 'NiRFSA', diff --git a/src/nirfsa/system_tests/test_system_nirfsa.py b/src/nirfsa/system_tests/test_system_nirfsa.py index 148956661..3ef5af2d6 100644 --- a/src/nirfsa/system_tests/test_system_nirfsa.py +++ b/src/nirfsa/system_tests/test_system_nirfsa.py @@ -605,17 +605,17 @@ def test_deembedding_compensation_gain_changes_with_enabled_calibration_planes(s sparametertables2 = np.array([[[0.2 + 0.0j, 0.25 + 0.0j], [0.25 + 0.0j, 0.2 + 0.0j]], [[0.2 + 0.0j, 0.2 + 0.0j], [0.2 + 0.0j, 0.2 + 0.0j]], [[0.2 + 0.0j, 0.15 + 0.0j], [0.15 + 0.0j, 0.2 + 0.0j]]], dtype=np.complex128) rfsa_device_session.create_deembedding_sparameter_table_array('calplane::plane1', 'table1', frequencies, sparametertables1, nirfsa.SparameterOrientation.PORT2_TOWARDS_DUT) rfsa_device_session.create_deembedding_sparameter_table_array('calplane::plane2', 'table2', frequencies, sparametertables2, nirfsa.SparameterOrientation.PORT2_TOWARDS_DUT) - rfsa_device_session.calplanes['plane1'].deembedding_selected_table = 'table1' - rfsa_device_session.calplanes['plane2'].deembedding_selected_table = 'table2' + rfsa_device_session.ports['calplanes::plane1'].deembedding_selected_table = 'table1' + rfsa_device_session.ports['calplanes::plane2'].deembedding_selected_table = 'table2' rfsa_device_session.center_frequency = 2e9 gain_both_enabled = rfsa_device_session.deembedding_compensation_gain - rfsa_device_session.calplanes['plane2'].disable_calibration_plane() + rfsa_device_session.ports['calplanes::plane2'].disable_calibration_plane() gain_only_plane1_enabled = rfsa_device_session.deembedding_compensation_gain assert gain_only_plane1_enabled != gain_both_enabled - rfsa_device_session.calplanes['plane1'].disable_calibration_plane() + rfsa_device_session.ports['calplanes::plane1'].disable_calibration_plane() gain_both_disabled = rfsa_device_session.deembedding_compensation_gain assert gain_both_disabled != gain_only_plane1_enabled - rfsa_device_session.calplanes['plane2'].enable_calibration_plane() + rfsa_device_session.ports['calplanes::plane2'].enable_calibration_plane() gain_only_plane2_enabled = rfsa_device_session.deembedding_compensation_gain assert gain_only_plane2_enabled != gain_both_disabled assert gain_only_plane2_enabled != gain_only_plane1_enabled diff --git a/src/nirfsa/unit_tests/test_repeated_capabilities.py b/src/nirfsa/unit_tests/test_repeated_capabilities.py new file mode 100644 index 000000000..09149105d --- /dev/null +++ b/src/nirfsa/unit_tests/test_repeated_capabilities.py @@ -0,0 +1,42 @@ +import nirfsa._converters as _converters +import nirfsa.errors +import nirfsa.session +import pytest + + +def test_invalid_repeated_capability_error_is_not_defined(): + assert not hasattr(nirfsa.errors, 'InvalidRepeatedCapabilityError') + + +def test_string_with_multiple_separators_is_passed_through_unchanged(): + assert _converters.convert_repeated_capabilities('calplane::plane1/port::if1') == ['calplane::plane1/port::if1'] + assert _converters.convert_repeated_capabilities('1-2-3') == ['1-2-3'] + + +def test_string_with_prefix_is_passed_through_unchanged(): + assert _converters.convert_repeated_capabilities('plane1', prefix='calplane::') == ['calplane::plane1'] + assert _converters.convert_repeated_capabilities('calplane::plane1', prefix='calplane::') == ['calplane::plane1'] + + +def test_simple_ranges_and_lists_are_still_expanded(): + assert _converters.convert_repeated_capabilities('0-2', prefix='LO') == ['LO0', 'LO1', 'LO2'] + assert _converters.convert_repeated_capabilities('LO0:LO2', prefix='LO') == ['LO0', 'LO1', 'LO2'] + assert _converters.convert_repeated_capabilities('0,1', prefix='LO') == ['LO0', 'LO1'] + assert _converters.convert_repeated_capabilities([0, '1'], prefix='LO') == ['LO0', 'LO1'] + assert _converters.convert_repeated_capabilities(range(2), prefix='LO') == ['LO0', 'LO1'] + assert _converters.convert_repeated_capabilities(None) == [] + + +@pytest.mark.parametrize('invalid_repeated_capability', [1.5, {}, object()]) +def test_unsupported_type_raises_type_error(invalid_repeated_capability): + with pytest.raises(TypeError): + _converters.convert_repeated_capabilities(invalid_repeated_capability) + + +def test_session_repeated_capabilities_send_selector_to_driver_as_written(): + session = nirfsa.session._SessionBase(repeated_capability_list=[], all_channels_in_session=None, interpreter=None) + assert session.ports['if1']._repeated_capability == 'if1' + assert session.ports['calplane::plane1/port::if1']._repeated_capability == 'calplane::plane1/port::if1' + assert session.channels['calplane::plane1/port::if1']._repeated_capability == 'calplane::plane1/port::if1' + assert session.calplanes['plane1']._repeated_capability == 'calplane::plane1' + assert session.calplanes['plane1'].ports['port::if1']._repeated_capability == 'calplane::plane1/port::if1'