Skip to content

Commit 541ec39

Browse files
authored
Merge pull request #46 from ISISComputingGroup/tidy_docs
Tidy up docs; add an intro
2 parents 7063ad4 + 6537eed commit 541ec39

File tree

4 files changed

+87
-9
lines changed

4 files changed

+87
-9
lines changed

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
Core bluesky plan stubs & devices for use at ISIS. Not instrument/technique specific.
44

5-
### Documentation
5+
Documentation: https://isiscomputinggroup.github.io/ibex_bluesky_core/
66

7-
See `doc/` folder for developer and user information e.g. how to set up a development
8-
environment or how to create a release.
7+
Source: https://github.com/ISISComputingGroup/ibex_bluesky_core
8+
9+
PyPi: https://pypi.org/project/ibex-bluesky-core/

doc/architectural_decisions/004-use-scipp.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ Current
88

99
A decision needs to be made about whether to use scipp, numpy, uncertainties or develop our own library for the purpose of providing support for generating uncertanties on our counts data.
1010

11-
# Decision
11+
## Decision
1212

1313
We will be using scipp.
1414

15-
# Justification & Consequences
15+
## Justification & Consequences
1616

1717
- `scipp` is being developed at ESS with past input from STFC, so is well suited for neutron counts data.
1818
- `scipp` has a `numpy`-like interface but handles units and uncertainties by default under-the-hood.
Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
# Bluesky logger
1+
# Logging
22

3-
To invoke the bluesky logger, import as `from ibex_bluesky_core.logger import logger` and use it at the desired level:
4-
`logger.blueskylogger.warning("Message to be logged")`
3+
To invoke the bluesky logger, import and use it at the desired level:
4+
```python
5+
from ibex_bluesky_core.logger import logger
6+
logger.blueskylogger.warning("Message to be logged")
7+
```
58
The logger utilizes a `TimedRotatingFileHandler` defined in the `logging.conf` file that rolls over the log at midnight.
69

710
The default logging level is defined at `INFO`. This means that events of lesser severity will not be logged. To change the default level, change level attribute of logger_blueskycore in the `logging.conf`

doc/index.rst

Lines changed: 75 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,80 @@
33
Welcome to ibex_bluesky_core's documentation!
44
=============================================
55

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+
=======================
780

881
.. toctree::
982
:maxdepth: 2
@@ -44,6 +117,7 @@ This documentation contains information for the bluesky plan stubs & devices for
44117
:titlesonly:
45118
:caption: Architectural decisions
46119
:glob:
120+
:maxdepth: 1
47121

48122
architectural_decisions/*
49123

0 commit comments

Comments
 (0)