from ....Internal.Core import Core
from ....Internal.CommandsGroup import CommandsGroup
from ....Internal import Conversions
from .... import repcap
# noinspection PyPep8Naming,PyAttributeOutsideInit,SpellCheckingInspection
class ThresholdCls:
"""
| Commands in total: 1
| Subgroups: 0
| Direct child commands: 1
"""
def __init__(self, core: Core, parent):
self._core = core
self._cmd_group = CommandsGroup("threshold", core, parent)
[docs]
def set(self, threshold: float, spectrum=repcap.Spectrum.Default) -> None:
"""
``CALCulate:SPECtrum<*>:THReshold`` \n
Snippet: ``driver.calculate.spectrum.threshold.set(threshold = 1.0, spectrum = repcap.Spectrum.Default)`` \n
Sets an absolute threshold as an additional condition for the peak search. Only peaks that exceed the threshold are
detected.
:param threshold: -500 to 500
:param spectrum: optional repeated capability selector. Default value: Nr1 (settable in the interface 'Spectrum')
"""
param = Conversions.decimal_value_to_str(threshold)
spectrum_cmd_val = self._cmd_group.get_repcap_cmd_value(spectrum, repcap.Spectrum)
self._core.io.write(f'CALCulate:SPECtrum{spectrum_cmd_val}:THReshold {param}')
[docs]
def get(self, spectrum=repcap.Spectrum.Default) -> float:
"""
``CALCulate:SPECtrum<*>:THReshold`` \n
Snippet: ``value: float = driver.calculate.spectrum.threshold.get(spectrum = repcap.Spectrum.Default)`` \n
Sets an absolute threshold as an additional condition for the peak search. Only peaks that exceed the threshold are
detected.
:param spectrum: optional repeated capability selector. Default value: Nr1 (settable in the interface 'Spectrum')
:return: threshold: -500 to 500
"""
spectrum_cmd_val = self._cmd_group.get_repcap_cmd_value(spectrum, repcap.Spectrum)
response = self._core.io.query_str(f'CALCulate:SPECtrum{spectrum_cmd_val}:THReshold?')
return Conversions.str_to_float(response)