Source code for nirfmxvna.waves_configuration

"""Provides methods to configure the Waves measurement."""

import functools

import nirfmxvna.attributes as attributes
import nirfmxvna.enums as enums
import nirfmxvna.errors as errors
import nirfmxvna.internal._helper as _helper


def _raise_if_disposed(f):
    """From https://stackoverflow.com/questions/5929107/decorators-with-parameters."""

    @functools.wraps(f)
    def aux(*xs, **kws):
        meas_obj = xs[0]  # parameter 0 is 'self' which is the measurement object
        if meas_obj._signal_obj.is_disposed:
            raise Exception("Cannot access a disposed Vna signal configuration")
        return f(*xs, **kws)

    return aux


[docs] class WavesConfiguration(object): """Provides methods to configure the Waves measurement.""" def __init__(self, signal_obj): """Provides methods to configure the Waves measurement.""" self._signal_obj = signal_obj self._session_function_lock = signal_obj._session_function_lock self._interpreter = signal_obj._interpreter
[docs] @_raise_if_disposed def get_measurement_enabled(self, selector_string): r"""Gets whether to enable the Waves measurement. You do not need to use a selector string to configure or read this attribute for the default signal instance. Refer to the `Selector String <https://www.ni.com/docs/en-US/bundle/rfmx/page/selector-strings-net.html>`_ topic for information about the string syntax for named signals. The default value is **False**. Args: selector_string (string): Pass an empty string. Returns: Tuple (attr_val, error_code): attr_val (bool): Specifies whether to enable the Waves measurement. error_code (int): Returns the status code of this method. The status code either indicates success or describes a warning condition. """ try: self._session_function_lock.enter_read_lock() updated_selector_string = _helper.validate_and_update_selector_string( selector_string, self._signal_obj ) attr_val, error_code = self._interpreter.get_attribute_i32( updated_selector_string, attributes.AttributeID.WAVES_MEASUREMENT_ENABLED.value ) attr_val = bool(attr_val) finally: self._session_function_lock.exit_read_lock() return attr_val, error_code
[docs] @_raise_if_disposed def set_measurement_enabled(self, selector_string, value): r"""Sets whether to enable the Waves measurement. You do not need to use a selector string to configure or read this attribute for the default signal instance. Refer to the `Selector String <https://www.ni.com/docs/en-US/bundle/rfmx/page/selector-strings-net.html>`_ topic for information about the string syntax for named signals. The default value is **False**. Args: selector_string (string): Pass an empty string. value (bool): Specifies whether to enable the Waves measurement. Returns: int: Returns the status code of this method. The status code either indicates success or describes a warning condition. """ try: self._session_function_lock.enter_read_lock() updated_selector_string = _helper.validate_and_update_selector_string( selector_string, self._signal_obj ) error_code = self._interpreter.set_attribute_i32( updated_selector_string, attributes.AttributeID.WAVES_MEASUREMENT_ENABLED.value, int(value), ) finally: self._session_function_lock.exit_read_lock() return error_code
[docs] @_raise_if_disposed def get_number_of_waves(self, selector_string): r"""Gets the number of waves to be measured. If you increase this attribute value from N to N+K, then existing N Waves are not affected but K new Waves are added. If you reduce number of Waves from N to N-K, then last K Waves are deleted without affecting the remaining N-K Waves. You do not need to use a selector string to configure or read this attribute for the default signal instance. Refer to the `Selector String <https://www.ni.com/docs/en-US/bundle/rfmx/page/selector-strings-net.html>`_ topic for information about the string syntax for named signals. The default value is 1. Args: selector_string (string): Pass an empty string. Returns: Tuple (attr_val, error_code): attr_val (int): Specifies the number of waves to be measured. error_code (int): Returns the status code of this method. The status code either indicates success or describes a warning condition. """ try: self._session_function_lock.enter_read_lock() updated_selector_string = _helper.validate_and_update_selector_string( selector_string, self._signal_obj ) attr_val, error_code = self._interpreter.get_attribute_i32( updated_selector_string, attributes.AttributeID.WAVES_NUMBER_OF_WAVES.value ) finally: self._session_function_lock.exit_read_lock() return attr_val, error_code
[docs] @_raise_if_disposed def set_number_of_waves(self, selector_string, value): r"""Sets the number of waves to be measured. If you increase this attribute value from N to N+K, then existing N Waves are not affected but K new Waves are added. If you reduce number of Waves from N to N-K, then last K Waves are deleted without affecting the remaining N-K Waves. You do not need to use a selector string to configure or read this attribute for the default signal instance. Refer to the `Selector String <https://www.ni.com/docs/en-US/bundle/rfmx/page/selector-strings-net.html>`_ topic for information about the string syntax for named signals. The default value is 1. Args: selector_string (string): Pass an empty string. value (int): Specifies the number of waves to be measured. Returns: int: Returns the status code of this method. The status code either indicates success or describes a warning condition. """ try: self._session_function_lock.enter_read_lock() updated_selector_string = _helper.validate_and_update_selector_string( selector_string, self._signal_obj ) error_code = self._interpreter.set_attribute_i32( updated_selector_string, attributes.AttributeID.WAVES_NUMBER_OF_WAVES.value, value ) finally: self._session_function_lock.exit_read_lock() return error_code
[docs] @_raise_if_disposed def get_receiver(self, selector_string): r"""Gets whether to measure the wave on the reference receiver or the test receiver of the Wave Receiver Port. Incident and scattered waves are denoted by "a_<*receiver port name*>_<*source port name*>" and "b_<*receiver port name*>_<*source port name*>" respectively. On a receiver port, the a and b waves are measured using Reference receiver and Test receiver respectively. For example, to measure "b21", set this attribute to **Test (0)**, :py:attr:`~nirfmxvna.attributes.AttributeID.WAVES_RECEIVER_PORT` to "port2" and :py:attr:`~nirfmxvna.attributes.AttributeID.WAVES_SOURCE_PORT` to "port1". Use "wave<*n*>" as the selector string to configure or read this attribute. The default value is **Test**. +---------------+----------------------------------------------+ | Name (Value) | Description | +===============+==============================================+ | Test (0) | Measures the wave on the test receiver. | +---------------+----------------------------------------------+ | Reference (1) | Measures the wave on the reference receiver. | +---------------+----------------------------------------------+ Args: selector_string (string): Pass an empty string. Returns: Tuple (attr_val, error_code): attr_val (enums.WavesReceiver): Specifies whether to measure the wave on the reference receiver or the test receiver of the Wave Receiver Port. error_code (int): Returns the status code of this method. The status code either indicates success or describes a warning condition. """ try: self._session_function_lock.enter_read_lock() updated_selector_string = _helper.validate_and_update_selector_string( selector_string, self._signal_obj ) attr_val, error_code = self._interpreter.get_attribute_i32( updated_selector_string, attributes.AttributeID.WAVES_RECEIVER.value ) attr_val = enums.WavesReceiver(attr_val) except (KeyError, ValueError): raise errors.DriverTooNewError() # type: ignore finally: self._session_function_lock.exit_read_lock() return attr_val, error_code
[docs] @_raise_if_disposed def set_receiver(self, selector_string, value): r"""Sets whether to measure the wave on the reference receiver or the test receiver of the Wave Receiver Port. Incident and scattered waves are denoted by "a_<*receiver port name*>_<*source port name*>" and "b_<*receiver port name*>_<*source port name*>" respectively. On a receiver port, the a and b waves are measured using Reference receiver and Test receiver respectively. For example, to measure "b21", set this attribute to **Test (0)**, :py:attr:`~nirfmxvna.attributes.AttributeID.WAVES_RECEIVER_PORT` to "port2" and :py:attr:`~nirfmxvna.attributes.AttributeID.WAVES_SOURCE_PORT` to "port1". Use "wave<*n*>" as the selector string to configure or read this attribute. The default value is **Test**. +---------------+----------------------------------------------+ | Name (Value) | Description | +===============+==============================================+ | Test (0) | Measures the wave on the test receiver. | +---------------+----------------------------------------------+ | Reference (1) | Measures the wave on the reference receiver. | +---------------+----------------------------------------------+ Args: selector_string (string): Pass an empty string. value (enums.WavesReceiver, int): Specifies whether to measure the wave on the reference receiver or the test receiver of the Wave Receiver Port. Returns: int: Returns the status code of this method. The status code either indicates success or describes a warning condition. """ try: self._session_function_lock.enter_read_lock() updated_selector_string = _helper.validate_and_update_selector_string( selector_string, self._signal_obj ) value = value.value if type(value) is enums.WavesReceiver else value error_code = self._interpreter.set_attribute_i32( updated_selector_string, attributes.AttributeID.WAVES_RECEIVER.value, value ) finally: self._session_function_lock.exit_read_lock() return error_code
[docs] @_raise_if_disposed def get_receiver_port(self, selector_string): r"""Gets the receiver port name for wave measurement. Incident and scattered waves are denoted by "a_<*receiver port name*>_<*source port name*>" and "b_<*receiver port name*>_<*source port name*>" respectively. On a receiver port, the a and b waves are measured using Reference receiver and Test receiver respectively. For example, to measure "b21", set :py:attr:`~nirfmxvna.attributes.AttributeID.WAVES_RECEIVER` to **Test (0)**, set this attribute to "port2" and :py:attr:`~nirfmxvna.attributes.AttributeID.WAVES_SOURCE_PORT` to "port1". Use "wave<*n*>" as the selector string to configure or read this attribute. The default value is "port1". Args: selector_string (string): Pass an empty string. Returns: Tuple (attr_val, error_code): attr_val (string): Specifies the receiver port name for wave measurement. error_code (int): Returns the status code of this method. The status code either indicates success or describes a warning condition. """ try: self._session_function_lock.enter_read_lock() updated_selector_string = _helper.validate_and_update_selector_string( selector_string, self._signal_obj ) attr_val, error_code = self._interpreter.get_attribute_string( updated_selector_string, attributes.AttributeID.WAVES_RECEIVER_PORT.value ) finally: self._session_function_lock.exit_read_lock() return attr_val, error_code
[docs] @_raise_if_disposed def set_receiver_port(self, selector_string, value): r"""Sets the receiver port name for wave measurement. Incident and scattered waves are denoted by "a_<*receiver port name*>_<*source port name*>" and "b_<*receiver port name*>_<*source port name*>" respectively. On a receiver port, the a and b waves are measured using Reference receiver and Test receiver respectively. For example, to measure "b21", set :py:attr:`~nirfmxvna.attributes.AttributeID.WAVES_RECEIVER` to **Test (0)**, set this attribute to "port2" and :py:attr:`~nirfmxvna.attributes.AttributeID.WAVES_SOURCE_PORT` to "port1". Use "wave<*n*>" as the selector string to configure or read this attribute. The default value is "port1". Args: selector_string (string): Pass an empty string. value (string): Specifies the receiver port name for wave measurement. Returns: int: Returns the status code of this method. The status code either indicates success or describes a warning condition. """ try: self._session_function_lock.enter_read_lock() updated_selector_string = _helper.validate_and_update_selector_string( selector_string, self._signal_obj ) _helper.validate_not_none(value, "value") error_code = self._interpreter.set_attribute_string( updated_selector_string, attributes.AttributeID.WAVES_RECEIVER_PORT.value, value ) finally: self._session_function_lock.exit_read_lock() return error_code
[docs] @_raise_if_disposed def get_source_port(self, selector_string): r"""Gets the source port name for wave measurement. Incident and scattered waves are denoted by "a_<*receiver port name*>_<*source port name*>" and "b_<*receiver port name*>_<*source port name*>" respectively. On a receiver port, the a and b waves are measured using Reference receiver and Test receiver respectively. For example, to measure "b21", set :py:attr:`~nirfmxvna.attributes.AttributeID.WAVES_RECEIVER` to **Test (0)**, :py:attr:`~nirfmxvna.attributes.AttributeID.WAVES_RECEIVER_PORT` to "port2" and set this attribute to "port1". Use "wave<*n*>" as the selector string to configure or read this attribute. The default value is "port1". Args: selector_string (string): Pass an empty string. Returns: Tuple (attr_val, error_code): attr_val (string): Specifies the source port name for wave measurement. error_code (int): Returns the status code of this method. The status code either indicates success or describes a warning condition. """ try: self._session_function_lock.enter_read_lock() updated_selector_string = _helper.validate_and_update_selector_string( selector_string, self._signal_obj ) attr_val, error_code = self._interpreter.get_attribute_string( updated_selector_string, attributes.AttributeID.WAVES_SOURCE_PORT.value ) finally: self._session_function_lock.exit_read_lock() return attr_val, error_code
[docs] @_raise_if_disposed def set_source_port(self, selector_string, value): r"""Sets the source port name for wave measurement. Incident and scattered waves are denoted by "a_<*receiver port name*>_<*source port name*>" and "b_<*receiver port name*>_<*source port name*>" respectively. On a receiver port, the a and b waves are measured using Reference receiver and Test receiver respectively. For example, to measure "b21", set :py:attr:`~nirfmxvna.attributes.AttributeID.WAVES_RECEIVER` to **Test (0)**, :py:attr:`~nirfmxvna.attributes.AttributeID.WAVES_RECEIVER_PORT` to "port2" and set this attribute to "port1". Use "wave<*n*>" as the selector string to configure or read this attribute. The default value is "port1". Args: selector_string (string): Pass an empty string. value (string): Specifies the source port name for wave measurement. Returns: int: Returns the status code of this method. The status code either indicates success or describes a warning condition. """ try: self._session_function_lock.enter_read_lock() updated_selector_string = _helper.validate_and_update_selector_string( selector_string, self._signal_obj ) _helper.validate_not_none(value, "value") error_code = self._interpreter.set_attribute_string( updated_selector_string, attributes.AttributeID.WAVES_SOURCE_PORT.value, value ) finally: self._session_function_lock.exit_read_lock() return error_code
[docs] @_raise_if_disposed def get_format(self, selector_string): r"""Gets the format for wave measurement. Use "wave<*n*>" as the selector string to configure or read this attribute. Use RFmxVNA Waves Fetch Y Data to fetch the waves. The default value is **Magnitude**. +----------------------+--------------------------------------------------------------------------------------------------------------------------+ | Name (Value) | Description | +======================+==========================================================================================================================+ | Magnitude (0) | Sets the format for the selected wave to Magnitude. You can specify Wave Magnitude Units. | +----------------------+--------------------------------------------------------------------------------------------------------------------------+ | Phase (1) | Sets the format of the selected wave to Phase. Phase values are expressed in degrees. Phase can be represented in | | | various, mathematically equivalent ways such as phase wrapped between the range [-180, 180) degrees, or phase can be | | | represented in an unwrapped manner. You can specify the phase representation by configuring Wave Phase Trace Type. | +----------------------+--------------------------------------------------------------------------------------------------------------------------+ | Complex (2) | Sets the format for the selected wave as complex numbers in cartesian co-ordinates. | +----------------------+--------------------------------------------------------------------------------------------------------------------------+ | SWR (3) | Sets the format for the selected wave to Standing Wave Ratio (SWR). SWR is a unitless quantity. | +----------------------+--------------------------------------------------------------------------------------------------------------------------+ | Smith Impedance (4) | Sets the format for the selected wave to Smith Impedance. The measured values of the wave are transformed into | | | impedence values. Impedence values are expressed in ohms. You can use these values to plot on a Smith Chart. | +----------------------+--------------------------------------------------------------------------------------------------------------------------+ | Smith Admittance (5) | Sets the format for the selected wave to Smith Admittance. The measured values of the wave are transformed into | | | admittance values. Admittance values are expressed in siemens. You can use these values to plot on an Inverted Smith | | | Chart. | +----------------------+--------------------------------------------------------------------------------------------------------------------------+ | Polar (6) | Sets the format for the selected wave as complex numbers in polar co-ordinates, where the radial axis (i.e., magnitude | | | of the complex numbers) is always in linear scale and angular axis (phase) is represented in degrees and always wrapped | | | between ±180 deg. | +----------------------+--------------------------------------------------------------------------------------------------------------------------+ | Group Delay (7) | Sets the format of the selected wave to Group Delay. Group delay represents the time it takes for the signal to pass | | | through a device under test. The delay is expressed in seconds. | | | Group delay vs. frequency is derived from phase vs. frequency response. At a given frequency point, group delay is | | | computed by selecting two nearby frequency points and taking the ratio of the phase difference to the frequency | | | separation between them. The frequency separation between the two selected points is called the group delay aperture. | | | You can control the aperture by first configuring Waves Group Delay Aperture Mode and once the mode is selected, you | | | can set the aperture by configuring | | | Waves Group Delay Aperture Points, Waves Group Delay Aperture Percentage or Waves Group Delay Aperture Frequency Span. | | | For example, if the number of aperture points is equal to 3, then group delay at a nth frequency point is computed by | | | selecting the (n-1)th frequency point and (n+1)th frequency point. | +----------------------+--------------------------------------------------------------------------------------------------------------------------+ Args: selector_string (string): Pass an empty string. Returns: Tuple (attr_val, error_code): attr_val (enums.WavesFormat): Specifies the format for wave measurement. error_code (int): Returns the status code of this method. The status code either indicates success or describes a warning condition. """ try: self._session_function_lock.enter_read_lock() updated_selector_string = _helper.validate_and_update_selector_string( selector_string, self._signal_obj ) attr_val, error_code = self._interpreter.get_attribute_i32( updated_selector_string, attributes.AttributeID.WAVES_FORMAT.value ) attr_val = enums.WavesFormat(attr_val) except (KeyError, ValueError): raise errors.DriverTooNewError() # type: ignore finally: self._session_function_lock.exit_read_lock() return attr_val, error_code
[docs] @_raise_if_disposed def set_format(self, selector_string, value): r"""Sets the format for wave measurement. Use "wave<*n*>" as the selector string to configure or read this attribute. Use RFmxVNA Waves Fetch Y Data to fetch the waves. The default value is **Magnitude**. +----------------------+--------------------------------------------------------------------------------------------------------------------------+ | Name (Value) | Description | +======================+==========================================================================================================================+ | Magnitude (0) | Sets the format for the selected wave to Magnitude. You can specify Wave Magnitude Units. | +----------------------+--------------------------------------------------------------------------------------------------------------------------+ | Phase (1) | Sets the format of the selected wave to Phase. Phase values are expressed in degrees. Phase can be represented in | | | various, mathematically equivalent ways such as phase wrapped between the range [-180, 180) degrees, or phase can be | | | represented in an unwrapped manner. You can specify the phase representation by configuring Wave Phase Trace Type. | +----------------------+--------------------------------------------------------------------------------------------------------------------------+ | Complex (2) | Sets the format for the selected wave as complex numbers in cartesian co-ordinates. | +----------------------+--------------------------------------------------------------------------------------------------------------------------+ | SWR (3) | Sets the format for the selected wave to Standing Wave Ratio (SWR). SWR is a unitless quantity. | +----------------------+--------------------------------------------------------------------------------------------------------------------------+ | Smith Impedance (4) | Sets the format for the selected wave to Smith Impedance. The measured values of the wave are transformed into | | | impedence values. Impedence values are expressed in ohms. You can use these values to plot on a Smith Chart. | +----------------------+--------------------------------------------------------------------------------------------------------------------------+ | Smith Admittance (5) | Sets the format for the selected wave to Smith Admittance. The measured values of the wave are transformed into | | | admittance values. Admittance values are expressed in siemens. You can use these values to plot on an Inverted Smith | | | Chart. | +----------------------+--------------------------------------------------------------------------------------------------------------------------+ | Polar (6) | Sets the format for the selected wave as complex numbers in polar co-ordinates, where the radial axis (i.e., magnitude | | | of the complex numbers) is always in linear scale and angular axis (phase) is represented in degrees and always wrapped | | | between ±180 deg. | +----------------------+--------------------------------------------------------------------------------------------------------------------------+ | Group Delay (7) | Sets the format of the selected wave to Group Delay. Group delay represents the time it takes for the signal to pass | | | through a device under test. The delay is expressed in seconds. | | | Group delay vs. frequency is derived from phase vs. frequency response. At a given frequency point, group delay is | | | computed by selecting two nearby frequency points and taking the ratio of the phase difference to the frequency | | | separation between them. The frequency separation between the two selected points is called the group delay aperture. | | | You can control the aperture by first configuring Waves Group Delay Aperture Mode and once the mode is selected, you | | | can set the aperture by configuring | | | Waves Group Delay Aperture Points, Waves Group Delay Aperture Percentage or Waves Group Delay Aperture Frequency Span. | | | For example, if the number of aperture points is equal to 3, then group delay at a nth frequency point is computed by | | | selecting the (n-1)th frequency point and (n+1)th frequency point. | +----------------------+--------------------------------------------------------------------------------------------------------------------------+ Args: selector_string (string): Pass an empty string. value (enums.WavesFormat, int): Specifies the format for wave measurement. Returns: int: Returns the status code of this method. The status code either indicates success or describes a warning condition. """ try: self._session_function_lock.enter_read_lock() updated_selector_string = _helper.validate_and_update_selector_string( selector_string, self._signal_obj ) value = value.value if type(value) is enums.WavesFormat else value error_code = self._interpreter.set_attribute_i32( updated_selector_string, attributes.AttributeID.WAVES_FORMAT.value, value ) finally: self._session_function_lock.exit_read_lock() return error_code
[docs] @_raise_if_disposed def get_magnitude_units(self, selector_string): r"""Gets the magnitude units for all waves for which :py:attr:`~nirfmxvna.attributes.AttributeID.WAVES_FORMAT` attribute is set to **Magnitude**. You do not need to use a selector string to configure or read this attribute for the default signal instance. Refer to the `Selector String <https://www.ni.com/docs/en-US/bundle/rfmx/page/selector-strings-net.html>`_ topic for information about the string syntax for named signals. The default value is **dBm**. +--------------+--------------------------------------+ | Name (Value) | Description | +==============+======================================+ | dBm (0) | Sets wave magnitude units to dBm. | +--------------+--------------------------------------+ | dBmV (1) | Sets wave magnitude units to dBmV. | +--------------+--------------------------------------+ | dBuV (2) | Sets wave magnitude units to dBuV. | +--------------+--------------------------------------+ | dBmA (3) | Sets wave magnitude units to dBmA. | +--------------+--------------------------------------+ | W (4) | Sets wave magnitude units to watts. | +--------------+--------------------------------------+ | V (5) | Sets wave magnitude units to volts. | +--------------+--------------------------------------+ | A (6) | Sets wave magnitude units to ampere. | +--------------+--------------------------------------+ Args: selector_string (string): Pass an empty string. Returns: Tuple (attr_val, error_code): attr_val (enums.WavesMagnitudeUnits): Specifies the magnitude units for all waves for which :py:attr:`~nirfmxvna.attributes.AttributeID.WAVES_FORMAT` attribute is set to **Magnitude**. error_code (int): Returns the status code of this method. The status code either indicates success or describes a warning condition. """ try: self._session_function_lock.enter_read_lock() updated_selector_string = _helper.validate_and_update_selector_string( selector_string, self._signal_obj ) attr_val, error_code = self._interpreter.get_attribute_i32( updated_selector_string, attributes.AttributeID.WAVES_MAGNITUDE_UNITS.value ) attr_val = enums.WavesMagnitudeUnits(attr_val) except (KeyError, ValueError): raise errors.DriverTooNewError() # type: ignore finally: self._session_function_lock.exit_read_lock() return attr_val, error_code
[docs] @_raise_if_disposed def set_magnitude_units(self, selector_string, value): r"""Sets the magnitude units for all waves for which :py:attr:`~nirfmxvna.attributes.AttributeID.WAVES_FORMAT` attribute is set to **Magnitude**. You do not need to use a selector string to configure or read this attribute for the default signal instance. Refer to the `Selector String <https://www.ni.com/docs/en-US/bundle/rfmx/page/selector-strings-net.html>`_ topic for information about the string syntax for named signals. The default value is **dBm**. +--------------+--------------------------------------+ | Name (Value) | Description | +==============+======================================+ | dBm (0) | Sets wave magnitude units to dBm. | +--------------+--------------------------------------+ | dBmV (1) | Sets wave magnitude units to dBmV. | +--------------+--------------------------------------+ | dBuV (2) | Sets wave magnitude units to dBuV. | +--------------+--------------------------------------+ | dBmA (3) | Sets wave magnitude units to dBmA. | +--------------+--------------------------------------+ | W (4) | Sets wave magnitude units to watts. | +--------------+--------------------------------------+ | V (5) | Sets wave magnitude units to volts. | +--------------+--------------------------------------+ | A (6) | Sets wave magnitude units to ampere. | +--------------+--------------------------------------+ Args: selector_string (string): Pass an empty string. value (enums.WavesMagnitudeUnits, int): Specifies the magnitude units for all waves for which :py:attr:`~nirfmxvna.attributes.AttributeID.WAVES_FORMAT` attribute is set to **Magnitude**. Returns: int: Returns the status code of this method. The status code either indicates success or describes a warning condition. """ try: self._session_function_lock.enter_read_lock() updated_selector_string = _helper.validate_and_update_selector_string( selector_string, self._signal_obj ) value = value.value if type(value) is enums.WavesMagnitudeUnits else value error_code = self._interpreter.set_attribute_i32( updated_selector_string, attributes.AttributeID.WAVES_MAGNITUDE_UNITS.value, value ) finally: self._session_function_lock.exit_read_lock() return error_code
[docs] @_raise_if_disposed def get_phase_trace_type(self, selector_string): r"""Gets the phase type for all waves for which :py:attr:`~nirfmxvna.attributes.AttributeID.WAVES_FORMAT` attribute is set to **Phase**. Phase can be represented in two mathematically equivalent ways viz. phase wrapped between the range [-180, 180) degrees, and phase can be represented in an unwrapped manner. You do not need to use a selector string to configure or read this attribute for the default signal instance. Refer to the `Selector String <https://www.ni.com/docs/en-US/bundle/rfmx/page/selector-strings-net.html>`_ topic for information about the string syntax for named signals. The default value is **Wrapped**. +---------------+--------------------------------------------------------------------------+ | Name (Value) | Description | +===============+==========================================================================+ | Wrapped (0) | The reported wave phase is wrapped between -180 degress to +180 degrees. | +---------------+--------------------------------------------------------------------------+ | Unwrapped (1) | The reported wave phase is unwrapped. | +---------------+--------------------------------------------------------------------------+ Args: selector_string (string): Pass an empty string. Returns: Tuple (attr_val, error_code): attr_val (enums.WavesPhaseTraceType): Specifies the phase type for all waves for which :py:attr:`~nirfmxvna.attributes.AttributeID.WAVES_FORMAT` attribute is set to **Phase**. Phase can be represented in two mathematically equivalent ways viz. phase wrapped between the range [-180, 180) degrees, and phase can be represented in an unwrapped manner. error_code (int): Returns the status code of this method. The status code either indicates success or describes a warning condition. """ try: self._session_function_lock.enter_read_lock() updated_selector_string = _helper.validate_and_update_selector_string( selector_string, self._signal_obj ) attr_val, error_code = self._interpreter.get_attribute_i32( updated_selector_string, attributes.AttributeID.WAVES_PHASE_TRACE_TYPE.value ) attr_val = enums.WavesPhaseTraceType(attr_val) except (KeyError, ValueError): raise errors.DriverTooNewError() # type: ignore finally: self._session_function_lock.exit_read_lock() return attr_val, error_code
[docs] @_raise_if_disposed def set_phase_trace_type(self, selector_string, value): r"""Sets the phase type for all waves for which :py:attr:`~nirfmxvna.attributes.AttributeID.WAVES_FORMAT` attribute is set to **Phase**. Phase can be represented in two mathematically equivalent ways viz. phase wrapped between the range [-180, 180) degrees, and phase can be represented in an unwrapped manner. You do not need to use a selector string to configure or read this attribute for the default signal instance. Refer to the `Selector String <https://www.ni.com/docs/en-US/bundle/rfmx/page/selector-strings-net.html>`_ topic for information about the string syntax for named signals. The default value is **Wrapped**. +---------------+--------------------------------------------------------------------------+ | Name (Value) | Description | +===============+==========================================================================+ | Wrapped (0) | The reported wave phase is wrapped between -180 degress to +180 degrees. | +---------------+--------------------------------------------------------------------------+ | Unwrapped (1) | The reported wave phase is unwrapped. | +---------------+--------------------------------------------------------------------------+ Args: selector_string (string): Pass an empty string. value (enums.WavesPhaseTraceType, int): Specifies the phase type for all waves for which :py:attr:`~nirfmxvna.attributes.AttributeID.WAVES_FORMAT` attribute is set to **Phase**. Phase can be represented in two mathematically equivalent ways viz. phase wrapped between the range [-180, 180) degrees, and phase can be represented in an unwrapped manner. Returns: int: Returns the status code of this method. The status code either indicates success or describes a warning condition. """ try: self._session_function_lock.enter_read_lock() updated_selector_string = _helper.validate_and_update_selector_string( selector_string, self._signal_obj ) value = value.value if type(value) is enums.WavesPhaseTraceType else value error_code = self._interpreter.set_attribute_i32( updated_selector_string, attributes.AttributeID.WAVES_PHASE_TRACE_TYPE.value, value ) finally: self._session_function_lock.exit_read_lock() return error_code
[docs] @_raise_if_disposed def get_group_delay_aperture_mode(self, selector_string): r"""Gets the aperture mode to be used for the computation of group delay for all waves for which :py:attr:`~nirfmxvna.attributes.AttributeID.WAVES_FORMAT` attribute is set to **Group Delay**. You do not need to use a selector string to configure or read this attribute for the default signal instance. Refer to the `Selector String <https://www.ni.com/docs/en-US/bundle/rfmx/page/selector-strings-net.html>`_ topic for information about the string syntax for named signals. The default value is **Points**. +--------------------+--------------------------------------------------------------------------------------------------------------------------+ | Name (Value) | Description | +====================+==========================================================================================================================+ | Points (0) | Sets group delay aperture mode to Points. You can specify the aperture in terms of the number of frequency points by | | | configuring Waves Group Delay Aperture Points. | +--------------------+--------------------------------------------------------------------------------------------------------------------------+ | Percentage (1) | Sets group delay aperture mode to Percentage. You can specify the aperture in terms of the frequency separation | | | expressed in percentage by configuring Waves Group Delay Aperture Percentage. | +--------------------+--------------------------------------------------------------------------------------------------------------------------+ | Frequency Span (2) | Sets group delay aperture to Frequency Span. You can specify the aperture in terms of the frequency separation by | | | configuring Waves Group Delay Aperture Frequency Span. | +--------------------+--------------------------------------------------------------------------------------------------------------------------+ Args: selector_string (string): Pass an empty string. Returns: Tuple (attr_val, error_code): attr_val (enums.WavesGroupDelayApertureMode): Specifies the aperture mode to be used for the computation of group delay for all waves for which :py:attr:`~nirfmxvna.attributes.AttributeID.WAVES_FORMAT` attribute is set to **Group Delay**. error_code (int): Returns the status code of this method. The status code either indicates success or describes a warning condition. """ try: self._session_function_lock.enter_read_lock() updated_selector_string = _helper.validate_and_update_selector_string( selector_string, self._signal_obj ) attr_val, error_code = self._interpreter.get_attribute_i32( updated_selector_string, attributes.AttributeID.WAVES_GROUP_DELAY_APERTURE_MODE.value, ) attr_val = enums.WavesGroupDelayApertureMode(attr_val) except (KeyError, ValueError): raise errors.DriverTooNewError() # type: ignore finally: self._session_function_lock.exit_read_lock() return attr_val, error_code
[docs] @_raise_if_disposed def set_group_delay_aperture_mode(self, selector_string, value): r"""Sets the aperture mode to be used for the computation of group delay for all waves for which :py:attr:`~nirfmxvna.attributes.AttributeID.WAVES_FORMAT` attribute is set to **Group Delay**. You do not need to use a selector string to configure or read this attribute for the default signal instance. Refer to the `Selector String <https://www.ni.com/docs/en-US/bundle/rfmx/page/selector-strings-net.html>`_ topic for information about the string syntax for named signals. The default value is **Points**. +--------------------+--------------------------------------------------------------------------------------------------------------------------+ | Name (Value) | Description | +====================+==========================================================================================================================+ | Points (0) | Sets group delay aperture mode to Points. You can specify the aperture in terms of the number of frequency points by | | | configuring Waves Group Delay Aperture Points. | +--------------------+--------------------------------------------------------------------------------------------------------------------------+ | Percentage (1) | Sets group delay aperture mode to Percentage. You can specify the aperture in terms of the frequency separation | | | expressed in percentage by configuring Waves Group Delay Aperture Percentage. | +--------------------+--------------------------------------------------------------------------------------------------------------------------+ | Frequency Span (2) | Sets group delay aperture to Frequency Span. You can specify the aperture in terms of the frequency separation by | | | configuring Waves Group Delay Aperture Frequency Span. | +--------------------+--------------------------------------------------------------------------------------------------------------------------+ Args: selector_string (string): Pass an empty string. value (enums.WavesGroupDelayApertureMode, int): Specifies the aperture mode to be used for the computation of group delay for all waves for which :py:attr:`~nirfmxvna.attributes.AttributeID.WAVES_FORMAT` attribute is set to **Group Delay**. Returns: int: Returns the status code of this method. The status code either indicates success or describes a warning condition. """ try: self._session_function_lock.enter_read_lock() updated_selector_string = _helper.validate_and_update_selector_string( selector_string, self._signal_obj ) value = value.value if type(value) is enums.WavesGroupDelayApertureMode else value error_code = self._interpreter.set_attribute_i32( updated_selector_string, attributes.AttributeID.WAVES_GROUP_DELAY_APERTURE_MODE.value, value, ) finally: self._session_function_lock.exit_read_lock() return error_code
[docs] @_raise_if_disposed def get_group_delay_aperture_points(self, selector_string): r"""Gets the group delay aperture in terms of the number of frequency points that separates the two frequency points for all waves for which :py:attr:`~nirfmxvna.attributes.AttributeID.WAVES_FORMAT` attribute is set to **Group Delay** and :py:attr:`~nirfmxvna.attributes.AttributeID.WAVES_GROUP_DELAY_APERTURE_MODE` attribute is set to **Points**. You must set the value of this attribute between 2 and the total number of frequency points in the measurement frequency range. You do not need to use a selector string to configure or read this attribute for the default signal instance. Refer to the `Selector String <https://www.ni.com/docs/en-US/bundle/rfmx/page/selector-strings-net.html>`_ topic for information about the string syntax for named signals. The default value is 11. Args: selector_string (string): Pass an empty string. Returns: Tuple (attr_val, error_code): attr_val (float): Specifies the group delay aperture in terms of the number of frequency points that separates the two frequency points for all waves for which :py:attr:`~nirfmxvna.attributes.AttributeID.WAVES_FORMAT` attribute is set to **Group Delay** and :py:attr:`~nirfmxvna.attributes.AttributeID.WAVES_GROUP_DELAY_APERTURE_MODE` attribute is set to **Points**. You must set the value of this attribute between 2 and the total number of frequency points in the measurement frequency range. error_code (int): Returns the status code of this method. The status code either indicates success or describes a warning condition. """ try: self._session_function_lock.enter_read_lock() updated_selector_string = _helper.validate_and_update_selector_string( selector_string, self._signal_obj ) attr_val, error_code = self._interpreter.get_attribute_f64( updated_selector_string, attributes.AttributeID.WAVES_GROUP_DELAY_APERTURE_POINTS.value, ) finally: self._session_function_lock.exit_read_lock() return attr_val, error_code
[docs] @_raise_if_disposed def set_group_delay_aperture_points(self, selector_string, value): r"""Sets the group delay aperture in terms of the number of frequency points that separates the two frequency points for all waves for which :py:attr:`~nirfmxvna.attributes.AttributeID.WAVES_FORMAT` attribute is set to **Group Delay** and :py:attr:`~nirfmxvna.attributes.AttributeID.WAVES_GROUP_DELAY_APERTURE_MODE` attribute is set to **Points**. You must set the value of this attribute between 2 and the total number of frequency points in the measurement frequency range. You do not need to use a selector string to configure or read this attribute for the default signal instance. Refer to the `Selector String <https://www.ni.com/docs/en-US/bundle/rfmx/page/selector-strings-net.html>`_ topic for information about the string syntax for named signals. The default value is 11. Args: selector_string (string): Pass an empty string. value (float): Specifies the group delay aperture in terms of the number of frequency points that separates the two frequency points for all waves for which :py:attr:`~nirfmxvna.attributes.AttributeID.WAVES_FORMAT` attribute is set to **Group Delay** and :py:attr:`~nirfmxvna.attributes.AttributeID.WAVES_GROUP_DELAY_APERTURE_MODE` attribute is set to **Points**. You must set the value of this attribute between 2 and the total number of frequency points in the measurement frequency range. Returns: int: Returns the status code of this method. The status code either indicates success or describes a warning condition. """ try: self._session_function_lock.enter_read_lock() updated_selector_string = _helper.validate_and_update_selector_string( selector_string, self._signal_obj ) error_code = self._interpreter.set_attribute_f64( updated_selector_string, attributes.AttributeID.WAVES_GROUP_DELAY_APERTURE_POINTS.value, value, ) finally: self._session_function_lock.exit_read_lock() return error_code
[docs] @_raise_if_disposed def get_group_delay_aperture_percentage(self, selector_string): r"""Gets the group delay aperture in terms of the frequency separation between the two frequency points selected for group delay computation, where separation is expressed as a percentage of the total measurement frequency range for all waves for which :py:attr:`~nirfmxvna.attributes.AttributeID.WAVES_FORMAT` attribute is set to **Group Delay** and :py:attr:`~nirfmxvna.attributes.AttributeID.WAVES_GROUP_DELAY_APERTURE_MODE` attribute is set to **Percentage**. You do not need to use a selector string to configure or read this attribute for the default signal instance. Refer to the `Selector String <https://www.ni.com/docs/en-US/bundle/rfmx/page/selector-strings-net.html>`_ topic for information about the string syntax for named signals. The default value is 5 %. Args: selector_string (string): Pass an empty string. Returns: Tuple (attr_val, error_code): attr_val (float): Specifies the group delay aperture in terms of the frequency separation between the two frequency points selected for group delay computation, where separation is expressed as a percentage of the total measurement frequency range for all waves for which :py:attr:`~nirfmxvna.attributes.AttributeID.WAVES_FORMAT` attribute is set to **Group Delay** and :py:attr:`~nirfmxvna.attributes.AttributeID.WAVES_GROUP_DELAY_APERTURE_MODE` attribute is set to **Percentage**. error_code (int): Returns the status code of this method. The status code either indicates success or describes a warning condition. """ try: self._session_function_lock.enter_read_lock() updated_selector_string = _helper.validate_and_update_selector_string( selector_string, self._signal_obj ) attr_val, error_code = self._interpreter.get_attribute_f64( updated_selector_string, attributes.AttributeID.WAVES_GROUP_DELAY_APERTURE_PERCENTAGE.value, ) finally: self._session_function_lock.exit_read_lock() return attr_val, error_code
[docs] @_raise_if_disposed def set_group_delay_aperture_percentage(self, selector_string, value): r"""Sets the group delay aperture in terms of the frequency separation between the two frequency points selected for group delay computation, where separation is expressed as a percentage of the total measurement frequency range for all waves for which :py:attr:`~nirfmxvna.attributes.AttributeID.WAVES_FORMAT` attribute is set to **Group Delay** and :py:attr:`~nirfmxvna.attributes.AttributeID.WAVES_GROUP_DELAY_APERTURE_MODE` attribute is set to **Percentage**. You do not need to use a selector string to configure or read this attribute for the default signal instance. Refer to the `Selector String <https://www.ni.com/docs/en-US/bundle/rfmx/page/selector-strings-net.html>`_ topic for information about the string syntax for named signals. The default value is 5 %. Args: selector_string (string): Pass an empty string. value (float): Specifies the group delay aperture in terms of the frequency separation between the two frequency points selected for group delay computation, where separation is expressed as a percentage of the total measurement frequency range for all waves for which :py:attr:`~nirfmxvna.attributes.AttributeID.WAVES_FORMAT` attribute is set to **Group Delay** and :py:attr:`~nirfmxvna.attributes.AttributeID.WAVES_GROUP_DELAY_APERTURE_MODE` attribute is set to **Percentage**. Returns: int: Returns the status code of this method. The status code either indicates success or describes a warning condition. """ try: self._session_function_lock.enter_read_lock() updated_selector_string = _helper.validate_and_update_selector_string( selector_string, self._signal_obj ) error_code = self._interpreter.set_attribute_f64( updated_selector_string, attributes.AttributeID.WAVES_GROUP_DELAY_APERTURE_PERCENTAGE.value, value, ) finally: self._session_function_lock.exit_read_lock() return error_code
[docs] @_raise_if_disposed def get_group_delay_aperture_frequency_span(self, selector_string): r"""Gets the group delay aperture in terms of the frequency separation between the two frequency points selected for group delay computation for all waves for which :py:attr:`~nirfmxvna.attributes.AttributeID.WAVES_FORMAT` attribute is set to **Group Delay** and :py:attr:`~nirfmxvna.attributes.AttributeID.WAVES_GROUP_DELAY_APERTURE_MODE` attribute is set to **Frequency Span**. You do not need to use a selector string to configure or read this attribute for the default signal instance. Refer to the `Selector String <https://www.ni.com/docs/en-US/bundle/rfmx/page/selector-strings-net.html>`_ topic for information about the string syntax for named signals. The default value is 50 MHz. Args: selector_string (string): Pass an empty string. Returns: Tuple (attr_val, error_code): attr_val (float): Specifies the group delay aperture in terms of the frequency separation between the two frequency points selected for group delay computation for all waves for which :py:attr:`~nirfmxvna.attributes.AttributeID.WAVES_FORMAT` attribute is set to **Group Delay** and :py:attr:`~nirfmxvna.attributes.AttributeID.WAVES_GROUP_DELAY_APERTURE_MODE` attribute is set to **Frequency Span**. error_code (int): Returns the status code of this method. The status code either indicates success or describes a warning condition. """ try: self._session_function_lock.enter_read_lock() updated_selector_string = _helper.validate_and_update_selector_string( selector_string, self._signal_obj ) attr_val, error_code = self._interpreter.get_attribute_f64( updated_selector_string, attributes.AttributeID.WAVES_GROUP_DELAY_APERTURE_FREQUENCY_SPAN.value, ) finally: self._session_function_lock.exit_read_lock() return attr_val, error_code
[docs] @_raise_if_disposed def set_group_delay_aperture_frequency_span(self, selector_string, value): r"""Sets the group delay aperture in terms of the frequency separation between the two frequency points selected for group delay computation for all waves for which :py:attr:`~nirfmxvna.attributes.AttributeID.WAVES_FORMAT` attribute is set to **Group Delay** and :py:attr:`~nirfmxvna.attributes.AttributeID.WAVES_GROUP_DELAY_APERTURE_MODE` attribute is set to **Frequency Span**. You do not need to use a selector string to configure or read this attribute for the default signal instance. Refer to the `Selector String <https://www.ni.com/docs/en-US/bundle/rfmx/page/selector-strings-net.html>`_ topic for information about the string syntax for named signals. The default value is 50 MHz. Args: selector_string (string): Pass an empty string. value (float): Specifies the group delay aperture in terms of the frequency separation between the two frequency points selected for group delay computation for all waves for which :py:attr:`~nirfmxvna.attributes.AttributeID.WAVES_FORMAT` attribute is set to **Group Delay** and :py:attr:`~nirfmxvna.attributes.AttributeID.WAVES_GROUP_DELAY_APERTURE_MODE` attribute is set to **Frequency Span**. Returns: int: Returns the status code of this method. The status code either indicates success or describes a warning condition. """ try: self._session_function_lock.enter_read_lock() updated_selector_string = _helper.validate_and_update_selector_string( selector_string, self._signal_obj ) error_code = self._interpreter.set_attribute_f64( updated_selector_string, attributes.AttributeID.WAVES_GROUP_DELAY_APERTURE_FREQUENCY_SPAN.value, value, ) finally: self._session_function_lock.exit_read_lock() return error_code
[docs] @_raise_if_disposed def configure_wave(self, selector_string, wave): r"""Configures the wave to be measured in format a<*receiver port number*><*source port number*> or b<*receiver port number*><*source port number*>, where 'a' specifies that the receiver is reference receiver and 'b' specifies that the receiver is test receiver. Use "wave<*n*>" as the selector string to configure this method. **Supported devices**: NI PXIe-5633 Args: selector_string (string): This parameter specifies a selector string comprising of result name, and wave number. "wave0" "signal::sig1/wave0" "result::r1/wave0" "signal::sig1/result::r1/wave0" You can use the :py:meth:`build_wave_string` method to build the selector string. wave (string): This parameter specifies the wave to be measured in format a<*receiver port number*><*source port number*> or b<*receiver port number*><*source port number*>, where 'a' specifies that the receiver is reference receiver and 'b' specifies that the receiver is test receiver. Returns: int: Returns the status code of this method. The status code either indicates success or describes a warning condition. """ try: self._session_function_lock.enter_read_lock() _helper.validate_not_none(selector_string, "selector_string") _helper.validate_not_none(wave, "wave") updated_selector_string = _helper.validate_and_update_selector_string( selector_string, self._signal_obj ) error_code = self._interpreter.waves_configure_wave(updated_selector_string, wave) finally: self._session_function_lock.exit_read_lock() return error_code
[docs] @_raise_if_disposed def get_wave(self, selector_string): r"""Returns the wave being measured in format a(receiver port number)(source port number) or b(receiver port number)(source port number), where "a" specifies that the receiver is reference receiver and "b" specifies that the receiver is test receiver. Use "wave(n)" as the selector string for this method. **Supported devices**: NI PXIe-5633 Args: selector_string (string): This parameter specifies a selector string comprising of result name, and wave number. \"wave0\" \"signal::sig1/wave0\" \"result::r1/wave0\" \"signal::sig1/result::r1/wave0\" You can use the :py:meth:`build_wave_string` method to build the selector string. Returns: Tuple (wave, error_code): wave (string): This parameter returns the wave being measured in format a<*receiver port number*><*source port number*> or b<*receiver port number*><*source port number*>, where "a" specifies that the receiver is reference receiver and "b" specifies that the receiver is test receiver. error_code (int): Returns the status code of this method. The status code either indicates success or describes a warning condition. """ try: self._session_function_lock.enter_read_lock() _helper.validate_not_none(selector_string, "selector_string") updated_selector_string = _helper.validate_and_update_selector_string( selector_string, self._signal_obj ) wave, error_code = self._interpreter.get_wave(updated_selector_string) finally: self._session_function_lock.exit_read_lock() return wave, error_code