mobly.controllers.attenuator_lib package


mobly.controllers.attenuator_lib.minicircuits module

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


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.


The number of signal attenuation path this device has.


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.


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.

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.

  • 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.

  • 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.
  • 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.

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

Module contents