|
3 | 3 | Welcome to ibex_bluesky_core's documentation! |
4 | 4 | ============================================= |
5 | 5 |
|
6 | | -This documentation contains information for the bluesky plan stubs & devices for use at ISIS. |
| 6 | +``ibex_bluesky_core`` is a library of common ``bluesky`` functionality and ``ophyd-async`` |
| 7 | +devices for use on the ISIS neutron & muon source's beamlines. |
| 8 | + |
| 9 | +`Bluesky <https://blueskyproject.io/bluesky/main/index.html>`_ is a generic data acquisition |
| 10 | +framework, which started at NSLS-ii but is developed as a multi-facility collaboration. Bluesky |
| 11 | +provides concepts such as "scanning" in a generic way. |
| 12 | + |
| 13 | +`ophyd-async <https://blueskyproject.io/ophyd-async/main/index.html>`_ is a python device |
| 14 | +abstraction library, which allows bluesky to communicate with an underlying control system |
| 15 | +(EPICS/IBEX, in our case). |
| 16 | + |
| 17 | +``ibex_bluesky_core`` provides: |
| 18 | + |
| 19 | +- Central configuration for core bluesky classes, such as the ``RunEngine``. |
| 20 | +- ``RunEngine`` Callbacks customized for use at ISIS: file writing, plotting, fitting, ... |
| 21 | +- Central implementations of ISIS device classes using ``ophyd-async``: Blocks, DAE, ... |
| 22 | +- Bluesky or scanning-related utilities which are useful across multiple beamlines. |
| 23 | + |
| 24 | + |
| 25 | +Overview |
| 26 | +======== |
| 27 | + |
| 28 | +.. note:: |
| 29 | + |
| 30 | + bluesky is a very flexible data acquisition framework. The following example illustrates a minimal scan, |
| 31 | + not the full extent of bluesky's functionality. |
| 32 | + |
| 33 | +Using ``ibex_bluesky_core``, one can define some simple instrument-specific devices:: |
| 34 | + |
| 35 | + from ibex_bluesky_core.devices.block import block_r, block_mot |
| 36 | + |
| 37 | + mot = block_mot("mot") # An IBEX block pointing at a motor |
| 38 | + det = block_r(float, "p5") # A readback block |
| 39 | + |
| 40 | +And define a simple step-scan which uses those devices:: |
| 41 | + |
| 42 | + import bluesky.plans as bp |
| 43 | + from ophyd_async.plan_stubs import ensure_connected |
| 44 | + |
| 45 | + def my_plan(start: float, stop: float, num: int): |
| 46 | + yield from ensure_connected(det, mot, force_reconnect=True) |
| 47 | + yield from bp.scan([det], mot, start, stop, num) |
| 48 | + |
| 49 | +After which, a simple scan can be run by a user:: |
| 50 | + |
| 51 | + from ibex_bluesky_core.run_engine import get_run_engine |
| 52 | + |
| 53 | + # A bluesky RunEngine instance, already available if using IBEX GUI |
| 54 | + RE = get_run_engine() |
| 55 | + |
| 56 | + # Scan "mot" from 0 to 10 in 5 steps, reading "my_detector" at each step. |
| 57 | + RE(my_plan(0, 10, 5)) |
| 58 | + |
| 59 | +That plan may then also use: |
| 60 | + |
| 61 | +- Other `experimental plans <https://blueskyproject.io/bluesky/main/plans.html#summary>`_ or |
| 62 | + `plan stubs <https://blueskyproject.io/bluesky/main/plans.html#stub-plans>`_, to build up more complex |
| 63 | + plans. |
| 64 | +- `Callbacks <https://blueskyproject.io/bluesky/main/callbacks.html>`_ provided by either |
| 65 | + ``ibex_bluesky_core`` or ``bluesky``, which do something with the results of the scan: live |
| 66 | + fitting, live plotting, file-writing, ... |
| 67 | +- `Simulation facilities <https://blueskyproject.io/bluesky/main/simulation.html>`_ provided by |
| 68 | + bluesky, to check for problems before the plan is run |
| 69 | +- And a range of other functionality! |
| 70 | + |
| 71 | +See the `manual system tests <https://github.com/ISISComputingGroup/ibex_bluesky_core/tree/main/manual_system_tests>`_ for |
| 72 | +some full runnable examples of complex plans, using a wider range of bluesky functionality. |
| 73 | + |
| 74 | +The reference documentation below lists the functionality that has been implemented in ``ibex_bluesky_core``, |
| 75 | +however the vast majority of `bluesky <https://blueskyproject.io/bluesky/main/index.html>`_ functionality remains |
| 76 | +available, and the advanced user is also encouraged to read that documentation. |
| 77 | + |
| 78 | +Reference documentation |
| 79 | +======================= |
7 | 80 |
|
8 | 81 | .. toctree:: |
9 | 82 | :maxdepth: 2 |
@@ -44,6 +117,7 @@ This documentation contains information for the bluesky plan stubs & devices for |
44 | 117 | :titlesonly: |
45 | 118 | :caption: Architectural decisions |
46 | 119 | :glob: |
| 120 | + :maxdepth: 1 |
47 | 121 |
|
48 | 122 | architectural_decisions/* |
49 | 123 |
|
|
0 commit comments