"""Provides methods to configure the ADemod measurement."""
import functools
import nirfmxdemod.attributes as attributes
import nirfmxdemod.enums as enums
import nirfmxdemod.errors as errors
import nirfmxdemod.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 Demod signal configuration")
return f(*xs, **kws)
return aux
[docs]
class ADemodConfiguration(object):
"""Provides methods to configure the ADemod measurement."""
def __init__(self, signal_obj):
"""Provides methods to configure the ADemod 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 analog demodulation measurements.
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 analog demodulation measurements.
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.ADEMOD_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 analog demodulation measurements.
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 analog demodulation measurements.
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.ADEMOD_MEASUREMENT_ENABLED.value,
int(value),
)
finally:
self._session_function_lock.exit_read_lock()
return error_code
[docs]
@_raise_if_disposed
def get_audio_measurement_enabled(self, selector_string):
r"""Gets whether to enable the audio signal measurements, such as SINAD, SNR, THD and THD+Noise.
The default value is **True**.
+--------------+----------------------------------+
| Name (Value) | Description |
+==============+==================================+
| False (0) | Disables the audio measurements. |
+--------------+----------------------------------+
| True (1) | Enables the audio measurements. |
+--------------+----------------------------------+
Args:
selector_string (string):
Pass an empty string.
Returns:
Tuple (attr_val, error_code):
attr_val (enums.ADemodAudioMeasurementEnabled):
Specifies whether to enable the audio signal measurements, such as SINAD, SNR, THD and THD+Noise.
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.ADEMOD_AUDIO_MEASUREMENT_ENABLED.value,
)
attr_val = enums.ADemodAudioMeasurementEnabled(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_audio_measurement_enabled(self, selector_string, value):
r"""Sets whether to enable the audio signal measurements, such as SINAD, SNR, THD and THD+Noise.
The default value is **True**.
+--------------+----------------------------------+
| Name (Value) | Description |
+==============+==================================+
| False (0) | Disables the audio measurements. |
+--------------+----------------------------------+
| True (1) | Enables the audio measurements. |
+--------------+----------------------------------+
Args:
selector_string (string):
Pass an empty string.
value (enums.ADemodAudioMeasurementEnabled, int):
Specifies whether to enable the audio signal measurements, such as SINAD, SNR, THD and THD+Noise.
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.ADemodAudioMeasurementEnabled else value
error_code = self._interpreter.set_attribute_i32(
updated_selector_string,
attributes.AttributeID.ADEMOD_AUDIO_MEASUREMENT_ENABLED.value,
value,
)
finally:
self._session_function_lock.exit_read_lock()
return error_code
[docs]
@_raise_if_disposed
def get_modulation_type(self, selector_string):
r"""Gets the analog modulation type of the signal that needs to be analyzed.
The default value is **AM**.
+--------------+---------------------------------------------------+
| Name (Value) | Description |
+==============+===================================================+
| AM (0) | The signal to be analyzed is amplitude modulated. |
+--------------+---------------------------------------------------+
| FM (1) | The signal to be analyzed is frequency modulated. |
+--------------+---------------------------------------------------+
| PM (2) | The signal to be analyzed is phase modulated. |
+--------------+---------------------------------------------------+
Args:
selector_string (string):
Pass an empty string.
Returns:
Tuple (attr_val, error_code):
attr_val (enums.ADemodModulationType):
Specifies the analog modulation type of the signal that needs to be analyzed.
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.ADEMOD_MODULATION_TYPE.value
)
attr_val = enums.ADemodModulationType(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_modulation_type(self, selector_string, value):
r"""Sets the analog modulation type of the signal that needs to be analyzed.
The default value is **AM**.
+--------------+---------------------------------------------------+
| Name (Value) | Description |
+==============+===================================================+
| AM (0) | The signal to be analyzed is amplitude modulated. |
+--------------+---------------------------------------------------+
| FM (1) | The signal to be analyzed is frequency modulated. |
+--------------+---------------------------------------------------+
| PM (2) | The signal to be analyzed is phase modulated. |
+--------------+---------------------------------------------------+
Args:
selector_string (string):
Pass an empty string.
value (enums.ADemodModulationType, int):
Specifies the analog modulation type of the signal that needs to be analyzed.
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.ADemodModulationType else value
error_code = self._interpreter.set_attribute_i32(
updated_selector_string, attributes.AttributeID.ADEMOD_MODULATION_TYPE.value, value
)
finally:
self._session_function_lock.exit_read_lock()
return error_code
[docs]
@_raise_if_disposed
def get_am_carrier_suppressed(self, selector_string):
r"""Gets whether the carrier of the AM (amplitude modulated) signal is absent.
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**.
+--------------+------------------------------------------+
| Name (Value) | Description |
+==============+==========================================+
| False (0) | The carrier of the AM signal is present. |
+--------------+------------------------------------------+
| True (1) | The carrier of the AM signal is absent. |
+--------------+------------------------------------------+
Args:
selector_string (string):
Pass an empty string.
Returns:
Tuple (attr_val, error_code):
attr_val (enums.ADemodAMCarrierSuppressedEnabled):
Specifies whether the carrier of the AM (amplitude modulated) signal is absent.
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.ADEMOD_AM_CARRIER_SUPPRESSED.value
)
attr_val = enums.ADemodAMCarrierSuppressedEnabled(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_am_carrier_suppressed(self, selector_string, value):
r"""Sets whether the carrier of the AM (amplitude modulated) signal is absent.
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**.
+--------------+------------------------------------------+
| Name (Value) | Description |
+==============+==========================================+
| False (0) | The carrier of the AM signal is present. |
+--------------+------------------------------------------+
| True (1) | The carrier of the AM signal is absent. |
+--------------+------------------------------------------+
Args:
selector_string (string):
Pass an empty string.
value (enums.ADemodAMCarrierSuppressedEnabled, int):
Specifies whether the carrier of the AM (amplitude modulated) signal is absent.
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.ADemodAMCarrierSuppressedEnabled else value
error_code = self._interpreter.set_attribute_i32(
updated_selector_string,
attributes.AttributeID.ADEMOD_AM_CARRIER_SUPPRESSED.value,
value,
)
finally:
self._session_function_lock.exit_read_lock()
return error_code
[docs]
@_raise_if_disposed
def get_rbw_filter_type(self, selector_string):
r"""Gets the shape of the digital RBW filter.
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 **Flat**.
+---------------------+------------------------------------------------------------------------------------------------------+
| Name (Value) | Description |
+=====================+======================================================================================================+
| None (0) | RBW filter is not applied on the acquired signal. |
+---------------------+------------------------------------------------------------------------------------------------------+
| Gaussian (1) | RBW filter has a Gaussian response. |
+---------------------+------------------------------------------------------------------------------------------------------+
| Flat (2) | RBW filter has a Flat response. |
+---------------------+------------------------------------------------------------------------------------------------------+
| Synch Tuned - 4 (3) | RBW filter has a response of a 4-pole synchronously-tuned filter. |
+---------------------+------------------------------------------------------------------------------------------------------+
| Synch Tuned - 5 (4) | RBW filter has a response of a 5-pole synchronously-tuned filter. |
+---------------------+------------------------------------------------------------------------------------------------------+
| RRC (5) | RRC |
| | filter with roll-off specified by the ADemod RBW RRC Alpha attribute is used as the RBW filter. |
+---------------------+------------------------------------------------------------------------------------------------------+
Args:
selector_string (string):
Pass an empty string.
Returns:
Tuple (attr_val, error_code):
attr_val (enums.ADemodRbwFilterType):
Specifies the shape of the digital RBW filter.
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.ADEMOD_RBW_FILTER_TYPE.value
)
attr_val = enums.ADemodRbwFilterType(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_rbw_filter_type(self, selector_string, value):
r"""Sets the shape of the digital RBW filter.
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 **Flat**.
+---------------------+------------------------------------------------------------------------------------------------------+
| Name (Value) | Description |
+=====================+======================================================================================================+
| None (0) | RBW filter is not applied on the acquired signal. |
+---------------------+------------------------------------------------------------------------------------------------------+
| Gaussian (1) | RBW filter has a Gaussian response. |
+---------------------+------------------------------------------------------------------------------------------------------+
| Flat (2) | RBW filter has a Flat response. |
+---------------------+------------------------------------------------------------------------------------------------------+
| Synch Tuned - 4 (3) | RBW filter has a response of a 4-pole synchronously-tuned filter. |
+---------------------+------------------------------------------------------------------------------------------------------+
| Synch Tuned - 5 (4) | RBW filter has a response of a 5-pole synchronously-tuned filter. |
+---------------------+------------------------------------------------------------------------------------------------------+
| RRC (5) | RRC |
| | filter with roll-off specified by the ADemod RBW RRC Alpha attribute is used as the RBW filter. |
+---------------------+------------------------------------------------------------------------------------------------------+
Args:
selector_string (string):
Pass an empty string.
value (enums.ADemodRbwFilterType, int):
Specifies the shape of the digital RBW filter.
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.ADemodRbwFilterType else value
error_code = self._interpreter.set_attribute_i32(
updated_selector_string, attributes.AttributeID.ADEMOD_RBW_FILTER_TYPE.value, value
)
finally:
self._session_function_lock.exit_read_lock()
return error_code
[docs]
@_raise_if_disposed
def get_rbw_filter_bandwidth(self, selector_string):
r"""Gets the bandwidth of the resolution bandwidth (RBW) filter to be applied to the acquired signal. This value is
expressed in Hz.
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 100 kHz.
Args:
selector_string (string):
Pass an empty string.
Returns:
Tuple (attr_val, error_code):
attr_val (float):
Specifies the bandwidth of the resolution bandwidth (RBW) filter to be applied to the acquired signal. This value is
expressed in Hz.
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.ADEMOD_RBW_FILTER_BANDWIDTH.value
)
finally:
self._session_function_lock.exit_read_lock()
return attr_val, error_code
[docs]
@_raise_if_disposed
def set_rbw_filter_bandwidth(self, selector_string, value):
r"""Sets the bandwidth of the resolution bandwidth (RBW) filter to be applied to the acquired signal. This value is
expressed in Hz.
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 100 kHz.
Args:
selector_string (string):
Pass an empty string.
value (float):
Specifies the bandwidth of the resolution bandwidth (RBW) filter to be applied to the acquired signal. This value is
expressed in Hz.
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.ADEMOD_RBW_FILTER_BANDWIDTH.value,
value,
)
finally:
self._session_function_lock.exit_read_lock()
return error_code
[docs]
@_raise_if_disposed
def get_rbw_filter_alpha(self, selector_string):
r"""Gets the roll-off factor of the root-raised cosine (RRC) filter.
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 0.1.
Args:
selector_string (string):
Pass an empty string.
Returns:
Tuple (attr_val, error_code):
attr_val (float):
Specifies the roll-off factor of the root-raised cosine (RRC) filter.
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.ADEMOD_RBW_FILTER_ALPHA.value
)
finally:
self._session_function_lock.exit_read_lock()
return attr_val, error_code
[docs]
@_raise_if_disposed
def set_rbw_filter_alpha(self, selector_string, value):
r"""Sets the roll-off factor of the root-raised cosine (RRC) filter.
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 0.1.
Args:
selector_string (string):
Pass an empty string.
value (float):
Specifies the roll-off factor of the root-raised cosine (RRC) filter.
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.ADEMOD_RBW_FILTER_ALPHA.value, value
)
finally:
self._session_function_lock.exit_read_lock()
return error_code
[docs]
@_raise_if_disposed
def get_measurement_interval(self, selector_string):
r"""Gets the signal acquisition time for the analog demodulation measurement. This value is expressed in seconds.
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 10 ms.
Args:
selector_string (string):
Pass an empty string.
Returns:
Tuple (attr_val, error_code):
attr_val (float):
Specifies the signal acquisition time for the analog demodulation measurement. This value is expressed in seconds.
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.ADEMOD_MEASUREMENT_INTERVAL.value
)
finally:
self._session_function_lock.exit_read_lock()
return attr_val, error_code
[docs]
@_raise_if_disposed
def set_measurement_interval(self, selector_string, value):
r"""Sets the signal acquisition time for the analog demodulation measurement. This value is expressed in seconds.
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 10 ms.
Args:
selector_string (string):
Pass an empty string.
value (float):
Specifies the signal acquisition time for the analog demodulation measurement. This value is expressed in seconds.
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.ADEMOD_MEASUREMENT_INTERVAL.value,
value,
)
finally:
self._session_function_lock.exit_read_lock()
return error_code
[docs]
@_raise_if_disposed
def get_carrier_correction_frequency_enabled(self, selector_string):
r"""Gets whether to correct the frequency error in the carrier when demodulating frequency-modulated (FM) or
phase-modulated (PM) signals.
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 **True**.
+--------------+-----------------------------------------------+
| Name (Value) | Description |
+==============+===============================================+
| False (0) | Does not correct the carrier frequency error. |
+--------------+-----------------------------------------------+
| True (1) | Corrects the carrier frequency error. |
+--------------+-----------------------------------------------+
Args:
selector_string (string):
Pass an empty string.
Returns:
Tuple (attr_val, error_code):
attr_val (enums.ADemodCarrierFrequencyCorrectionEnabled):
Specifies whether to correct the frequency error in the carrier when demodulating frequency-modulated (FM) or
phase-modulated (PM) signals.
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.ADEMOD_CARRIER_CORRECTION_FREQUENCY_ENABLED.value,
)
attr_val = enums.ADemodCarrierFrequencyCorrectionEnabled(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_carrier_correction_frequency_enabled(self, selector_string, value):
r"""Sets whether to correct the frequency error in the carrier when demodulating frequency-modulated (FM) or
phase-modulated (PM) signals.
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 **True**.
+--------------+-----------------------------------------------+
| Name (Value) | Description |
+==============+===============================================+
| False (0) | Does not correct the carrier frequency error. |
+--------------+-----------------------------------------------+
| True (1) | Corrects the carrier frequency error. |
+--------------+-----------------------------------------------+
Args:
selector_string (string):
Pass an empty string.
value (enums.ADemodCarrierFrequencyCorrectionEnabled, int):
Specifies whether to correct the frequency error in the carrier when demodulating frequency-modulated (FM) or
phase-modulated (PM) signals.
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.ADemodCarrierFrequencyCorrectionEnabled
else value
)
error_code = self._interpreter.set_attribute_i32(
updated_selector_string,
attributes.AttributeID.ADEMOD_CARRIER_CORRECTION_FREQUENCY_ENABLED.value,
value,
)
finally:
self._session_function_lock.exit_read_lock()
return error_code
[docs]
@_raise_if_disposed
def get_carrier_correction_phase_enabled(self, selector_string):
r"""Gets whether to correct the carrier phase error when demodulating phase-modulated signals.
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 **True**.
+--------------+-------------------------------------------+
| Name (Value) | Description |
+==============+===========================================+
| False (0) | Does not correct the carrier phase error. |
+--------------+-------------------------------------------+
| True (1) | Corrects the carrier phase error. |
+--------------+-------------------------------------------+
Args:
selector_string (string):
Pass an empty string.
Returns:
Tuple (attr_val, error_code):
attr_val (enums.ADemodCarrierPhaseCorrectionEnabled):
Specifies whether to correct the carrier phase error when demodulating phase-modulated signals.
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.ADEMOD_CARRIER_CORRECTION_PHASE_ENABLED.value,
)
attr_val = enums.ADemodCarrierPhaseCorrectionEnabled(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_carrier_correction_phase_enabled(self, selector_string, value):
r"""Sets whether to correct the carrier phase error when demodulating phase-modulated signals.
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 **True**.
+--------------+-------------------------------------------+
| Name (Value) | Description |
+==============+===========================================+
| False (0) | Does not correct the carrier phase error. |
+--------------+-------------------------------------------+
| True (1) | Corrects the carrier phase error. |
+--------------+-------------------------------------------+
Args:
selector_string (string):
Pass an empty string.
value (enums.ADemodCarrierPhaseCorrectionEnabled, int):
Specifies whether to correct the carrier phase error when demodulating phase-modulated signals.
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.ADemodCarrierPhaseCorrectionEnabled else value
)
error_code = self._interpreter.set_attribute_i32(
updated_selector_string,
attributes.AttributeID.ADEMOD_CARRIER_CORRECTION_PHASE_ENABLED.value,
value,
)
finally:
self._session_function_lock.exit_read_lock()
return error_code
[docs]
@_raise_if_disposed
def get_fm_de_emphasis(self, selector_string):
r"""Gets the time constant of de-emphasis filter, which compensates for the pre-emphasis filter in the FM transmitter.
This value is expressed in seconds.
The lowpass characteristic transfer function of the de-emphasis filter is as shown in the following equation:
*H*(*f*) = 1/(1+*j*(2*pi**f**Ï„)
where Ï„ is the de-emphasis filter time constant. This value is expressed in seconds.
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 0 seconds. No filter is applied on the demodulated signal when de-emphasis is set to 0.
Args:
selector_string (string):
Pass an empty string.
Returns:
Tuple (attr_val, error_code):
attr_val (float):
Specifies the time constant of de-emphasis filter, which compensates for the pre-emphasis filter in the FM transmitter.
This value is expressed in seconds.
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.ADEMOD_FM_DE_EMPHASIS.value
)
finally:
self._session_function_lock.exit_read_lock()
return attr_val, error_code
[docs]
@_raise_if_disposed
def set_fm_de_emphasis(self, selector_string, value):
r"""Sets the time constant of de-emphasis filter, which compensates for the pre-emphasis filter in the FM transmitter.
This value is expressed in seconds.
The lowpass characteristic transfer function of the de-emphasis filter is as shown in the following equation:
*H*(*f*) = 1/(1+*j*(2*pi**f**Ï„)
where Ï„ is the de-emphasis filter time constant. This value is expressed in seconds.
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 0 seconds. No filter is applied on the demodulated signal when de-emphasis is set to 0.
Args:
selector_string (string):
Pass an empty string.
value (float):
Specifies the time constant of de-emphasis filter, which compensates for the pre-emphasis filter in the FM transmitter.
This value is expressed in seconds.
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.ADEMOD_FM_DE_EMPHASIS.value, value
)
finally:
self._session_function_lock.exit_read_lock()
return error_code
[docs]
@_raise_if_disposed
def get_audio_filter_type(self, selector_string):
r"""Gets the audio filter to be applied on the analog demodulated signal.
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 **None**.
+-----------------+--------------------------------------------------------------------------------------------------------------------------+
| Name (Value) | Description |
+=================+==========================================================================================================================+
| None (0) | Does not use any audio filter. |
+-----------------+--------------------------------------------------------------------------------------------------------------------------+
| Custom (1) | Uses the filter specified by the Ademod Audio Filter Lower Cutoff attribute and the Ademod Audio Filter Upper Cutoff |
| | attribute. |
+-----------------+--------------------------------------------------------------------------------------------------------------------------+
| A - Weight (2) | Uses an A-weighted filter. |
+-----------------+--------------------------------------------------------------------------------------------------------------------------+
| B - Weight (3) | Uses a B-weighted filter. |
+-----------------+--------------------------------------------------------------------------------------------------------------------------+
| C - Weight (4) | Uses a C-weighted filter. |
+-----------------+--------------------------------------------------------------------------------------------------------------------------+
| CCITT (5) | Uses the filter specified by CCITT. |
+-----------------+--------------------------------------------------------------------------------------------------------------------------+
| ITU-R 468-4 (6) | Uses the filter specified by ITU-R 468-4. |
+-----------------+--------------------------------------------------------------------------------------------------------------------------+
Args:
selector_string (string):
Pass an empty string.
Returns:
Tuple (attr_val, error_code):
attr_val (enums.ADemodAudioFilterType):
Specifies the audio filter to be applied on the analog demodulated signal.
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.ADEMOD_AUDIO_FILTER_TYPE.value
)
attr_val = enums.ADemodAudioFilterType(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_audio_filter_type(self, selector_string, value):
r"""Sets the audio filter to be applied on the analog demodulated signal.
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 **None**.
+-----------------+--------------------------------------------------------------------------------------------------------------------------+
| Name (Value) | Description |
+=================+==========================================================================================================================+
| None (0) | Does not use any audio filter. |
+-----------------+--------------------------------------------------------------------------------------------------------------------------+
| Custom (1) | Uses the filter specified by the Ademod Audio Filter Lower Cutoff attribute and the Ademod Audio Filter Upper Cutoff |
| | attribute. |
+-----------------+--------------------------------------------------------------------------------------------------------------------------+
| A - Weight (2) | Uses an A-weighted filter. |
+-----------------+--------------------------------------------------------------------------------------------------------------------------+
| B - Weight (3) | Uses a B-weighted filter. |
+-----------------+--------------------------------------------------------------------------------------------------------------------------+
| C - Weight (4) | Uses a C-weighted filter. |
+-----------------+--------------------------------------------------------------------------------------------------------------------------+
| CCITT (5) | Uses the filter specified by CCITT. |
+-----------------+--------------------------------------------------------------------------------------------------------------------------+
| ITU-R 468-4 (6) | Uses the filter specified by ITU-R 468-4. |
+-----------------+--------------------------------------------------------------------------------------------------------------------------+
Args:
selector_string (string):
Pass an empty string.
value (enums.ADemodAudioFilterType, int):
Specifies the audio filter to be applied on the analog demodulated signal.
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.ADemodAudioFilterType else value
error_code = self._interpreter.set_attribute_i32(
updated_selector_string,
attributes.AttributeID.ADEMOD_AUDIO_FILTER_TYPE.value,
value,
)
finally:
self._session_function_lock.exit_read_lock()
return error_code
[docs]
@_raise_if_disposed
def get_audio_filter_lower_cutoff_frequency(self, selector_string):
r"""Gets the lower cutoff frequency of the custom audio filter. This attribute is applicable only when you set the
:py:attr:`~nirfmxdemod.attributes.AttributeID.ADEMOD_AUDIO_FILTER_TYPE` attribute to **Custom**. This value is
expressed in Hz.
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 100.
Args:
selector_string (string):
Pass an empty string.
Returns:
Tuple (attr_val, error_code):
attr_val (float):
Specifies the lower cutoff frequency of the custom audio filter. This attribute is applicable only when you set the
:py:attr:`~nirfmxdemod.attributes.AttributeID.ADEMOD_AUDIO_FILTER_TYPE` attribute to **Custom**. This value is
expressed in Hz.
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.ADEMOD_AUDIO_FILTER_LOWER_CUTOFF_FREQUENCY.value,
)
finally:
self._session_function_lock.exit_read_lock()
return attr_val, error_code
[docs]
@_raise_if_disposed
def set_audio_filter_lower_cutoff_frequency(self, selector_string, value):
r"""Sets the lower cutoff frequency of the custom audio filter. This attribute is applicable only when you set the
:py:attr:`~nirfmxdemod.attributes.AttributeID.ADEMOD_AUDIO_FILTER_TYPE` attribute to **Custom**. This value is
expressed in Hz.
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 100.
Args:
selector_string (string):
Pass an empty string.
value (float):
Specifies the lower cutoff frequency of the custom audio filter. This attribute is applicable only when you set the
:py:attr:`~nirfmxdemod.attributes.AttributeID.ADEMOD_AUDIO_FILTER_TYPE` attribute to **Custom**. This value is
expressed in Hz.
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.ADEMOD_AUDIO_FILTER_LOWER_CUTOFF_FREQUENCY.value,
value,
)
finally:
self._session_function_lock.exit_read_lock()
return error_code
[docs]
@_raise_if_disposed
def get_audio_filter_upper_cutoff_frequency(self, selector_string):
r"""Gets the upper cutoff frequency of the custom audio filter. This attribute is applicable only when you set the
:py:attr:`~nirfmxdemod.attributes.AttributeID.ADEMOD_AUDIO_FILTER_TYPE` attribute to **Custom**. This value is
expressed in Hz.
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 10,000.
Args:
selector_string (string):
Pass an empty string.
Returns:
Tuple (attr_val, error_code):
attr_val (float):
Specifies the upper cutoff frequency of the custom audio filter. This attribute is applicable only when you set the
:py:attr:`~nirfmxdemod.attributes.AttributeID.ADEMOD_AUDIO_FILTER_TYPE` attribute to **Custom**. This value is
expressed in Hz.
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.ADEMOD_AUDIO_FILTER_UPPER_CUTOFF_FREQUENCY.value,
)
finally:
self._session_function_lock.exit_read_lock()
return attr_val, error_code
[docs]
@_raise_if_disposed
def set_audio_filter_upper_cutoff_frequency(self, selector_string, value):
r"""Sets the upper cutoff frequency of the custom audio filter. This attribute is applicable only when you set the
:py:attr:`~nirfmxdemod.attributes.AttributeID.ADEMOD_AUDIO_FILTER_TYPE` attribute to **Custom**. This value is
expressed in Hz.
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 10,000.
Args:
selector_string (string):
Pass an empty string.
value (float):
Specifies the upper cutoff frequency of the custom audio filter. This attribute is applicable only when you set the
:py:attr:`~nirfmxdemod.attributes.AttributeID.ADEMOD_AUDIO_FILTER_TYPE` attribute to **Custom**. This value is
expressed in Hz.
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.ADEMOD_AUDIO_FILTER_UPPER_CUTOFF_FREQUENCY.value,
value,
)
finally:
self._session_function_lock.exit_read_lock()
return error_code
[docs]
@_raise_if_disposed
def get_averaging_enabled(self, selector_string):
r"""Gets whether to enable averaging for the analog demodulation 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**.
+--------------+--------------------------------------------------------------------------------------------------------------------------+
| Name (Value) | Description |
+==============+==========================================================================================================================+
| False (0) | The measurement is performed on a single acquisition. |
+--------------+--------------------------------------------------------------------------------------------------------------------------+
| True (1) | The analog demodulation measurement uses the ADemod Averaging Count attribute to calculate the number of acquisitions |
| | over which the measurement is averaged. Traces are not averaged. |
+--------------+--------------------------------------------------------------------------------------------------------------------------+
Args:
selector_string (string):
Pass an empty string.
Returns:
Tuple (attr_val, error_code):
attr_val (enums.ADemodAveragingEnabled):
Specifies whether to enable averaging for the analog demodulation 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.ADEMOD_AVERAGING_ENABLED.value
)
attr_val = enums.ADemodAveragingEnabled(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_averaging_enabled(self, selector_string, value):
r"""Sets whether to enable averaging for the analog demodulation 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**.
+--------------+--------------------------------------------------------------------------------------------------------------------------+
| Name (Value) | Description |
+==============+==========================================================================================================================+
| False (0) | The measurement is performed on a single acquisition. |
+--------------+--------------------------------------------------------------------------------------------------------------------------+
| True (1) | The analog demodulation measurement uses the ADemod Averaging Count attribute to calculate the number of acquisitions |
| | over which the measurement is averaged. Traces are not averaged. |
+--------------+--------------------------------------------------------------------------------------------------------------------------+
Args:
selector_string (string):
Pass an empty string.
value (enums.ADemodAveragingEnabled, int):
Specifies whether to enable averaging for the analog demodulation 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.ADemodAveragingEnabled else value
error_code = self._interpreter.set_attribute_i32(
updated_selector_string,
attributes.AttributeID.ADEMOD_AVERAGING_ENABLED.value,
value,
)
finally:
self._session_function_lock.exit_read_lock()
return error_code
[docs]
@_raise_if_disposed
def get_averaging_count(self, selector_string):
r"""Gets the number of acquisitions used for averaging when you set the
:py:attr:`~nirfmxdemod.attributes.AttributeID.ADEMOD_AVERAGING_ENABLED` attribute to **True**.
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 10.
Args:
selector_string (string):
Pass an empty string.
Returns:
Tuple (attr_val, error_code):
attr_val (int):
Specifies the number of acquisitions used for averaging when you set the
:py:attr:`~nirfmxdemod.attributes.AttributeID.ADEMOD_AVERAGING_ENABLED` attribute to **True**.
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.ADEMOD_AVERAGING_COUNT.value
)
finally:
self._session_function_lock.exit_read_lock()
return attr_val, error_code
[docs]
@_raise_if_disposed
def set_averaging_count(self, selector_string, value):
r"""Sets the number of acquisitions used for averaging when you set the
:py:attr:`~nirfmxdemod.attributes.AttributeID.ADEMOD_AVERAGING_ENABLED` attribute to **True**.
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 10.
Args:
selector_string (string):
Pass an empty string.
value (int):
Specifies the number of acquisitions used for averaging when you set the
:py:attr:`~nirfmxdemod.attributes.AttributeID.ADEMOD_AVERAGING_ENABLED` attribute to **True**.
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.ADEMOD_AVERAGING_COUNT.value, value
)
finally:
self._session_function_lock.exit_read_lock()
return error_code
[docs]
@_raise_if_disposed
def get_averaging_type(self, selector_string):
r"""Gets the averaging type for the 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 **Linear**.
+--------------+---------------------------------------------------------------------------------+
| Name (Value) | Description |
+==============+=================================================================================+
| Linear (0) | The averaged result is the mean value measured across multiple acquisitions. |
+--------------+---------------------------------------------------------------------------------+
| Max (1) | The averaged result is the maximum value measured across multiple acquisitions. |
+--------------+---------------------------------------------------------------------------------+
| Min (2) | The averaged result is the minimum value measured across multiple acquisitions. |
+--------------+---------------------------------------------------------------------------------+
Args:
selector_string (string):
Pass an empty string.
Returns:
Tuple (attr_val, error_code):
attr_val (enums.ADemodAveragingType):
Specifies the averaging type for the 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.ADEMOD_AVERAGING_TYPE.value
)
attr_val = enums.ADemodAveragingType(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_averaging_type(self, selector_string, value):
r"""Sets the averaging type for the 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 **Linear**.
+--------------+---------------------------------------------------------------------------------+
| Name (Value) | Description |
+==============+=================================================================================+
| Linear (0) | The averaged result is the mean value measured across multiple acquisitions. |
+--------------+---------------------------------------------------------------------------------+
| Max (1) | The averaged result is the maximum value measured across multiple acquisitions. |
+--------------+---------------------------------------------------------------------------------+
| Min (2) | The averaged result is the minimum value measured across multiple acquisitions. |
+--------------+---------------------------------------------------------------------------------+
Args:
selector_string (string):
Pass an empty string.
value (enums.ADemodAveragingType, int):
Specifies the averaging type for the 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.ADemodAveragingType else value
error_code = self._interpreter.set_attribute_i32(
updated_selector_string, attributes.AttributeID.ADEMOD_AVERAGING_TYPE.value, value
)
finally:
self._session_function_lock.exit_read_lock()
return error_code
[docs]
@_raise_if_disposed
def get_all_traces_enabled(self, selector_string):
r"""Gets whether to enable the traces to be stored and retrieved after performing the analog demodulation 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 traces to be stored and retrieved after performing the analog demodulation 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.ADEMOD_ALL_TRACES_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_all_traces_enabled(self, selector_string, value):
r"""Sets whether to enable the traces to be stored and retrieved after performing the analog demodulation 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 traces to be stored and retrieved after performing the analog demodulation 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.ADEMOD_ALL_TRACES_ENABLED.value,
int(value),
)
finally:
self._session_function_lock.exit_read_lock()
return error_code