devctrl.devices.amplifier.base.Amplifier#
- class Amplifier[source]#
Bases:
DeviceMethods
Manually add a specific device.
Connect a device of this class.
Parse a device name string and return the connected device.
Connect an instance of the device's dummy implementation
Perform actions required to cleanly delete the object, like releasing resources and ports.
Return a flat dictionary of all base classes below this class
Get the current coupling mode
Get the current gain setting
Query the status of the device and return a string describing errors.
Query whether the device is (still) connected
Get a list of all devices for this type.
Set the amplifier coupling mode
- _CLASS_TYPE = 'base'#
- __abstractmethods__ = frozenset({'__repr__', 'connect_device', 'decrease_gain', 'get_coupling', 'get_gain', 'increase_gain', 'is_connected', 'set_coupling', 'set_gain'})#
- __annotations__ = {'_manual_devices': list[str]}#
- __dict__ = mappingproxy({'__module__': 'devctrl.devices.amplifier.base', '__firstlineno__': 4, '_CLASS_TYPE': 'base', 'set_gain': <function Amplifier.set_gain>, 'get_gain': <function Amplifier.get_gain>, 'increase_gain': <function Amplifier.increase_gain>, 'decrease_gain': <function Amplifier.decrease_gain>, 'set_coupling': <function Amplifier.set_coupling>, 'get_coupling': <function Amplifier.get_coupling>, 'get_settings_str': <function Amplifier.get_settings_str>, 'get_device_type_name': <classmethod(<function Amplifier.get_device_type_name>)>, '__static_attributes__': (), '__doc__': None, '__abstractmethods__': frozenset({'__repr__', 'connect_device', 'decrease_gain', 'increase_gain', 'set_coupling', 'get_coupling', 'get_gain', 'set_gain', 'is_connected'}), '_abc_impl': <_abc._abc_data object>, '_children': {'DummyAmplifier': <class 'devctrl.devices.amplifier.impl.dummy.DummyAmplifier'>, 'FemtoDLPCA200': <class 'devctrl.devices.amplifier.impl.femto.FemtoDLPCA200'>}, '_manual_devices': []})#
- __firstlineno__ = 4#
- __module__ = 'devctrl.devices.amplifier.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 = {'DummyAmplifier': <class 'devctrl.devices.amplifier.impl.dummy.DummyAmplifier'>, 'FemtoDLPCA200': <class 'devctrl.devices.amplifier.impl.femto.FemtoDLPCA200'>}#
- _dummies_only = False#
- classmethod _enumerate_devices() list[str]#
List all discoverable devices for this type.
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()- Returns:
list of strings that can be parsed by
connect_device().
- _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. useModelXYZ9000.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 theconnect()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#
Connect a device of this class.
- 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#
Parse a device name string and return the connected 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 toconnect().- Parameters:
device_name – The name of the device, as returned by
_enumerate_devices().
- classmethod connect_dummy(**kwargs) Device#
Connect an instance of the device’s dummy implementation
- exit() None#
Perform actions required to cleanly delete the object, like releasing resources and ports.
- classmethod get_base_classes(recurse=True) dict[str, type[Device]]#
Return a flat dictionary of all base classes below this class
- Parameters:
recurse – If True, recursively search for base classes
- Returns:
dict of {class name: class}
- abstractmethod get_coupling() str[source]#
Get the current coupling mode
- Returns:
Current coupling mode (‘AC’ or ‘DC’)
- 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
- abstractmethod get_gain() int[source]#
Get the current gain setting
- Returns:
Exponent of the gain (10^gain)
- get_status() str#
Query the status of the device and return a string describing errors. If everything is ok, empty string must be returned
- Returns:
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