from .....Internal.Core import Core
from .....Internal.CommandsGroup import CommandsGroup
from .....Internal import Conversions
from .....Internal.Utilities import trim_str_response
from ..... import repcap
# noinspection PyPep8Naming,PyAttributeOutsideInit,SpellCheckingInspection
class DefineCls:
"""
| Commands in total: 1
| Subgroups: 0
| Direct child commands: 1
"""
def __init__(self, core: Core, parent):
self._core = core
self._cmd_group = CommandsGroup("define", core, parent)
[docs]
def set(self, rem_compl_expr: str, math=repcap.Math.Default) -> None:
"""
``CALCulate:MATH<*>[:EXPRession][:DEFine]`` \n
Snippet: ``driver.calculate.math.expression.define.set(rem_compl_expr = 'abc', math = repcap.Math.Default)`` \n
Defines the math expression to be calculated for the specified math channel. For an overview of corresponding expressions
for the available keys in the formula editor, see 'Equation'.
:param rem_compl_expr: String with regular expression for calculation
:param math: optional repeated capability selector. Default value: Nr1 (settable in the interface 'Math')
"""
param = Conversions.value_to_quoted_str(rem_compl_expr)
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}:EXPRession:DEFine {param}')
[docs]
def get(self, math=repcap.Math.Default) -> str:
"""
``CALCulate:MATH<*>[:EXPRession][:DEFine]`` \n
Snippet: ``value: str = driver.calculate.math.expression.define.get(math = repcap.Math.Default)`` \n
Defines the math expression to be calculated for the specified math channel. For an overview of corresponding expressions
for the available keys in the formula editor, see 'Equation'.
:param math: optional repeated capability selector. Default value: Nr1 (settable in the interface 'Math')
:return: rem_compl_expr: String with regular expression for calculation
"""
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}:EXPRession:DEFine?')
return trim_str_response(response)