from .....Internal.Core import Core
from .....Internal.CommandsGroup import CommandsGroup
from .....Internal import Conversions
from ..... import repcap
# noinspection PyPep8Naming,PyAttributeOutsideInit,SpellCheckingInspection
class CenterCls:
"""
| Commands in total: 1
| Subgroups: 0
| Direct child commands: 1
"""
def __init__(self, core: Core, parent):
self._core = core
self._cmd_group = CommandsGroup("center", core, parent)
[docs]
def set(self, center: float, spectrum=repcap.Spectrum.Default) -> None:
"""
``CALCulate:SPECtrum<*>:FREQuency:CENTer`` \n
Snippet: ``driver.calculate.spectrum.frequency.center.set(center = 1.0, spectrum = repcap.Spectrum.Default)`` \n
Defines the position of the displayed frequency range, which is (Center - Span/2) to (Center + Span/2) . The width of the
range is defined using the frequency span setting.
:param center: -1E+26 to 1E+26
:param spectrum: optional repeated capability selector. Default value: Nr1 (settable in the interface 'Spectrum')
"""
param = Conversions.decimal_value_to_str(center)
spectrum_cmd_val = self._cmd_group.get_repcap_cmd_value(spectrum, repcap.Spectrum)
self._core.io.write(f'CALCulate:SPECtrum{spectrum_cmd_val}:FREQuency:CENTer {param}')
[docs]
def get(self, spectrum=repcap.Spectrum.Default) -> float:
"""
``CALCulate:SPECtrum<*>:FREQuency:CENTer`` \n
Snippet: ``value: float = driver.calculate.spectrum.frequency.center.get(spectrum = repcap.Spectrum.Default)`` \n
Defines the position of the displayed frequency range, which is (Center - Span/2) to (Center + Span/2) . The width of the
range is defined using the frequency span setting.
:param spectrum: optional repeated capability selector. Default value: Nr1 (settable in the interface 'Spectrum')
:return: center: -1E+26 to 1E+26
"""
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}:FREQuency:CENTer?')
return Conversions.str_to_float(response)