instrument.utils
¶
Add Python modules here that provide any other code not covered by callbacks, configs, core, devices, or plans.
APS utility helper functions |
|
EPICS & ophyd related setup |
|
Generic utility helper functions |
|
Configure logging for this session. |
|
RunEngine Metadata |
APS utility helper functions¶
Detect if this host is on an APS subnet. |
|
|
APS Data Management setup |
- instrument.utils.aps_functions.aps_dm_setup(dm_setup_file)[source]¶
APS Data Management setup¶
Read the bash shell script file used by DM to setup the environment. Parse any
export
lines and add their environment variables to this session. This is done by brute force here since the APS DM environment setup requires different Python code than bluesky and the two often clash.This setup must be done before any of the DM package libraries are called.
- instrument.utils.aps_functions.host_on_aps_subnet()[source]¶
Detect if this host is on an APS subnet.
- instrument.utils.controls_setup.connect_scan_id_pv(RE, pv: str = None)[source]¶
Define a PV to use for the RunEngine’s scan_id.
- instrument.utils.controls_setup.epics_scan_id_source(scan_id_epics, _md)[source]¶
Callback function for RunEngine. Returns next scan_id to be used.
Ignore metadata dictionary passed as argument.
Get current scan_id from PV.
Apply lower limit of zero.
Increment (so that scan_id numbering starts from 1).
Set PV with new value.
Return new value.
Exception will be raised if PV is not connected when next
bps.open_run()
is called.
- instrument.utils.controls_setup.oregistry¶
Registry of all ophyd-style Devices and Signals.
- instrument.utils.controls_setup.set_control_layer(control_layer: str = 'PyEpics')[source]¶
Communications library between ophyd and EPICS Channel Access.
Choices are: PyEpics (default) or caproto.
OPHYD_CONTROL_LAYER is an application of “lessons learned.”
Only used in a couple rare cases where PyEpics code was failing. It’s defined here since it was difficult to find how to do this in the ophyd documentation.
- instrument.utils.controls_setup.set_timeouts()[source]¶
Set default timeout for all EpicsSignal connections & communications.
Generic utility helper functions¶
Detect if running in the bluesky queueserver. |
|
MatPlotLib setup. |
|
Detect if running in a notebook. |
- instrument.utils.helper_functions.running_in_queueserver()[source]¶
Detect if running in the bluesky queueserver.
Configure logging for this session.
There are many _loggers_ to control the level of detailed logging for some
bluesky/ophyd internals. The next table shows some of the many possible logger
names. Configure the ACTIVATE_LOGGERS
dictionary (below, where the keys are
logger names and the values are logging level, as shown) with any of these
names, or others which you may find useful:
logger name |
description |
---|---|
|
logger to which all bluesky log records propagate |
|
when a Document is emitted. The log record does not contain the full content of the Document. |
|
Records from a RunEngine. INFO-level notes state changes. DEBUG-level notes when each message from a plan is about to be processed and when a status object has completed. |
|
when each |
|
when the RunEngine’s state changes. |
|
logger to which all databroker log records propagate |
|
logger to which all ophyd log records propagate |
|
records from all devices and signals (that is, OphydObject subclasses) |
|
requests issued to the underlying control layer (e.g. pyepics, caproto) |
|
regular summaries of the backlog of updates from the control layer that are being processed on background threads |
References:
https://blueskyproject.io/ophyd/user_v1/reference/logging.html#logger-names
https://blueskyproject.io/bluesky/debugging.html#logger-names
- instrument.utils._logging_setup.configure_logging()[source]¶
configure logging setup to be used with instrument package
RunEngine Metadata¶
PersistentDict Directory to save RE metadata between sessions. |
|
Get PersistentDict directory for RE metadata. |
|
|
Programmatic metadata for the RunEngine. |
- instrument.utils.metadata.MD_PATH = '/home/runner/.config/Bluesky_RunEngine_md'¶
PersistentDict Directory to save RE metadata between sessions.