mobly.controllers.attenuator_lib package

Submodules

mobly.controllers.attenuator_lib.minicircuits module

This module has the class for controlling Mini-Circuits RCDAT series attenuators over Telnet.

See http://www.minicircuits.com/softwaredownload/Prog_Manual-6-Programmable_Attenuator.pdf

class mobly.controllers.attenuator_lib.minicircuits.AttenuatorDevice(path_count=1)[source]

Bases: object

This provides a specific telnet-controlled implementation of AttenuatorDevice for Mini-Circuits RC-DAT attenuators.

path_count

The number of signal attenuation path this device has.

close()[source]

Closes a telnet connection to the desired attenuator device.

This should be called as part of any teardown procedure prior to the attenuator instrument leaving scope.

get_atten(idx=0)[source]

This function returns the current attenuation from an attenuator at a given index in the instrument.

Parameters:idx – This zero-based index is the identifier for a particular attenuator in an instrument.
Raises:Error – The underlying telnet connection to the instrument is not open.
Returns:A float that is the current attenuation value.
is_open

This function returns the state of the telnet connection to the underlying AttenuatorDevice.

Returns:True if there is a successfully open connection to the AttenuatorDevice.
open(host, port=23)[source]

Opens a telnet connection to the desired AttenuatorDevice and queries basic information.

Parameters:
  • host – A valid hostname (IP address or DNS-resolvable name) to an MC-DAT attenuator instrument.
  • port – An optional port number (defaults to telnet default 23)
set_atten(idx, value)[source]

Sets the attenuation value for a particular signal path.

Parameters:
  • idx – Zero-based index int which is the identifier for a particular signal path in an instrument. For instruments that only has one channel, this is ignored by the device.
  • value – A float that is the attenuation value to set.
Raises:
  • Error – The underlying telnet connection to the instrument is not open.
  • IndexError – The index of the attenuator is greater than the maximum index of the underlying instrument.
  • ValueError – The requested set value is greater than the maximum attenuation value.

mobly.controllers.attenuator_lib.telnet_scpi_client module

Helper module for common telnet capability to communicate with AttenuatorDevice(s).

User code shouldn’t need to directly access this class.

class mobly.controllers.attenuator_lib.telnet_scpi_client.TelnetScpiClient(tx_cmd_separator='n', rx_cmd_separator='n', prompt='')[source]

Bases: object

This is an internal helper class for Telnet+SCPI command-based instruments. It should only be used by those implemention control libraries and not by any user code directly.

close()[source]
cmd(cmd_str, wait_ret=True)[source]
is_open
open(host, port=23)[source]

Module contents