dodal.common.beamlines.beamline_utils#

Functions

active_device_is_same_type(active_device, device)

param active_device:

clear_device(name)

param name:

clear_devices()

device_instantiation(device_factory, name, ...)

Method to allow generic creation of singleton devices.

get_directory_provider()

rtype:

UpdatingDirectoryProvider

list_active_devices()

rtype:

List[str]

set_beamline(beamline)

param beamline:

set_directory_provider(provider)

param provider:

wait_for_connection(device[, timeout, mock])

param device:

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 (Optional[Callable[[TypeVar(T, bound= Device | Device)], 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_directory_provider(provider: UpdatingDirectoryProvider)[source]#
Parameters:

provider (UpdatingDirectoryProvider)

dodal.common.beamlines.beamline_utils.get_directory_provider() UpdatingDirectoryProvider[source]#
Return type:

UpdatingDirectoryProvider