Skip to content

Commit 98d5f30

Browse files
committed
plans
1 parent 6f02229 commit 98d5f30

File tree

2 files changed

+24
-22
lines changed

2 files changed

+24
-22
lines changed

doc/plans/plans.md

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,48 @@
11
# General Plans
22

3-
`ibex_bluesky_core` provides a number of plans that can be run by the RunEngine directly. These are mostly thin wrappers around the generic [bluesky plans](https://blueskyproject.io/bluesky/main/plans.html)
3+
The {py:obj}`ibex_bluesky_core.plans` module provides a number of plans that can be run by the RunEngine directly. These are mostly wrappers around the generic {external+bluesky:doc}`bluesky plans <plans>`.
44

5-
All of these plans can be used directly by the RunEngine (`RE()`) or within a wrapper of your own that yields from them (`yield from`)
5+
All of these plans can be used directly by the RunEngine (`RE()`), or within a wrapper of your own that `yields from` these plans.
66

77
So you can do this:
88

99
```python
10+
from ibex_bluesky_core.plans.reflectometry import refl_scan
11+
from ibex_bluesky_core.fitting import Gaussian
12+
13+
1014
result = RE(refl_scan("S1VG", 1, 10, 21, model=Gaussian().fit(), frames=500, det=100, mon=3, pixel_range=6, periods=True, save_run=False))
1115
```
1216

1317
or this:
1418

1519
```python
1620
from ibex_bluesky_core.plans.reflectometry import refl_scan
21+
from ibex_bluesky_core.fitting import Gaussian
22+
23+
1724
def my_plan():
1825
... # Some stuff before scan
19-
icc = (yield from refl_scan("S1VG", 1, 10, 21, model=Gaussian().fit(), frames=500, det=100, mon=3, pixel_range=6, periods=True, save_run=False))
26+
icc = yield from refl_scan("S1VG", 1, 10, 21, model=Gaussian().fit(), frames=500, det=100, mon=3, pixel_range=6, periods=True, save_run=False)
2027
... # Some stuff after scan
2128
```
2229

23-
## Return values
24-
25-
The scanning plans documented on this page will return an [`ISISCallbacks`](ibex_bluesky_core.callbacks.ISISCallbacks) instance, which gives results of fits, centre of masses etc. - for example in your own plan if you wanted to print the fit result and the centre of mass:
30+
The scanning plans documented on this page will return a {py:obj}`~ibex_bluesky_core.callbacks.ISISCallbacks` instance, which can be used to access results of fits, centre of mass, and other callbacks:
2631

2732
```python
2833
from ibex_bluesky_core.plans import motor_scan
2934
def my_plan():
3035
icc = (yield from motor_scan("MyBlock1", 1, 10, 21, model=Gaussian().fit(), frames=500, det=100, mon=3, pixel_range=6, periods=True, save_run=False))
3136
print(icc.live_fit.result.fit_report())
32-
print(f"COM: {icc.peak_stats['com']}")
37+
print(f"COM: {icc.com.result}")
3338
```
3439

35-
## Lower-level plans
40+
## Plans taking _devices_ as arguments
3641

3742
These take "devices" so you can pass your own DAE object and a movable/readable but use a standard set of callbacks for plotting, fitting and log file writing. These are designed to allow flexibility such as more in-depth DAE customisation, block configuration ie write tolerances, settle times.
3843

39-
[`scan`](ibex_bluesky_core.plans.scan) - this is for a absolute/relative scan.
40-
41-
[`adaptive_scan`](ibex_bluesky_core.plans.adaptive_scan) - this is for an adaptive/relative-adaptive scan.
44+
- {py:obj}`ibex_bluesky_core.plans.scan` - this is an absolute/relative scan.
45+
- {py:obj}`ibex_bluesky_core.plans.adaptive_scan` - this is for an adaptive/relative-adaptive scan.
4246

4347
An example of using one of these could be:
4448

@@ -56,18 +60,18 @@ def my_plan():
5660

5761
```
5862

59-
which would be used on the console like so: `RE(my_plan)`
63+
which would be used on the console as: `RE(my_plan())`
6064

61-
## Higher-level wrapper plans
62-
Alternatively, we provide some very thin wrappers which construct the devices for you - these are:
65+
## Plans taking _names_ as arguments
6366

64-
[`motor_scan`](ibex_bluesky_core.plans.motor_scan)
67+
Alternatively, we provide some wrappers that construct the devices for you - these are:
6568

66-
[`motor_adaptive_scan`](ibex_bluesky_core.plans.motor_scan)
69+
- {py:obj}`ibex_bluesky_core.plans.motor_scan`
70+
- {py:obj}`ibex_bluesky_core.plans.motor_adaptive_scan`
6771

68-
which wrap the above respectively. These take _names_ of blocks, rather than devices themselves, and construct a DAE and block device for you, using the global moving flag to determine if a motor has finished moving (in the same way as a `waitfor_move()`). This might be useful if you have a fairly standard DAE setup and just want to scan a block pointing at a motor such as a Sample Changer axis, but is not as flexible or performant as the lower-level plans.
72+
These plans take the _names_ of blocks as arguments, rather than devices, and construct a DAE and block device for you, using the global moving flag to determine if a motor has finished moving (in the same way as a `waitfor_move()`). This might be useful if you have a fairly standard DAE setup and want to scan a block pointing at a motor such as a Sample Changer axis, but is not as flexible or performant as the lower-level plans.
6973

70-
for example if you just wanted to scan over a motor, wait for 400 frames, and perform a linear fit, you can just write this in the console:
74+
For example, to scan over a motor, wait for 400 frames, and perform a linear fit, you can write this in the console:
7175

7276
```python
7377
>>> from ibex_bluesky_core.plans import motor_scan

doc/plans/reflectometry/autoalign.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
# Auto-alignment
22

3-
For reflectometers, we provide a few generic plans which can be used to align beamlines.
3+
For reflectometers, we provide a few generic plans which can be used as helpers for automated beamline alignment.
44

5-
## Full-Auto Alignment Plan
6-
7-
The {py:obj}`ibex_bluesky_core.plans.reflectometry.optimise_axis_against_intensity` plan is designed to scan over a movable against beam intensity, and given which fitting parameter is chosen to be optimised and the fitting method, it will aim to find an optimum value. See [`standard fits`](/callbacks/fitting/standard_fits.md) for the fitting parameters for each fitting model you can use. At this stage it will check if the value is 'sensible'- there are some default checks but the user is encouraged to provide their own checks. If found to be sensible, the motor will be moved to this value, otherwise it will optionally run a callback that can be provided, and then ask the user if they want to rescan or conttinue to move the movable.
5+
The {py:obj}`~ibex_bluesky_core.plans.reflectometry.optimise_axis_against_intensity` plan is designed to scan over a movable against beam intensity, and given which fitting parameter is chosen to be optimised and the fitting method, it will aim to find an optimum value. See [standard fits](/callbacks/fitting/standard_fits.md) for the fitting parameters for each fitting model you can use. At this stage it will check if the value is 'sensible' - there are some default checks, but the user is encouraged to provide their own checks. If found to be sensible, the motor will be moved to this value, otherwise it will optionally run a callback that can be provided, and then ask the user if they want to rescan or continue to move the movable.
86

97
The idea for how we expect the main auto-alignment plan to be used is that at the top / instrument level, you will move all other movables to some position ready to align, yield from this plan and then re-zero the motor.
108
The following is how you would do this for a reflectometry parameter as your movable:

0 commit comments

Comments
 (0)