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, width_range_mode: enums.TriggerSearchRangeMode) -> None:
"""
``SEARch:TRIGger:PATTern:WIDTh:RANGe`` \n
Snippet: ``driver.search.trigger.pattern.width.range.set(search = 'abc', width_range_mode = enums.TriggerSearchRangeMode.LONGer)`` \n
Defines the time range of a pulse width for keeping up the true result of the pattern condition. The width and delta are
specified using method ``RsRtx.search.trigger.pattern.width.width.set()`` and method
``RsRtx.search.trigger.pattern.width.delta.set()`` .
:param search: String with the name of the search
:param width_range_mode: WITHin | OUTSide | SHORter | LONGer \n
- WITHin | OUTSide: Triggers on pulses inside or outside a given range. The range is defined by the width ±delta.
- SHORter | LONGer: Triggers on pulses shorter or longer than the given width.
"""
param = ArgSingleList().compose_cmd_string(ArgSingle('search', search, DataType.String), ArgSingle('width_range_mode', width_range_mode, DataType.Enum, enums.TriggerSearchRangeMode))
self._core.io.write_with_opc(f'SEARch:TRIGger:PATTern:WIDTh:RANGe {param}'.rstrip())
# noinspection PyTypeChecker
[docs]
def get(self, search: str) -> enums.TriggerSearchRangeMode:
"""
``SEARch:TRIGger:PATTern:WIDTh:RANGe`` \n
Snippet: ``value: enums.TriggerSearchRangeMode = driver.search.trigger.pattern.width.range.get(search = 'abc')`` \n
Defines the time range of a pulse width for keeping up the true result of the pattern condition. The width and delta are
specified using method ``RsRtx.search.trigger.pattern.width.width.set()`` and method
``RsRtx.search.trigger.pattern.width.delta.set()`` .
:param search: String with the name of the search
:return: width_range_mode: WITHin | OUTSide | SHORter | LONGer \n
- WITHin | OUTSide: Triggers on pulses inside or outside a given range. The range is defined by the width ±delta.
- SHORter | LONGer: Triggers on pulses shorter or longer than the given width.
"""
param = Conversions.value_to_quoted_str(search)
response = self._core.io.query_str_with_opc(f'SEARch:TRIGger:PATTern:WIDTh:RANGe? {param}')
return Conversions.str_to_scalar_enum(response, enums.TriggerSearchRangeMode)