Source code for nirfmxgsm.orfs_results

"""Provides methods to fetch and read the Orfs measurement results."""

import functools

import nirfmxgsm.errors as errors
import nirfmxgsm.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 Gsm signal configuration")
        return f(*xs, **kws)

    return aux


[docs] class OrfsResults(object): """Provides methods to fetch and read the Orfs measurement results.""" def __init__(self, signal_obj): """Provides methods to fetch and read the Orfs measurement results.""" self._signal_obj = signal_obj self._session_function_lock = signal_obj._session_function_lock self._interpreter = signal_obj._interpreter
[docs] @_raise_if_disposed def fetch_modulation_power_trace(self, selector_string, timeout): r"""Fetches the modulation power trace and frequency offset. Args: selector_string (string): This parameter specifies a `Selector String <https://www.ni.com/docs/en-US/bundle/rfmx/page/selector-strings-net.html>`_ comprising of result name. The default is "" (empty string). Example: "result::r1" You can use the :py:meth:`build_result_string` method to build the selector string. timeout (float): This parameter specifies the timeout for fetching the specified measurement. This value is expressed in seconds. Set this value to an appropriate time, longer than expected for fetching the measurement. A value of -1 specifies that the method waits until the measurement is complete. The default value is 10. Returns: Tuple (offset_frequency, absolute_power, relative_power, error_code): offset_frequency (float): This parameter returns an array of modulation offset frequencies at which the measurement is performed in an ascending order. This value is expressed in Hz. absolute_power (float): This parameter returns an array of absolute powers corresponding to the modulation offset frequency list. This value is expressed in dBm. relative_power (float): This parameter returns an array of relative powers corresponding to modulation offset frequency list. This value is expressed in dB. 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 ) offset_frequency, absolute_power, relative_power, error_code = ( self._interpreter.orfs_fetch_modulation_power_trace( updated_selector_string, timeout ) ) finally: self._session_function_lock.exit_read_lock() return offset_frequency, absolute_power, relative_power, error_code
[docs] @_raise_if_disposed def fetch_modulation_results_array(self, selector_string, timeout): r"""Returns the modulation carrier power, absolute powers, and relative powers measured at the modulation offset frequencies. The relative powers are measured relative to the integrated modulation power of the carrier. Args: selector_string (string): This parameter specifies a `Selector String <https://www.ni.com/docs/en-US/bundle/rfmx/page/selector-strings-net.html>`_ comprising of result name. The default is "" (empty string). Example: "result::r1" You can use the :py:meth:`build_result_string` method to build the selector string. timeout (float): This parameter specifies the timeout for fetching the specified measurement. This value is expressed in seconds. Set this value to an appropriate time, longer than expected for fetching the measurement. A value of -1 specifies that the method waits until the measurement is complete. The default value is 10. Returns: Tuple (modulation_carrier_power, lower_relative_power, upper_relative_power, lower_absolute_power, upper_absolute_power, error_code): modulation_carrier_power (float): This parameter returns the modulation carrier power. This value is expressed in dBm. lower_relative_power (float): This parameter returns an array of relative powers measured at the negative modulation offset frequencies. This value is expressed in dB. The relative powers are measured relative to the integrated modulation power of the carrier. upper_relative_power (float): This parameter returns an array of relative powers measured at the positive modulation offset frequencies. This value is expressed in dB. The relative powers are measured relative to the integrated modulation power of the carrier. lower_absolute_power (float): This parameter returns an array of absolute powers measured at the negative modulation offset frequencies. This value is expressed in dBm. upper_absolute_power (float): This parameter returns an array of absolute powers measured at the positive modulation offset frequencies. This value is expressed in dBm. 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 ) ( modulation_carrier_power, lower_relative_power, upper_relative_power, lower_absolute_power, upper_absolute_power, error_code, ) = self._interpreter.orfs_fetch_modulation_results_array( updated_selector_string, timeout ) finally: self._session_function_lock.exit_read_lock() return ( modulation_carrier_power, lower_relative_power, upper_relative_power, lower_absolute_power, upper_absolute_power, error_code, )
[docs] @_raise_if_disposed def fetch_switching_power_trace(self, selector_string, timeout): r"""Fetches the switching power trace and frequency offsets. Args: selector_string (string): This parameter specifies a `Selector String <https://www.ni.com/docs/en-US/bundle/rfmx/page/selector-strings-net.html>`_ comprising of result name. The default is "" (empty string). Example: "result::r1" You can use the :py:meth:`build_result_string` method to build the selector string. timeout (float): This parameter specifies the timeout for fetching the specified measurement. This value is expressed in seconds. Set this value to an appropriate time, longer than expected for fetching the measurement. A value of -1 specifies that the method waits until the measurement is complete. The default value is 10. Returns: Tuple (offset_frequency, absolute_power, relative_power, error_code): offset_frequency (float): This parameter returns an array of switching offset frequencies at which the measurement is performed in an ascending order. This value is expressed in Hz. absolute_power (float): This parameter returns an array of absolute powers corresponding to the switching offset frequency list. This value is expressed in dBm. relative_power (float): This parameter returns an array of relative powers corresponding to the switching offset frequencies. This value is expressed in dB. 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 ) offset_frequency, absolute_power, relative_power, error_code = ( self._interpreter.orfs_fetch_switching_power_trace(updated_selector_string, timeout) ) finally: self._session_function_lock.exit_read_lock() return offset_frequency, absolute_power, relative_power, error_code
[docs] @_raise_if_disposed def fetch_switching_results_array(self, selector_string, timeout): r"""Fetches the switching carrier power, absolute powers, and relative powers measured at the switching offset frequencies. The relative powers are measured relative to the integrated switching power of the carrier. Args: selector_string (string): This parameter specifies a `Selector String <https://www.ni.com/docs/en-US/bundle/rfmx/page/selector-strings-net.html>`_ comprising of result name. The default is "" (empty string). Example: "result::r1" You can use the :py:meth:`build_result_string` method to build the selector string. timeout (float): This parameter specifies the timeout for fetching the specified measurement. This value is expressed in seconds. Set this value to an appropriate time, longer than expected for fetching the measurement. A value of -1 specifies that the method waits until the measurement is complete. The default value is 10. Returns: Tuple (switching_carrier_power, lower_relative_power, upper_relative_power, lower_absolute_power, upper_absolute_power, error_code): switching_carrier_power (float): This parameter returns the switching carrier power. This value is expressed in dBm. lower_relative_power (float): This parameter returns an array of relative powers measured at the negative switching offset frequencies. This value is expressed in dB. The relative powers are measured relative to the integrated switching power of the carrier. upper_relative_power (float): This parameter returns an array of relative powers measured at the positive switching offset frequencies. This value is expressed in dB. The relative powers are measured relative to the integrated switching power of the carrier. lower_absolute_power (float): This parameter returns an array of absolute powers measured at the negative switching offset frequencies. This value is expressed in dBm. upper_absolute_power (float): This parameter returns an array of absolute powers measured at the positive switching offset frequencies. This value is expressed in dBm. 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 ) ( switching_carrier_power, lower_relative_power, upper_relative_power, lower_absolute_power, upper_absolute_power, error_code, ) = self._interpreter.orfs_fetch_switching_results_array( updated_selector_string, timeout ) finally: self._session_function_lock.exit_read_lock() return ( switching_carrier_power, lower_relative_power, upper_relative_power, lower_absolute_power, upper_absolute_power, error_code, )