id4_common.utils.make_devices#

Local overrides of apsbits make_devices and guarneri_namespace_loader that add a connect flag.

When connect=False, devices are instantiated and registered in __main__ / the oregistry but no EPICS connections are attempted. This restores the documented “deferred connection” pattern so that explicit connect_device(...) calls own all EPICS I/O — avoiding the DEFAULT_TIMEOUT wait and NotConnectedError log spam for devices whose IOCs are intentionally off.

These are line-for-line copies of the upstream functions in apsbits.core.instrument_init with the single addition of the connect parameter. Drop these helpers once apsbits exposes the same flag upstream.

Module Contents#

id4_common.utils.make_devices.logger#
id4_common.utils.make_devices.MAIN_NAMESPACE = '__main__'#
id4_common.utils.make_devices.make_devices(*, pause: float = 1, clear: bool = True, file: str, path: str | pathlib.Path | None = None, device_manager=None, connect: bool = True)#

Initialize ophyd-style devices using a device manager, optionally connect them, then make them part of the main namespace.

Local override of apsbits.core.instrument_init.make_devices that adds the connect flag.

PARAMETERS

pausefloat

Wait ‘pause’ seconds (default: 1) for slow objects to connect.

clearbool

Clear ‘oregistry’ first if True (the default).

filestr | pathlib.Path | None

Path to a YAML/TOML file containing device configurations.

pathstr | pathlib.Path | None

Optional alternative configs directory.

device_manager :

The device manager to use. Currently only ‘guarneri’ is supported.

connectbool

If True (default), eagerly try to connect every device after loading. If False, skip the connect step entirely — devices are instantiated and registered, but no EPICS I/O is performed. Use this when later connect_device(...) calls handle connections.

async id4_common.utils.make_devices.guarneri_namespace_loader(yaml_device_file, instrument=None, oregistry=None, main=True, connect: bool = True)#

Load our ophyd-style controls as described in a YAML file into the main namespace.

Local override of apsbits.core.instrument_init.guarneri_namespace_loader that adds the connect flag. When connect=False the eager await instrument.connect() call is skipped.

PARAMETERS

yaml_device_filestr or pathlib.Path

YAML file describing ophyd-style controls to be created.

mainbool

If True add these devices to the __main__ namespace.

connectbool

If True (default), eagerly try to connect every device. If False, only load and register them.