devctrl.devices.led_controller.base.LedController#

class LedController[source]#

Bases: Device

Methods

add_device

Manually add a specific device.

allow_only_dummy_devices

connect

connect_device

This function should be overridden by device implementations only, and is not intended to be used directly.

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_brightness_percent

get_capabilities

Get controller capabilities bitmask

get_current_A

get_device_name

get_device_type_name

get_led_name

get_mode

Query the current device operating mode

get_status

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

is_connected

Query whether the device is (still) connected

list_devices

Get a list of all devices for this type.

off

Set the LED brightness to 0%

on

Set the LED brightness to 100%

set_brightness_percent

Set the LED brightness to a specific percentage

set_current_A

set_mode

Set the device operating mode

Attributes

BRIGHTNESS_ON_OFF = 2#
BRIGHTNESS_PERCENT = 1#
VALID_BRIGHTNESS_PERCENT = (0, 100)#
_CLASS_TYPE = 'base'#
__abstractmethods__ = frozenset({'__repr__', 'connect_device', 'get_brightness_percent', 'get_capabilities', 'get_mode', 'is_connected', 'off', 'on', 'set_brightness_percent', 'set_mode'})#
__annotations__ = {'_manual_devices': list[str]}#
__dict__ = mappingproxy({'__module__': 'devctrl.devices.led_controller.base', '__firstlineno__': 10, '_CLASS_TYPE': 'base', 'BRIGHTNESS_PERCENT': 1, 'BRIGHTNESS_ON_OFF': 2, 'on': <function LedController.on>, 'off': <function LedController.off>, 'VALID_BRIGHTNESS_PERCENT': (0, 100), 'set_brightness_percent': <function LedController.set_brightness_percent>, 'get_brightness_percent': <function LedController.get_brightness_percent>, 'set_mode': <function LedController.set_mode>, 'get_mode': <function LedController.get_mode>, 'set_current_A': <function LedController.set_current_A>, 'get_current_A': <function LedController.get_current_A>, 'get_capabilities': <function LedController.get_capabilities>, 'get_led_name': <function LedController.get_led_name>, 'get_device_type_name': <classmethod(<function LedController.get_device_type_name>)>, '__static_attributes__': (), '__doc__': None, '__abstractmethods__': frozenset({'get_capabilities', 'is_connected', 'off', 'on', 'get_brightness_percent', 'get_mode', '__repr__', 'connect_device', 'set_mode', 'set_brightness_percent'}), '_abc_impl': <_abc._abc_data object>, '_children': {'DummyLedController': <class 'devctrl.devices.led_controller.impl.dummy.DummyLedController'>, 'LEDD1B': <class 'devctrl.devices.led_controller.impl.thorlabs_ledd1b.LEDD1B'>, 'DC2200': <class 'devctrl.devices.led_controller.impl.thorlabs_dc2200.DC2200'>}, '_manual_devices': []})#
__firstlineno__ = 10#
__module__ = 'devctrl.devices.led_controller.base'#
abstractmethod __repr__() str#
Returns:

The name of the device. If applicable, this should include serial port, GPIB address, etc.

__slots__ = ()#
__static_attributes__ = ()#
__weakref__#

list of weak references to the object

_abc_impl = <_abc._abc_data object>#
_children = {'DC2200': <class 'devctrl.devices.led_controller.impl.thorlabs_dc2200.DC2200'>, 'DummyLedController': <class 'devctrl.devices.led_controller.impl.dummy.DummyLedController'>, 'LEDD1B': <class 'devctrl.devices.led_controller.impl.thorlabs_ledd1b.LEDD1B'>}#
_dummies_only = False#
classmethod _enumerate_devices() list[str]#

This function should be overridden by device implementations only, and is not intended to be used directly. Instead, use list_devices() to get a list of devices. Use enumerate_devices only directly when you only want to list devices of one specific implementation, i.e., only SR830 Lock-In: SR830._enumerate_devices() :param class_name: The name of the device class

_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()#
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

abstractmethod classmethod connect_device(device_name: str) Device#

This function should be overridden by device implementations only, and is not intended to be used directly. Instead, use list_devices() to get a list of devices, and pass the selected device type and name to connect() :param device_name: The name of the device class

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}

abstractmethod get_brightness_percent()[source]#
abstractmethod get_capabilities() int[source]#

Get controller capabilities bitmask

Returns a bitmask indicating supported features. Use the class constants BRIGHTNESS_PERCENT and BRIGHTNESS_ON_OFF to check capabilities.

Returns:

Capabilities bitmask

get_current_A()[source]#
classmethod get_device_name() str#
Returns:

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

classmethod get_device_type_name() str[source]#
Returns:

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

get_led_name() None | str[source]#
abstractmethod get_mode() str[source]#

Query the current device operating mode

Returns:

Current mode identifier string

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

abstractmethod is_connected() bool#

Query whether the device is (still) connected

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

abstractmethod off()[source]#

Set the LED brightness to 0%

abstractmethod on()[source]#

Set the LED brightness to 100%

abstractmethod set_brightness_percent(level: int)[source]#

Set the LED brightness to a specific percentage

Parameters:

level – Brightness level in percent (0-100)

set_current_A(current_A: float)[source]#
abstractmethod set_mode(mode: str)[source]#

Set the device operating mode

Parameters:

mode – Mode identifier string