dodal.devices.util.mock_behaviour#

Functions

reset_signal_on_update_mock_factory(...[, ...])

Create a device mock that resets a signal following a reading update.

dodal.devices.util.mock_behaviour.reset_signal_on_update_mock_factory(signal_name: str, trigger_value: bool | int | float | str | StrictEnum | SubsetEnum | SupersetEnum | ndarray[tuple[int], dtype[bool]] | ndarray[tuple[int], dtype[int8]] | ndarray[tuple[int], dtype[uint8]] | ndarray[tuple[int], dtype[int16]] | ndarray[tuple[int], dtype[uint16]] | ndarray[tuple[int], dtype[int32]] | ndarray[tuple[int], dtype[uint32]] | ndarray[tuple[int], dtype[int64]] | ndarray[tuple[int], dtype[uint64]] | ndarray[tuple[int], dtype[float32]] | ndarray[tuple[int], dtype[float64]] | ndarray | Sequence[str] | Sequence[StrictEnum] | Sequence[SubsetEnum] | Sequence[SupersetEnum] | Table, reset_value: bool | int | float | str | StrictEnum | SubsetEnum | SupersetEnum | ndarray[tuple[int], dtype[bool]] | ndarray[tuple[int], dtype[int8]] | ndarray[tuple[int], dtype[uint8]] | ndarray[tuple[int], dtype[int16]] | ndarray[tuple[int], dtype[uint16]] | ndarray[tuple[int], dtype[int32]] | ndarray[tuple[int], dtype[uint32]] | ndarray[tuple[int], dtype[int64]] | ndarray[tuple[int], dtype[uint64]] | ndarray[tuple[int], dtype[float32]] | ndarray[tuple[int], dtype[float64]] | ndarray | Sequence[str] | Sequence[StrictEnum] | Sequence[SubsetEnum] | Sequence[SupersetEnum] | Table, reset_delay: float = 0.01)[source]#

Create a device mock that resets a signal following a reading update.

The mock subscribes to reading updates on a specified signal. When the signal reading matches the trigger value, the mock waits for the configured delay before setting the signal to its reset value.

This is useful for simulating asynchronous hardware behaviour, such as automatically returning a state PV to its idle value after an acquisition completes. It allows devices using set-and-wait logic to complete successfully when connected in mock mode.

Parameters:
  • signal_name (str) – Name of the device signal to monitor.

  • trigger_value (bool | int | float | str | StrictEnum | SubsetEnum | SupersetEnum | ndarray[tuple[int], dtype[bool]] | ndarray[tuple[int], dtype[int8]] | ndarray[tuple[int], dtype[uint8]] | ndarray[tuple[int], dtype[int16]] | ndarray[tuple[int], dtype[uint16]] | ndarray[tuple[int], dtype[int32]] | ndarray[tuple[int], dtype[uint32]] | ndarray[tuple[int], dtype[int64]] | ndarray[tuple[int], dtype[uint64]] | ndarray[tuple[int], dtype[float32]] | ndarray[tuple[int], dtype[float64]] | ndarray | Sequence[str] | Sequence[StrictEnum] | Sequence[SubsetEnum] | Sequence[SupersetEnum] | Table) – Reading value that causes the signal to be reset.

  • reset_value (bool | int | float | str | StrictEnum | SubsetEnum | SupersetEnum | ndarray[tuple[int], dtype[bool]] | ndarray[tuple[int], dtype[int8]] | ndarray[tuple[int], dtype[uint8]] | ndarray[tuple[int], dtype[int16]] | ndarray[tuple[int], dtype[uint16]] | ndarray[tuple[int], dtype[int32]] | ndarray[tuple[int], dtype[uint32]] | ndarray[tuple[int], dtype[int64]] | ndarray[tuple[int], dtype[uint64]] | ndarray[tuple[int], dtype[float32]] | ndarray[tuple[int], dtype[float64]] | ndarray | Sequence[str] | Sequence[StrictEnum] | Sequence[SubsetEnum] | Sequence[SupersetEnum] | Table) – Value to set after the matching reading update.

  • reset_delay (float, default: 0.01) – Delay in seconds between observing the matching reading and setting the reset value.

Returns:

A DeviceMock subclass implementing the reading-update behaviour.