ibex_bluesky_core.run_engine

Utilities for the bluesky run engine, configured for IBEX.

Members

get_run_engine

Acquire a RunEngine in a suitable configuration for ISIS experiments.

ibex_bluesky_core.run_engine.get_run_engine() RunEngine[source]

Acquire a RunEngine in a suitable configuration for ISIS experiments.

This function should always be used in preference to creating a bluesky run engine manually.

This function is cached, meaning that the same run engine (using the same underlying event loop) will be used if this function is called multiple times. Creating multiple RunEngines is unlikely to be desired behaviour, though we cannot prevent users from creating a RunEngine from bluesky directly.

Basic usage:

  • Get the IBEX run engine:

    RE = get_run_engine()
    
  • Run a plan:

    from bluesky.plans import count  # Or any other plan
    det = ...  # A "detector" object, for example a Block or Dae device.
    RE(count([det]))
    
  • Control the state of the run engine:

    RE.abort(reason="...")  # Stop a plan, do cleanup, and mark as failed (e.g. bad data).
    RE.stop()  # Stop a plan, do cleanup, mark as success"(e.g. scan has moved past peak).
    RE.halt()  # Stop a plan, don't do any cleanup, just abort with no further action.
    RE.resume()  # Resume running a previously-paused plan.
    
  • Subscribe to data emitted by this run engine:

    RE.subscribe(lambda name, document: ...)
    

For full documentation about the run engine, see: - https://nsls-ii.github.io/bluesky/tutorial.html#the-runengine - https://nsls-ii.github.io/bluesky/run_engine_api.html