devctrl.devices.lock_in.impl.dummy.DummyLockInAmp#

class DummyLockInAmp[source]#

Bases: LockInAmp, DummyDevice

Methods

add_device

Manually add a specific device.

allow_only_dummy_devices

auto_gain

buffer_get_data

Retrieve data from the buffer

buffer_get_max_size

Get the maximum buffer size for storing samples

buffer_get_n_points

Get the number of points currently in the buffer

buffer_is_done

Check if the target number of points are in the buffer

buffer_setup

Configure buffer settings for data acquisition

buffer_start_fill

Start a buffer measurement that was previously configured with buffer_setup()

buffer_stop_fill

Stop the current buffer measurement

check_overloads

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_device_name

get_device_type_name

get_filter_slope

get_frequency_Hz

get_next_valid_sample_rate_Hz

Get the highest valid sample rate not exceeding the target

get_reference

Get the current reference mode

get_reference_trigger

get_reserve

get_sensitivity_volt

get_status

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

get_sync_filter

get_time_constant_s

get_wait_time_s

Calculate wait time to reach 99% of final value

is_connected

Query whether the device is (still) connected

list_devices

Get a list of all devices for this type.

query

read_get_wait_time_s

Get the wait time required to reach 99% of the final value

read_value

Read a single value from the lock-in amplifier

reset

run

set_filter_slope

set_frequency_Hz

set_reference

set_reference_trigger

set_reserve

set_sensitivity_volt

set_sync_filter

set_time_constant_s

snap

Acquire a snapshot of multiple instrument values

start_check_overloads

Noop

try_recover_from_communication_error

Attributes

BUFFER_MAX_LENGTH = 16383#
SRAT = [0.0625, 0.125, 0.25, 0.5, 1, 2, 4, 8, 16, 32, 64, 128, 256, 512]#
VALID_FILTER_SLOPE = [6, 12, 18, 24]#
VALID_REFERENCE = ['External', 'Internal']#
VALID_SYNC_FILTER = [0, 1]#
_CLASS_TYPE = 'dummy'#
__abstractmethods__ = frozenset({})#
__annotations__ = {}#
__dict__ = mappingproxy({'__module__': 'devctrl.devices.lock_in.impl.dummy', '__firstlineno__': 8, '__init__': <function DummyLockInAmp.__init__>, 'run': <function DummyLockInAmp.run>, 'reset': <function DummyLockInAmp.reset>, 'read_value': <function DummyLockInAmp.read_value>, 'query': <function DummyLockInAmp.query>, 'snap': <function DummyLockInAmp.snap>, 'try_recover_from_communication_error': <function DummyLockInAmp.try_recover_from_communication_error>, 'start_check_overloads': <function DummyLockInAmp.start_check_overloads>, 'check_overloads': <function DummyLockInAmp.check_overloads>, 'VALID_REFERENCE': ['External', 'Internal'], 'set_reference': <function DummyLockInAmp.set_reference>, 'get_reference': <function DummyLockInAmp.get_reference>, 'set_frequency_Hz': <function DummyLockInAmp.set_frequency_Hz>, 'get_frequency_Hz': <function DummyLockInAmp.get_frequency_Hz>, 'set_reference_trigger': <function DummyLockInAmp.set_reference_trigger>, 'get_reference_trigger': <function DummyLockInAmp.get_reference_trigger>, 'set_sensitivity_volt': <function DummyLockInAmp.set_sensitivity_volt>, 'get_sensitivity_volt': <function DummyLockInAmp.get_sensitivity_volt>, 'set_time_constant_s': <function DummyLockInAmp.set_time_constant_s>, 'get_time_constant_s': <function DummyLockInAmp.get_time_constant_s>, 'VALID_FILTER_SLOPE': [6, 12, 18, 24], 'set_filter_slope': <function DummyLockInAmp.set_filter_slope>, 'get_filter_slope': <function DummyLockInAmp.get_filter_slope>, 'VALID_SYNC_FILTER': [0, 1], 'set_sync_filter': <function DummyLockInAmp.set_sync_filter>, 'get_sync_filter': <function DummyLockInAmp.get_sync_filter>, 'set_reserve': <function DummyLockInAmp.set_reserve>, 'get_reserve': <function DummyLockInAmp.get_reserve>, 'BUFFER_MAX_LENGTH': 16383, 'buffer_get_max_size': <function DummyLockInAmp.buffer_get_max_size>, 'SRAT': [0.0625, 0.125, 0.25, 0.5, 1, 2, 4, 8, 16, 32, 64, 128, 256, 512], 'get_next_valid_sample_rate_Hz': <function DummyLockInAmp.get_next_valid_sample_rate_Hz>, 'buffer_setup': <function DummyLockInAmp.buffer_setup>, 'buffer_start_fill': <function DummyLockInAmp.buffer_start_fill>, 'buffer_stop_fill': <function DummyLockInAmp.buffer_stop_fill>, 'buffer_is_done': <function DummyLockInAmp.buffer_is_done>, 'buffer_get_n_points': <function DummyLockInAmp.buffer_get_n_points>, 'buffer_get_data': <function DummyLockInAmp.buffer_get_data>, 'auto_gain': <function DummyLockInAmp.auto_gain>, '__repr__': <function DummyLockInAmp.__repr__>, '__static_attributes__': ('_buffer_length', '_buffer_what', 'amplitude', 'filter_slope', 'frequency', 'reference', 'reference_trigger', 'reserve', 'sensitivity_volt', 'sync_filter', 't0', 'time_constant_s'), '__doc__': None, '__abstractmethods__': frozenset(), '_abc_impl': <_abc._abc_data object>, '_children': {}, '_manual_devices': [], '_CLASS_TYPE': 'dummy'})#
__firstlineno__ = 8#
__init__()[source]#
__module__ = 'devctrl.devices.lock_in.impl.dummy'#
__repr__() str[source]#
Returns:

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

__slots__ = ()#
__static_attributes__ = ('_buffer_length', '_buffer_what', 'amplitude', 'filter_slope', 'frequency', 'reference', 'reference_trigger', 'reserve', 'sensitivity_volt', 'sync_filter', 't0', 'time_constant_s')#
__weakref__#

list of weak references to the object

_abc_impl = <_abc._abc_data object>#
_children = {}#
_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()#
auto_gain()[source]#
buffer_get_data(start=0, n_points: int | None = None)[source]#

Retrieve data from the buffer

Generates simulated data for testing purposes.

Parameters:
  • start – Starting index for data retrieval

  • n_points – Number of points to retrieve. None for all available

Returns:

NumPy array of shape [Q, N] where Q is number of quantities and N is number of points

buffer_get_max_size(n_values: int) int[source]#

Get the maximum buffer size for storing samples

Parameters:

n_values – Number of values stored per sample

Returns:

Maximum number of samples the buffer can hold

buffer_get_n_points(dont_log=True) int[source]#

Get the number of points currently in the buffer

Parameters:

dont_log – If False, log the operation

Returns:

Number of points in buffer

buffer_is_done() bool[source]#

Check if the target number of points are in the buffer

buffer_setup(what=['R', 'theta'], length=None, sample_rate_Hz=512)[source]#

Configure buffer settings for data acquisition

Sets up the buffer to store measurements of the specified quantities.

Parameters:
  • what – List of quantities to measure (e.g., [‘R’, ‘theta’])

  • length – Number of samples to acquire. None for maximum

  • sample_rate_Hz – Sample rate in Hz

buffer_start_fill()[source]#

Start a buffer measurement that was previously configured with buffer_setup()

buffer_stop_fill()[source]#

Stop the current buffer measurement

check_overloads() str[source]#
Returns:

Empty string

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

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}

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_filter_slope()[source]#
get_frequency_Hz() float[source]#
get_next_valid_sample_rate_Hz(target_sample_rate_Hz: int | float) int | float[source]#

Get the highest valid sample rate not exceeding the target

Parameters:

target_sample_rate_Hz – Desired sample rate in Hz

Returns:

The highest valid sample rate ≤ target_sample_rate_Hz

get_reference() str[source]#

Get the current reference mode

Returns:

Current reference mode (e.g., ‘External’, ‘Internal’)

get_reference_trigger()[source]#
get_reserve()[source]#
get_sensitivity_volt()[source]#
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

get_sync_filter()[source]#
get_time_constant_s()[source]#
classmethod get_wait_time_s(time_const: float, filter_slope: int)#

Calculate wait time to reach 99% of final value

This method implements the SR830 filter slope timing rules. Subclasses with different filter slopes must override this method.

Parameters:
  • time_const – Time constant in seconds

  • filter_slope – Filter slope in dB/octave (6, 12, 18, or 24)

Returns:

Wait time in seconds

Raises:

ValueError – If filter_slope is invalid

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

query(query)[source]#
read_get_wait_time_s(time_const: float | None = None, filter_slope: int | None = None)#

Get the wait time required to reach 99% of the final value

Uses the rule of thumb from SR830 manual to wait 5 time constants (page 6-35) depending on the filter slope. See SR830 Manual 3-21.

Parameters:
  • time_const – Time constant in seconds. If None, read from device

  • filter_slope – Filter slope in dB/octave. If None, read from device

Returns:

Wait time in seconds to reach 99% of final value

read_value(which='R') float[source]#

Read a single value from the lock-in amplifier

Generates a simulated sine wave signal for testing purposes.

Parameters:

which – Which value to read (X, Y, R, theta, etc.)

Returns:

Simulated measurement value

reset(verbose=False)[source]#
run(code, verbose=False)[source]#
set_filter_slope(slope_db_oct)[source]#
set_frequency_Hz(frequency_Hz)[source]#
set_reference(reference)[source]#
set_reference_trigger(trigger)[source]#
set_reserve(reserve)[source]#
set_sensitivity_volt(volt)[source]#
set_sync_filter(sync)[source]#
set_time_constant_s(dt)[source]#
snap(what='3,4,5,7')[source]#

Acquire a snapshot of multiple instrument values

Takes a single measurement of the specified quantities and returns them as a list.

  • 1 X

  • 2 Y

  • 3 R

  • 4 θ

  • 5 Aux In 1

  • 6 Aux In 2

  • 7 Aux In 3

  • 8 Aux In 4

  • 9 Reference Frequency

  • 10 CH1 display

  • 11 CH2 display

Parameters:

what – Comma-separated list of value indices to measure (1-11). Default: “3,4,5,7”

Returns:

List of simulated values in the order requested

start_check_overloads()[source]#

Noop

try_recover_from_communication_error(original_error)[source]#