from ...Internal.Core import Core
from ...Internal.CommandsGroup import CommandsGroup
from ...Internal import Conversions
# noinspection PyPep8Naming,PyAttributeOutsideInit,SpellCheckingInspection
class TimebaseCls:
"""
| Commands in total: 9
| Subgroups: 2
| Direct child commands: 5
"""
def __init__(self, core: Core, parent):
self._core = core
self._cmd_group = CommandsGroup("timebase", core, parent)
@property
def roll(self):
"""
| Commands in total: 3
| Subgroups: 0
| Direct child commands: 3
"""
if not hasattr(self, '_roll'):
from .Roll import RollCls
self._roll = RollCls(self._core, self._cmd_group)
return self._roll
@property
def horizontal(self):
"""
| Commands in total: 1
| Subgroups: 0
| Direct child commands: 1
"""
if not hasattr(self, '_horizontal'):
from .Horizontal import HorizontalCls
self._horizontal = HorizontalCls(self._core, self._cmd_group)
return self._horizontal
[docs]
def get_divisions(self) -> int:
"""
``TIMebase:DIVisions`` \n
Snippet: ``value: int = driver.timebase.get_divisions()`` \n
Queries the number of horizontal divisions on the screen. The number cannot be changed.
:return: horiz_div_cnt: 4 to 20
"""
response = self._core.io.query_str_with_opc('TIMebase:DIVisions?')
return Conversions.str_to_int(response)
[docs]
def get_rac_time(self) -> float:
"""
``TIMebase:RACTime`` \n
Snippet: ``value: float = driver.timebase.get_rac_time()`` \n
Queries the required acquisition time. If FFT gating is used and the resolution BW is set to constant, record length can
be extended to acquire the required number of samples. In this case, the required acquisition time differs from the
adjusted acquisition time (method ``RsRtx.timebase.range()`` ) .
:return: hwa_cq_time: Required acquisition time for FFT
"""
response = self._core.io.query_str_with_opc('TIMebase:RACTime?')
return Conversions.str_to_float(response)
[docs]
def get_range(self) -> float:
"""
``TIMebase:RANGe`` \n
Snippet: ``value: float = driver.timebase.get_range()`` \n
Defines the time of one acquisition, that is the time across the 10 divisions of the diagram: TimeScale``*10``.
:return: acq_time: 250E-12 to 100E+3 (RTO, RTP) | 50E+3 (RTE)
"""
response = self._core.io.query_str_with_opc('TIMebase:RANGe?')
return Conversions.str_to_float(response)
[docs]
def set_range(self, acq_time: float) -> None:
"""
``TIMebase:RANGe`` \n
Snippet: ``driver.timebase.set_range(acq_time = 1.0)`` \n
Defines the time of one acquisition, that is the time across the 10 divisions of the diagram: TimeScale``*10``.
:param acq_time: 250E-12 to 100E+3 (RTO, RTP) | 50E+3 (RTE)
"""
param = Conversions.decimal_value_to_str(acq_time)
self._core.io.write_with_opc(f'TIMebase:RANGe {param}')
[docs]
def get_reference(self) -> float:
"""
``TIMebase:REFerence`` \n
Snippet: ``value: float = driver.timebase.get_reference()`` \n
Sets the position of the reference point in % of the screen. The reference point marks the rescaling center of the time
scale. If you modify the time scale, the reference point remains fixed on the screen, and the scale is stretched or
compresses to both sides of the reference point.
"""
response = self._core.io.query_str_with_opc('TIMebase:REFerence?')
return Conversions.str_to_float(response)
[docs]
def set_reference(self, rescale_ctr_pt: float) -> None:
"""
``TIMebase:REFerence`` \n
Snippet: ``driver.timebase.set_reference(rescale_ctr_pt = 1.0)`` \n
Sets the position of the reference point in % of the screen. The reference point marks the rescaling center of the time
scale. If you modify the time scale, the reference point remains fixed on the screen, and the scale is stretched or
compresses to both sides of the reference point.
:param rescale_ctr_pt: 0 to 100
"""
param = Conversions.decimal_value_to_str(rescale_ctr_pt)
self._core.io.write_with_opc(f'TIMebase:REFerence {param}')
[docs]
def get_scale(self) -> float:
"""
``TIMebase:SCALe`` \n
Snippet: ``value: float = driver.timebase.get_scale()`` \n
Sets the horizontal scale - the time per division on the x-axis - for all channel and math waveforms.
The setting accuracy depends on the current resolution (sample rate) . \n
- No interpolation: The resolution is an integer multiple of the ADC sample rate.
- With interpolation: Any value for the horizontal scale can be set.
:return: time_scale: 25E-12 to 10000 (RTO, RTP) | 5000 (RTE)
"""
response = self._core.io.query_str_with_opc('TIMebase:SCALe?')
return Conversions.str_to_float(response)
[docs]
def set_scale(self, time_scale: float) -> None:
"""
``TIMebase:SCALe`` \n
Snippet: ``driver.timebase.set_scale(time_scale = 1.0)`` \n
Sets the horizontal scale - the time per division on the x-axis - for all channel and math waveforms.
The setting accuracy depends on the current resolution (sample rate) . \n
- No interpolation: The resolution is an integer multiple of the ADC sample rate.
- With interpolation: Any value for the horizontal scale can be set.
:param time_scale: 25E-12 to 10000 (RTO, RTP) | 5000 (RTE)
"""
param = Conversions.decimal_value_to_str(time_scale)
self._core.io.write_with_opc(f'TIMebase:SCALe {param}')
def clone(self) -> 'TimebaseCls':
"""
Clones the group by creating new object from it and its whole existing subgroups.
Also copies all the existing default Repeated Capabilities setting,
which you can change independently without affecting the original group.
"""
new_group = TimebaseCls(self._core, self._cmd_group.parent)
self._cmd_group.synchronize_repcaps(new_group)
return new_group