Source code for RsSmw.Implementations.Test.Bb.Generator

from .....Internal.Core import Core
from .....Internal.CommandsGroup import CommandsGroup
from .....Internal import Conversions
from .....Internal.Utilities import trim_str_response
from ..... import enums


# noinspection PyPep8Naming,PyAttributeOutsideInit,SpellCheckingInspection
class GeneratorCls:
	"""
	| Commands in total: 12
	| Subgroups: 5
	| Direct child commands: 3
	"""

	def __init__(self, core: Core, parent):
		self._core = core
		self._cmd_group = CommandsGroup("generator", core, parent)

	@property
	def const(self):
		"""
		| Commands in total: 2
		| Subgroups: 0
		| Direct child commands: 2
		"""
		if not hasattr(self, '_const'):
			from .Const import ConstCls
			self._const = ConstCls(self._core, self._cmd_group)
		return self._const

	@property
	def frequency(self):
		"""
		| Commands in total: 1
		| Subgroups: 0
		| Direct child commands: 1
		"""
		if not hasattr(self, '_frequency'):
			from .Frequency import FrequencyCls
			self._frequency = FrequencyCls(self._core, self._cmd_group)
		return self._frequency

	@property
	def gain(self):
		"""
		| Commands in total: 3
		| Subgroups: 0
		| Direct child commands: 3
		"""
		if not hasattr(self, '_gain'):
			from .Gain import GainCls
			self._gain = GainCls(self._core, self._cmd_group)
		return self._gain

	@property
	def offset(self):
		"""
		| Commands in total: 2
		| Subgroups: 0
		| Direct child commands: 2
		"""
		if not hasattr(self, '_offset'):
			from .Offset import OffsetCls
			self._offset = OffsetCls(self._core, self._cmd_group)
		return self._offset

	@property
	def phase(self):
		"""
		| Commands in total: 1
		| Subgroups: 0
		| Direct child commands: 1
		"""
		if not hasattr(self, '_phase'):
			from .Phase import PhaseCls
			self._phase = PhaseCls(self._core, self._cmd_group)
		return self._phase

[docs] def get_arbitrary(self) -> str: """ ``TEST:BB:GENerator:ARBitrary`` \n Snippet: ``value: str = driver.test.bb.generator.get_arbitrary()`` \n Selects the ARB waveform to be tested. :return: filename: string """ response = self._core.io.query_str('TEST:BB:GENerator:ARBitrary?') return trim_str_response(response)
[docs] def set_arbitrary(self, filename: str) -> None: """ ``TEST:BB:GENerator:ARBitrary`` \n Snippet: ``driver.test.bb.generator.set_arbitrary(filename = 'abc')`` \n Selects the ARB waveform to be tested. :param filename: string """ param = Conversions.value_to_quoted_str(filename) self._core.io.write(f'TEST:BB:GENerator:ARBitrary {param}')
# noinspection PyTypeChecker
[docs] def get_source(self) -> enums.TestBbGenIqSour: """ ``TEST:BB:GENerator:SOURce`` \n Snippet: ``value: enums.TestBbGenIqSour = driver.test.bb.generator.get_source()`` \n Selects the test signal source. :return: iq_source: SINE | CONStant | ARB | TTONe SINE Generates a sine waveform. To determine the frequency, use method ``RsSmw.test.bb.generator.frequency.set()`` . CONStant Uses a constant I/Q test signal. ARB Selects a signal generated generated by the ARB. """ response = self._core.io.query_str('TEST:BB:GENerator:SOURce?') return Conversions.str_to_scalar_enum(response, enums.TestBbGenIqSour)
[docs] def set_source(self, iq_source: enums.TestBbGenIqSour) -> None: """ ``TEST:BB:GENerator:SOURce`` \n Snippet: ``driver.test.bb.generator.set_source(iq_source = enums.TestBbGenIqSour.ARB)`` \n Selects the test signal source. :param iq_source: SINE | CONStant | ARB | TTONe SINE Generates a sine waveform. To determine the frequency, use method ``RsSmw.test.bb.generator.frequency.set()`` . CONStant Uses a constant I/Q test signal. ARB Selects a signal generated generated by the ARB. """ param = Conversions.enum_scalar_to_str(iq_source, enums.TestBbGenIqSour) self._core.io.write(f'TEST:BB:GENerator:SOURce {param}')
[docs] def get_state(self) -> bool: """ ``TEST:BB:GENerator:STATe`` \n Snippet: ``value: bool = driver.test.bb.generator.get_state()`` \n Starts the test generator. :return: state: 1 | ON | 0| OFF """ response = self._core.io.query_str('TEST:BB:GENerator:STATe?') return Conversions.str_to_bool(response)
[docs] def set_state(self, state: bool) -> None: """ ``TEST:BB:GENerator:STATe`` \n Snippet: ``driver.test.bb.generator.set_state(state = False)`` \n Starts the test generator. :param state: 1 | ON | 0| OFF """ param = Conversions.bool_to_str(state) self._core.io.write(f'TEST:BB:GENerator:STATe {param}')
def clone(self) -> 'GeneratorCls': """ 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 = GeneratorCls(self._core, self._cmd_group.parent) self._cmd_group.synchronize_repcaps(new_group) return new_group