dodal.common.beamlines.beamline_utils#

Functions

active_device_is_same_type(active_device, device)

clear_device(name)

clear_devices()

device_instantiation(device_factory, name, ...)

Method to allow generic creation of singleton devices.

get_path_provider()

list_active_devices()

set_beamline(beamline)

set_path_provider(provider)

wait_for_connection(device[, timeout, mock])

dodal.common.beamlines.beamline_utils.set_beamline(beamline: str)[source]#
Parameters:

beamline (str)

dodal.common.beamlines.beamline_utils.clear_devices()[source]#
dodal.common.beamlines.beamline_utils.clear_device(name: str)[source]#
Parameters:

name (str)

dodal.common.beamlines.beamline_utils.list_active_devices() list[str][source]#
Return type:

list[str]

dodal.common.beamlines.beamline_utils.active_device_is_same_type(active_device: Device | Device, device: Callable[[...], Device | Device]) bool[source]#
Parameters:
  • active_device (Device | Device)

  • device (Callable[..., Device | Device])

Return type:

bool

dodal.common.beamlines.beamline_utils.wait_for_connection(device: Device | Device, timeout: float = DEFAULT_CONNECTION_TIMEOUT, mock: bool = False) None[source]#
Parameters:
  • device (Device | Device)

  • timeout (float, default: DEFAULT_CONNECTION_TIMEOUT)

  • mock (bool, default: False)

Return type:

None

dodal.common.beamlines.beamline_utils.device_instantiation(device_factory: Callable[[...], T], name: str, prefix: str, wait: bool, fake: bool, post_create: Callable[[T], None] | None = None, bl_prefix: bool = True, **kwargs) T[source]#

Method to allow generic creation of singleton devices. Meant to be used to easily define lists of devices in beamline files. Additional keyword arguments are passed directly to the device constructor.

Parameters:
  • device_factory (Callable[..., TypeVar(T, bound= Device | Device)]) – Callable the device class

  • name (str) – str the name for ophyd

  • prefix (str) – str the PV prefix for the most (usually all) components

  • wait (bool) – bool whether to run .wait_for_connection()

  • fake (bool) – bool whether to fake with ophyd.sim

  • post_create (Callable[[TypeVar(T, bound= Device | Device)], None] | None, default: None) – Callable (optional) a function to be run on the device after creation

  • bl_prefix (bool, default: True) – bool if true, add the beamline prefix when instantiating, if false the complete PV prefix must be supplied.

Return type:

TypeVar(T, bound= Device | Device)

Returns:

The instance of the device.

dodal.common.beamlines.beamline_utils.set_path_provider(provider: UpdatingPathProvider)[source]#
Parameters:

provider (UpdatingPathProvider)

dodal.common.beamlines.beamline_utils.get_path_provider() UpdatingPathProvider[source]#
Return type:

UpdatingPathProvider