from ...Internal.Core import Core
from ...Internal.CommandsGroup import CommandsGroup
from ...Internal import Conversions
from ...Internal.Utilities import trim_str_response
from ... import enums
# noinspection PyPep8Naming,PyAttributeOutsideInit,SpellCheckingInspection
class HistogramCls:
"""
| Commands in total: 5
| Subgroups: 0
| Direct child commands: 5
"""
def __init__(self, core: Core, parent):
self._core = core
self._cmd_group = CommandsGroup("histogram", core, parent)
[docs]
def save(self, opc_timeout_ms: int = -1) -> None:
"""
``EXPort:HISTogram:SAVE`` \n
Snippet: ``driver.export.histogram.save()`` \n
Saves the histogram to the file specified with method ``RsRtx.export.histogram.name()`` .
:param opc_timeout_ms: Maximum time to wait in milliseconds, valid only for this call.
"""
self._core.io.write_with_opc(f'EXPort:HISTogram:SAVE', opc_timeout_ms)
[docs]
def get_select(self) -> str:
"""
``EXPort:HISTogram:SELect`` \n
Snippet: ``value: str = driver.export.histogram.get_select()`` \n
Selects the histogram to be exported.
"""
response = self._core.io.query_str_with_opc('EXPort:HISTogram:SELect?')
return trim_str_response(response)
[docs]
def set_select(self, name: str) -> None:
"""
``EXPort:HISTogram:SELect`` \n
Snippet: ``driver.export.histogram.set_select(name = 'abc')`` \n
Selects the histogram to be exported.
"""
param = Conversions.value_to_quoted_str(name)
self._core.io.write_with_opc(f'EXPort:HISTogram:SELect {param}')
# noinspection PyTypeChecker
[docs]
def get_incidence(self) -> enums.PositionMode:
"""
``EXPort:HISTogram:INCidence`` \n
Snippet: ``value: enums.PositionMode = driver.export.histogram.get_incidence()`` \n
Sets the mode of exported data: relative or absolute frequency of amplitude values.
:return: incidence: ABS | REL
"""
response = self._core.io.query_str_with_opc('EXPort:HISTogram:INCidence?')
return Conversions.str_to_scalar_enum(response, enums.PositionMode)
[docs]
def set_incidence(self, incidence: enums.PositionMode) -> None:
"""
``EXPort:HISTogram:INCidence`` \n
Snippet: ``driver.export.histogram.set_incidence(incidence = enums.PositionMode.ABS)`` \n
Sets the mode of exported data: relative or absolute frequency of amplitude values.
:param incidence: ABS | REL
"""
param = Conversions.enum_scalar_to_str(incidence, enums.PositionMode)
self._core.io.write_with_opc(f'EXPort:HISTogram:INCidence {param}')
[docs]
def get_data(self) -> float:
"""
``EXPort:HISTogram:DATA`` \n
Snippet: ``value: float = driver.export.histogram.get_data()`` \n
Transfers the histogram data to the controlling computer. The data can be used in MATLAB, for example. To set the export
data format, use method ``RsRtx.formatPy.data.set()`` .
:return: data: List of values according to the format settings and method ``RsRtx.export.histogram.incidence()``.
"""
response = self._core.io.query_str('EXPort:HISTogram:DATA?')
return Conversions.str_to_float(response)
[docs]
def get_name(self) -> str:
"""
``EXPort:HISTogram:NAME`` \n
Snippet: ``value: str = driver.export.histogram.get_name()`` \n
Sets the file name and path to save the histogram to.
:return: path: String with path and file name. The file extension defines the file format: XML, CSV, or BIN.
"""
response = self._core.io.query_str_with_opc('EXPort:HISTogram:NAME?')
return trim_str_response(response)
[docs]
def set_name(self, path: str) -> None:
"""
``EXPort:HISTogram:NAME`` \n
Snippet: ``driver.export.histogram.set_name(path = 'abc')`` \n
Sets the file name and path to save the histogram to.
:param path: String with path and file name. The file extension defines the file format: XML, CSV, or BIN.
"""
param = Conversions.value_to_quoted_str(path)
self._core.io.write_with_opc(f'EXPort:HISTogram:NAME {param}')