from ...Internal.Core import Core
from ...Internal.CommandsGroup import CommandsGroup
from ...Internal import Conversions
from ... import repcap
# noinspection PyPep8Naming,PyAttributeOutsideInit,SpellCheckingInspection
class BandwidthCls:
"""
| Commands in total: 1
| Subgroups: 0
| Direct child commands: 1
"""
def __init__(self, core: Core, parent):
self._core = core
self._cmd_group = CommandsGroup("bandwidth", core, parent)
[docs]
def set(self, bandwidth_limit: float, channel=repcap.Channel.Default) -> None:
"""
``CHANnel<*>:BANDwidth`` \n
Snippet: ``driver.channel.bandwidth.set(bandwidth_limit = 1.0, channel = repcap.Channel.Default)`` \n
Sets the bandwidth limit. The specified bandwidth indicates the range of frequencies that the instrument can acquire and
display accurately with less than 3 dB attenuation. Frequencies above the limit are removed from the signal, and noise is
reduced. To set the bandwidth, use one of the <BandwidthLimit> values. The query returns always a numeric result.
:param bandwidth_limit: Availability depends on the maximum bandwidth of the instrument and installed bandwidth extension options. Instead of the given values, you can also set the corresponding numeric value in Hz.
:param channel: optional repeated capability selector. Default value: Ch1 (settable in the interface 'Channel')
"""
param = Conversions.decimal_value_to_str(bandwidth_limit)
channel_cmd_val = self._cmd_group.get_repcap_cmd_value(channel, repcap.Channel)
self._core.io.write(f'CHANnel{channel_cmd_val}:BANDwidth {param}')
[docs]
def get(self, channel=repcap.Channel.Default) -> float:
"""
``CHANnel<*>:BANDwidth`` \n
Snippet: ``value: float = driver.channel.bandwidth.get(channel = repcap.Channel.Default)`` \n
Sets the bandwidth limit. The specified bandwidth indicates the range of frequencies that the instrument can acquire and
display accurately with less than 3 dB attenuation. Frequencies above the limit are removed from the signal, and noise is
reduced. To set the bandwidth, use one of the <BandwidthLimit> values. The query returns always a numeric result.
:param channel: optional repeated capability selector. Default value: Ch1 (settable in the interface 'Channel')
:return: result: Numeric result in Hz
"""
channel_cmd_val = self._cmd_group.get_repcap_cmd_value(channel, repcap.Channel)
response = self._core.io.query_str(f'CHANnel{channel_cmd_val}:BANDwidth?')
return Conversions.str_to_float(response)