from ...Internal.Core import Core
from ...Internal.CommandsGroup import CommandsGroup
from ...Internal import Conversions
from ... import enums
# noinspection PyPep8Naming,PyAttributeOutsideInit,SpellCheckingInspection
class PsrcCls:
"""
| Commands in total: 6
| Subgroups: 1
| Direct child commands: 5
"""
def __init__(self, core: Core, parent):
self._core = core
self._cmd_group = CommandsGroup("psrc", core, parent)
@property
def rst(self):
"""
| Commands in total: 1
| Subgroups: 0
| Direct child commands: 1
"""
if not hasattr(self, '_rst'):
from .Rst import RstCls
self._rst = RstCls(self._core, self._cmd_group)
return self._rst
[docs]
def get_state(self) -> bool:
"""
``PSRC[:STATe]`` \n
Snippet: ``value: bool = driver.psrc.get_state()`` \n
Switches the pulse output on and off.
:return: state: OFF | ON
"""
response = self._core.io.query_str_with_opc('PSRC:STATe?')
return Conversions.str_to_bool(response)
[docs]
def set_state(self, state: bool) -> None:
"""
``PSRC[:STATe]`` \n
Snippet: ``driver.psrc.set_state(state = False)`` \n
Switches the pulse output on and off.
:param state: OFF | ON
"""
param = Conversions.bool_to_str(state)
self._core.io.write_with_opc(f'PSRC:STATe {param}')
[docs]
def get_output_low(self) -> float:
"""
``PSRC:OUTPutlow`` \n
Snippet: ``value: float = driver.psrc.get_output_low()`` \n
Sets the low level of the output pulse.
:return: output_low_level: -0.2 to -0.05
"""
response = self._core.io.query_str_with_opc('PSRC:OUTPutlow?')
return Conversions.str_to_float(response)
[docs]
def set_output_low(self, output_low_level: float) -> None:
"""
``PSRC:OUTPutlow`` \n
Snippet: ``driver.psrc.set_output_low(output_low_level = 1.0)`` \n
Sets the low level of the output pulse.
:param output_low_level: -0.2 to -0.05
"""
param = Conversions.decimal_value_to_str(output_low_level)
self._core.io.write_with_opc(f'PSRC:OUTPutlow {param}')
[docs]
def get_rep_rate(self) -> float:
"""
``PSRC:REPRate`` \n
Snippet: ``value: float = driver.psrc.get_rep_rate()`` \n
Sets the pulse frequency, the repetition rate of the pulse.
:return: repetition_rate: Available values depend on the selected clock mode: Locked: 5/10/20/50/100/200/500 Hz, 1/5/10/25/50/100/250 MHz Free running: 5/10/20/50/100/200/500 Hz, 1/5/10/25/50 MHz
"""
response = self._core.io.query_str_with_opc('PSRC:REPRate?')
return Conversions.str_to_float(response)
[docs]
def set_rep_rate(self, repetition_rate: float) -> None:
"""
``PSRC:REPRate`` \n
Snippet: ``driver.psrc.set_rep_rate(repetition_rate = 1.0)`` \n
Sets the pulse frequency, the repetition rate of the pulse.
:param repetition_rate: Available values depend on the selected clock mode: Locked: 5/10/20/50/100/200/500 Hz, 1/5/10/25/50/100/250 MHz Free running: 5/10/20/50/100/200/500 Hz, 1/5/10/25/50 MHz
"""
param = Conversions.decimal_value_to_str(repetition_rate)
self._core.io.write_with_opc(f'PSRC:REPRate {param}')
[docs]
def get_duty_cycle(self) -> float:
"""
``PSRC:DUTYcycle`` \n
Snippet: ``value: float = driver.psrc.get_duty_cycle()`` \n
Sets the duty cycle of the pulse, which is the ratio of the positive pulse width to the period of the signal.
:return: duty_cycle: For repetition rates 5 MHz, the value is fixed at 50 %.
"""
response = self._core.io.query_str_with_opc('PSRC:DUTYcycle?')
return Conversions.str_to_float(response)
[docs]
def set_duty_cycle(self, duty_cycle: float) -> None:
"""
``PSRC:DUTYcycle`` \n
Snippet: ``driver.psrc.set_duty_cycle(duty_cycle = 1.0)`` \n
Sets the duty cycle of the pulse, which is the ratio of the positive pulse width to the period of the signal.
:param duty_cycle: For repetition rates 5 MHz, the value is fixed at 50 %.
"""
param = Conversions.decimal_value_to_str(duty_cycle)
self._core.io.write_with_opc(f'PSRC:DUTYcycle {param}')
# noinspection PyTypeChecker
[docs]
def get_clock_mode(self) -> enums.ClockMode:
"""
``PSRC:CLOCkmode`` \n
Snippet: ``value: enums.ClockMode = driver.psrc.get_clock_mode()`` \n
Sets the dependency of the pulse clock on the instrument's reference clock.
:return: clock_mode: LOCKed | FREerunning \n
- LOCKed: The pulse source is locked to the reference clock of the instrument.
- FREerunning: The clock of the pulse source is independent. Deviations of the system do not affect the pulse clock, and deterministic conditions are avoided.
"""
response = self._core.io.query_str_with_opc('PSRC:CLOCkmode?')
return Conversions.str_to_scalar_enum(response, enums.ClockMode)
[docs]
def set_clock_mode(self, clock_mode: enums.ClockMode) -> None:
"""
``PSRC:CLOCkmode`` \n
Snippet: ``driver.psrc.set_clock_mode(clock_mode = enums.ClockMode.FREerunning)`` \n
Sets the dependency of the pulse clock on the instrument's reference clock.
:param clock_mode: LOCKed | FREerunning \n
- LOCKed: The pulse source is locked to the reference clock of the instrument.
- FREerunning: The clock of the pulse source is independent. Deviations of the system do not affect the pulse clock, and deterministic conditions are avoided.
"""
param = Conversions.enum_scalar_to_str(clock_mode, enums.ClockMode)
self._core.io.write_with_opc(f'PSRC:CLOCkmode {param}')
def clone(self) -> 'PsrcCls':
"""
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 = PsrcCls(self._core, self._cmd_group.parent)
self._cmd_group.synchronize_repcaps(new_group)
return new_group