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 MeasurementCls:
"""
| Commands in total: 5
| Subgroups: 0
| Direct child commands: 5
"""
def __init__(self, core: Core, parent):
self._core = core
self._cmd_group = CommandsGroup("measurement", core, parent)
# noinspection PyTypeChecker
[docs]
def get_select(self) -> enums.ArithmeticMeasGroup:
"""
``EXPort:MEASurement:SELect`` \n
Snippet: ``value: enums.ArithmeticMeasGroup = driver.export.measurement.get_select()`` \n
Selects the measurement for export of long term or measurement histogram data.
:return: select_meas: MEAS1 | MEAS2 | MEAS3 | MEAS4 | MEAS5 | MEAS6 | MEAS7 | MEAS8
"""
response = self._core.io.query_str_with_opc('EXPort:MEASurement:SELect?')
return Conversions.str_to_scalar_enum(response, enums.ArithmeticMeasGroup)
[docs]
def set_select(self, select_meas: enums.ArithmeticMeasGroup) -> None:
"""
``EXPort:MEASurement:SELect`` \n
Snippet: ``driver.export.measurement.set_select(select_meas = enums.ArithmeticMeasGroup.IMEAS)`` \n
Selects the measurement for export of long term or measurement histogram data.
:param select_meas: MEAS1 | MEAS2 | MEAS3 | MEAS4 | MEAS5 | MEAS6 | MEAS7 | MEAS8
"""
param = Conversions.enum_scalar_to_str(select_meas, enums.ArithmeticMeasGroup)
self._core.io.write_with_opc(f'EXPort:MEASurement:SELect {param}')
# noinspection PyTypeChecker
[docs]
def get_type_py(self) -> enums.ExportType:
"""
``EXPort:MEASurement:TYPE`` \n
Snippet: ``value: enums.ExportType = driver.export.measurement.get_type_py()`` \n
You can export the result data of the long term measurement, or the measurement histogram, or the track data. To export
the measurement histogram, it must be enabled using method ``RsRtx.measurement.statistics.histogram.set()`` . To export
the long term results, the long term measurement must be enabled using method ``RsRtx.measurement.ltMeas.state.set()`` .
To export a track, the track must be enabled before. Track measurements require an option, see 'Enable (Track) '.
:return: export_type: LONGTERM = LONGterm, HISTOGRAM = HISTogram
"""
response = self._core.io.query_str_with_opc('EXPort:MEASurement:TYPE?')
return Conversions.str_to_scalar_enum(response, enums.ExportType)
[docs]
def set_type_py(self, export_type: enums.ExportType) -> None:
"""
``EXPort:MEASurement:TYPE`` \n
Snippet: ``driver.export.measurement.set_type_py(export_type = enums.ExportType.HISTogram)`` \n
You can export the result data of the long term measurement, or the measurement histogram, or the track data. To export
the measurement histogram, it must be enabled using method ``RsRtx.measurement.statistics.histogram.set()`` . To export
the long term results, the long term measurement must be enabled using method ``RsRtx.measurement.ltMeas.state.set()`` .
To export a track, the track must be enabled before. Track measurements require an option, see 'Enable (Track) '.
:param export_type: LONGTERM = LONGterm, HISTOGRAM = HISTogram
"""
param = Conversions.enum_scalar_to_str(export_type, enums.ExportType)
self._core.io.write_with_opc(f'EXPort:MEASurement:TYPE {param}')
[docs]
def save(self) -> None:
"""
``EXPort:MEASurement:SAVE`` \n
Snippet: ``driver.export.measurement.save()`` \n
Saves the long term or measurement histogram results to the file specified using method
``RsRtx.export.measurement.name()`` . The measurement data can be exported as absolute or relative values, which is
defined using method ``RsRtx.export.histogram.incidence()`` .
"""
self._core.io.write(f'EXPort:MEASurement:SAVE')
[docs]
def save_and_wait(self, opc_timeout_ms: int = -1) -> None:
"""
``EXPort:MEASurement:SAVE`` \n
Snippet: ``driver.export.measurement.save_and_wait()`` \n
Saves the long term or measurement histogram results to the file specified using method
``RsRtx.export.measurement.name()`` . The measurement data can be exported as absolute or relative values, which is
defined using method ``RsRtx.export.histogram.incidence()`` .
Same as save, but waits for the operation to complete before continuing further. Use the RsRtx.utilities.opc_timeout_set() to set the timeout value.
:param opc_timeout_ms: Maximum time to wait in milliseconds, valid only for this call.
"""
self._core.io.write_with_opc(f'EXPort:MEASurement:SAVE', opc_timeout_ms)
[docs]
def get_data(self) -> float:
"""
``EXPort:MEASurement:DATA`` \n
Snippet: ``value: float = driver.export.measurement.get_data()`` \n
Transfers the long term measurement data to the controlling computer. The data can be used in MATLAB, for example.
The transferred data are the same as the data written to files. To set the export data format, use method
``RsRtx.formatPy.data.set()`` .
:return: data: List of values according to the format settings Long term data: If statistics are disabled, the current value of each long term point is returned. If statistics are enabled (method ``RsRtx.measurement.statistics.enable.set()``) , seven values for each long term point are returned: upper peak, lower peak, RMS, standard deviation, average, number of measured results per long term point, number of waveforms per long term point. For measurement histograms, absolute values are returned. See also: 'Result plots analysis'.
"""
response = self._core.io.query_str('EXPort:MEASurement:DATA?')
return Conversions.str_to_float(response)
[docs]
def get_name(self) -> str:
"""
``EXPort:MEASurement:NAME`` \n
Snippet: ``value: str = driver.export.measurement.get_name()`` \n
Sets the file name and path to save the long term or measurement histogram data 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:MEASurement:NAME?')
return trim_str_response(response)
[docs]
def set_name(self, path: str) -> None:
"""
``EXPort:MEASurement:NAME`` \n
Snippet: ``driver.export.measurement.set_name(path = 'abc')`` \n
Sets the file name and path to save the long term or measurement histogram data 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:MEASurement:NAME {param}')