from ....Internal.Core import Core
from ....Internal.CommandsGroup import CommandsGroup
from ....Internal import Conversions
from .... import enums
from .... import repcap
# noinspection PyPep8Naming,PyAttributeOutsideInit,SpellCheckingInspection
class ArithmeticsCls:
"""
| Commands in total: 1
| Subgroups: 0
| Direct child commands: 1
"""
def __init__(self, core: Core, parent):
self._core = core
self._cmd_group = CommandsGroup("arithmetics", core, parent)
[docs]
def set(self, arithmetics: enums.Arithmetics, math=repcap.Math.Default) -> None:
"""
``CALCulate:MATH<*>:ARIThmetics`` \n
Snippet: ``driver.calculate.math.arithmetics.set(arithmetics = enums.Arithmetics.AVERage, math = repcap.Math.Default)`` \n
Selects the method to build the resulting math waveform from consecutive acquisitions. The processing is similar to the
waveform arithmetics - instead of the acquired waveforms the results of the mathematic formula are used to create
envelope, average and RMS. To define the reset condition for arithmetics calculation,
use method ``RsRtx.acquire.areset.mode()`` .
:param arithmetics: Waveform arithmetic mode \n
- OFF: The math waveform is built according to the mathematic formula.
- ENVelope: Detects the minimum and maximum math values in a sample interval over a number of acquisitions.
- AVERage: Calculates the average from the math data of the current acquisition and a number of acquisitions before. To define the number of acquisitions, use ACQuire:COUNt.
- RMS: The resulting math waveform is the root mean square of the current acquisition and a number of acquisitions before. The result is the average power spectrum. Number of acquisitions: ACQuire:COUNt
- MAXHold: Determines the maximum result for each input value from the math data of the current acquisition and a number of acquisitions before. To define the number of acquisitions, use ACQuire:COUNt.
- MINHold: Determines the minimum result for each input value from the math data of the current acquisition and a number of acquisitions before. To define the number of acquisitions, use ACQuire:COUNt.
:param math: optional repeated capability selector. Default value: Nr1 (settable in the interface 'Math')
"""
param = Conversions.enum_scalar_to_str(arithmetics, enums.Arithmetics)
math_cmd_val = self._cmd_group.get_repcap_cmd_value(math, repcap.Math)
self._core.io.write_with_opc(f'CALCulate:MATH{math_cmd_val}:ARIThmetics {param}')
# noinspection PyTypeChecker
[docs]
def get(self, math=repcap.Math.Default) -> enums.Arithmetics:
"""
``CALCulate:MATH<*>:ARIThmetics`` \n
Snippet: ``value: enums.Arithmetics = driver.calculate.math.arithmetics.get(math = repcap.Math.Default)`` \n
Selects the method to build the resulting math waveform from consecutive acquisitions. The processing is similar to the
waveform arithmetics - instead of the acquired waveforms the results of the mathematic formula are used to create
envelope, average and RMS. To define the reset condition for arithmetics calculation,
use method ``RsRtx.acquire.areset.mode()`` .
:param math: optional repeated capability selector. Default value: Nr1 (settable in the interface 'Math')
:return: arithmetics: Waveform arithmetic mode \n
- OFF: The math waveform is built according to the mathematic formula.
- ENVelope: Detects the minimum and maximum math values in a sample interval over a number of acquisitions.
- AVERage: Calculates the average from the math data of the current acquisition and a number of acquisitions before. To define the number of acquisitions, use ACQuire:COUNt.
- RMS: The resulting math waveform is the root mean square of the current acquisition and a number of acquisitions before. The result is the average power spectrum. Number of acquisitions: ACQuire:COUNt
- MAXHold: Determines the maximum result for each input value from the math data of the current acquisition and a number of acquisitions before. To define the number of acquisitions, use ACQuire:COUNt.
- MINHold: Determines the minimum result for each input value from the math data of the current acquisition and a number of acquisitions before. To define the number of acquisitions, use ACQuire:COUNt.
"""
math_cmd_val = self._cmd_group.get_repcap_cmd_value(math, repcap.Math)
response = self._core.io.query_str_with_opc(f'CALCulate:MATH{math_cmd_val}:ARIThmetics?')
return Conversions.str_to_scalar_enum(response, enums.Arithmetics)