devctrl.devices.voltmeter.impl.keithley2700.Keithley2700#

class Keithley2700(instr, check_front_switch=True)[source]#

Bases: Voltmeter

Wrapper class for the Keithley2700 SMU controlled via pyvisa

Methods

add_device

Manually add a specific device.

allow_only_dummy_devices

beep

The Keithley2700 cant beep on command :(

buffer_clear

buffer_get_size

buffer_measure

buffer_read_new_values

Read new values from the buffer.

buffer_set_size

connect

connect_device

Connect to a Keithley 2700 device

connect_dummy

Connect an instance of the device's dummy implementation

get_base_classes

Return a flat dictionary of all base classes below this class :param recurse: If True, recursively search for base classes :return: dict of {class name: class}

get_device_name

get_device_type_name

get_status

Query the status of the device and return a string describing errors.

is_connected

Check if the device is connected and responding

list_devices

Get a list of all devices for this type.

measure

Continuously measure voltage at regular intervals

process_reading

Process a raw reading string into timestamp and voltage values

query

query_int

read_value

Read a single voltage measurement

reset

Reset the device

run

Run SCPI code on the device by writing it

run_script

Load and execute a SCPI script file

_CLASS_TYPE = 'implementation'#
__abstractmethods__ = frozenset({})#
__annotations__ = {'_manual_devices': list[str]}#
__del__()[source]#

Properly close the instrument connection

__dict__ = mappingproxy({'__module__': 'devctrl.devices.voltmeter.impl.keithley2700', '__firstlineno__': 13, '__doc__': '\nWrapper class for the Keithley2700 SMU controlled via pyvisa\n', '_CLASS_TYPE': 'implementation', '__init__': <function Keithley2700.__init__>, '__del__': <function Keithley2700.__del__>, '_check_front_input_selected': <function Keithley2700._check_front_input_selected>, 'query': <function Keithley2700.query>, 'query_int': <function Keithley2700.query_int>, 'run': <function Keithley2700.run>, 'run_script': <function Keithley2700.run_script>, 'beep': <function Keithley2700.beep>, 'reset': <function Keithley2700.reset>, 'buffer_clear': <function Keithley2700.buffer_clear>, 'buffer_get_size': <function Keithley2700.buffer_get_size>, 'buffer_set_size': <function Keithley2700.buffer_set_size>, 'buffer_measure': <function Keithley2700.buffer_measure>, 'buffer_read_new_values': <function Keithley2700.buffer_read_new_values>, 'process_reading': <function Keithley2700.process_reading>, 'read_value': <function Keithley2700.read_value>, 'measure': <function Keithley2700.measure>, 'is_connected': <function Keithley2700.is_connected>, '_enumerate_devices': <classmethod(<function Keithley2700._enumerate_devices>)>, 'connect_device': <classmethod(<function Keithley2700.connect_device>)>, '__repr__': <function Keithley2700.__repr__>, '__static_attributes__': ('buffer_next_idx', 'buffer_size', 'instr'), '__abstractmethods__': frozenset(), '_abc_impl': <_abc._abc_data object>, '_children': {}, '_manual_devices': []})#
__firstlineno__ = 13#
__init__(instr, check_front_switch=True)[source]#
__module__ = 'devctrl.devices.voltmeter.impl.keithley2700'#
__repr__() str[source]#

Get a string representation of the device

Returns:

Formatted string with device model and resource name

__slots__ = ()#
__static_attributes__ = ('buffer_next_idx', 'buffer_size', 'instr')#
__weakref__#

list of weak references to the object

_abc_impl = <_abc._abc_data object>#
_check_front_input_selected()[source]#

Make sure the front switch selecting the inputs selects the FRONT inputs Raises —— Exception

If front input state != 1

Returns#

switchstr

Front input state

_children = {}#
_dummies_only = False#
classmethod _enumerate_devices(query='(GPIB)|(USB)?*:INSTR')[source]#

Enumerate available Keithley 2700 devices

Uses the utility function to find devices matching the Keithley 2700 model.

Parameters:

query – VISA resource query pattern

Returns:

List of available device names

_manual_devices: list[str] = []#
classmethod add_device(connect_info)#

Manually add a specific device. The device will show up when list_devices() is called for the device type. Call this from the device class implementation, e.g. use ModelXYZ9000.add_device(‘GPIB:1234:5678’) to add a specific device with a fixed GPIB address. This is useful when automatic discovery is undesired/impossible, either because it is not implemented or it disturbs other devices which can’t handle a identification request. :param cls: The device implementation class :param connect_info: A string argument that is passed to the connect() method of the device implementation, when the device is being connected.

static allow_only_dummy_devices()#
beep(length=0.5, pitch=1000)[source]#

The Keithley2700 cant beep on command :(

buffer_clear()[source]#
buffer_get_size()[source]#
buffer_measure(interval: float = 0.5)[source]#
buffer_read_new_values() list[tuple[float, float]][source]#

Read new values from the buffer. :raises: RuntimeError if no buffer measurement was started :raises: ValueError if no new values have been measured yet :returns: List of (timestampe, voltage)

buffer_set_size(s)[source]#
classmethod connect(device_type_name: str, device_name: str | None, **kwargs) Device#
Parameters:
  • device_type_name – The name of the device class

  • device_name – The name of the device class

classmethod connect_device(device_name)[source]#

Connect to a Keithley 2700 device

Opens a VISA connection to the specified device and returns a configured instance.

Parameters:

device_name – VISA resource name of the device

Returns:

Configured Keithley2700 instance

classmethod connect_dummy(**kwargs) Device#

Connect an instance of the device’s dummy implementation

classmethod get_base_classes(recurse=True) dict[str, type[Device]]#

Return a flat dictionary of all base classes below this class :param recurse: If True, recursively search for base classes :return: dict of {class name: class}

classmethod get_device_name() str#
Returns:

The specific type name of the device, e.g., SR830 or Keithly2600

classmethod get_device_type_name() str#
Returns:

The general type name of the device, e.g., Lock-In Amplifier or Voltmeter

get_status() str#

Query the status of the device and return a string describing errors. If everything is ok, empty string must be returned :return: String of device status

is_connected() bool[source]#

Check if the device is connected and responding

Queries the device identification string to verify connection.

Returns:

True if device responds to *IDN? query, False otherwise

classmethod list_devices() list[tuple[str, str]]#

Get a list of all devices for this type. The list made up of: - Manually added devices - Available devices (those returned by _enumerate_devices) - A dummy device (if a dummy implementation exists) - List of all devices of child classes

Returns:

list of available devices

measure(interval: int, update_func: Callable[[int, float, float], None] | None = None, max_measurements: int | None = None)[source]#

Continuously measure voltage at regular intervals

Takes voltage readings at the specified interval, optionally calling an update function after each reading. Continues until max_measurements is reached or forever if None.

Parameters:
  • interval – Milliseconds to wait between readings

  • update_func – Function called after each reading with (n_reading, time, voltage). None for no callback

  • max_measurements – Number of readings to perform. None for infinite measurements

process_reading(reading: str) tuple[float, float][source]#

Process a raw reading string into timestamp and voltage values

Parses the Keithley 2700 format reading string and extracts the timestamp and voltage DC values.

Parameters:

reading – Raw reading string from the device

Returns:

Tuple of (timestamp, voltage) values

Raises:

ValueError – If the reading format is invalid

query(query)[source]#
query_int(query)[source]#
read_value() tuple[float, float][source]#

Read a single voltage measurement

Queries the device for a reading and processes it into timestamp and voltage values.

Returns:

Tuple of (timestamp, voltage) values

reset(verbose=False)[source]#

Reset the device

run(code, verbose=False)[source]#

Run SCPI code on the device by writing it

Empty lines, leading whitespaces and lines starting with ‘ or # are ignored.

Parameters:
  • code – SCPI commands to execute

  • verbose – If True, print the commands being executed

run_script(script_path, verbose=False)[source]#

Load and execute a SCPI script file

Loads the code from the specified file path and executes it using run().

Parameters:
  • script_path – Full path to the script file

  • verbose – If True, print status messages during execution