from .....Internal.Core import Core
from .....Internal.CommandsGroup import CommandsGroup
from .....Internal import Conversions
from .....Internal.Types import DataType
from .....Internal.ArgSingleList import ArgSingleList
from .....Internal.ArgSingle import ArgSingle
from ..... import enums
# noinspection PyPep8Naming,PyAttributeOutsideInit,SpellCheckingInspection
class RangeCls:
"""
| Commands in total: 1
| Subgroups: 0
| Direct child commands: 1
"""
def __init__(self, core: Core, parent):
self._core = core
self._cmd_group = CommandsGroup("range", core, parent)
[docs]
def set(self, search: str, range_mode: enums.WindowRangeMode) -> None:
"""
``SEARch:TRIGger:WINDow:RANGe`` \n
Snippet: ``driver.search.trigger.window.range.set(search = 'abc', range_mode = enums.WindowRangeMode.ENTer)`` \n
Selects how the signal run is compared with the window.
:param search: Search definition
:param range_mode: ENTer | EXIT | WITHin | OUTSide \n
- ENTer: Triggers when the signal crosses the upper or lower level and thus enters the window made up of these two levels.
- EXIT: Triggers when the signal leaves the window.
- WITHin: Triggers if the signal stays between the upper and lower level for a specified time. The time is defined in various ways by the SEARch:TRIGger:WINDow:TIMerange command.
- OUTSide: Triggers if the signal stays above the upper level or below the lower level for a specified time. The time is also defined by the SEARch:TRIGger:WINDow:TIMerange command.
"""
param = ArgSingleList().compose_cmd_string(ArgSingle('search', search, DataType.String), ArgSingle('range_mode', range_mode, DataType.Enum, enums.WindowRangeMode))
self._core.io.write_with_opc(f'SEARch:TRIGger:WINDow:RANGe {param}'.rstrip())
# noinspection PyTypeChecker
[docs]
def get(self, search: str) -> enums.WindowRangeMode:
"""
``SEARch:TRIGger:WINDow:RANGe`` \n
Snippet: ``value: enums.WindowRangeMode = driver.search.trigger.window.range.get(search = 'abc')`` \n
Selects how the signal run is compared with the window.
:param search: Search definition
:return: range_mode: ENTer | EXIT | WITHin | OUTSide \n
- ENTer: Triggers when the signal crosses the upper or lower level and thus enters the window made up of these two levels.
- EXIT: Triggers when the signal leaves the window.
- WITHin: Triggers if the signal stays between the upper and lower level for a specified time. The time is defined in various ways by the SEARch:TRIGger:WINDow:TIMerange command.
- OUTSide: Triggers if the signal stays above the upper level or below the lower level for a specified time. The time is also defined by the SEARch:TRIGger:WINDow:TIMerange command.
"""
param = Conversions.value_to_quoted_str(search)
response = self._core.io.query_str_with_opc(f'SEARch:TRIGger:WINDow:RANGe? {param}')
return Conversions.str_to_scalar_enum(response, enums.WindowRangeMode)