You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When attempting to use `matplotlib` UI functions directly in a plan, and running `matplotlib` using a `Qt`
3
+
When attempting to use {py:obj}`matplotlib` UI functions directly in a plan, and running {py:obj}`matplotlib` using a Qt
4
4
backend (e.g. in a standalone shell outside IBEX), you may see a hang or an error of the form:
5
5
6
6
```
7
7
UserWarning: Starting a Matplotlib GUI outside of the main thread will likely fail.
8
8
fig, ax = plt.subplots()
9
9
```
10
10
11
-
This is because the `RunEngine` runs plans in a worker thread, not in the main thread, which then requires special
11
+
This is because the bluesky run engine runs plans in a worker thread, not in the main thread, which then requires special
12
12
handling when calling functions that will update a UI.
13
13
14
-
The [`call_qt_aware`](ibex_bluesky_core.plan_stubs.call_qt_aware) plan stub can call `matplotlib` functions in a
14
+
The {py:obj}`~ibex_bluesky_core.plan_stubs.call_qt_aware` plan stub can call {py:obj}`matplotlib` functions in a
15
15
Qt-aware context, which allows them to be run directly from a plan. It allows the same arguments and
16
16
keyword-arguments as the underlying matplotlib function it is passed.
17
17
18
18
```{note}
19
-
Callbacks such as `LivePlot` and `LiveFitPlot` already route UI calls to the appropriate UI thread by default.
20
-
The following plan stubs are only necessary if you need to call functions which will create or update a matplotlib
19
+
Callbacks such as {py:obj}`~ibex_bluesky_core.callbacks.LivePlot` and {py:obj}`~bluesky.callbacks.mpl_plotting.LiveFitPlot` already route UI calls to the appropriate UI thread by default.
20
+
The {py:obj}`~ibex_bluesky_core.plan_stubs.call_qt_aware` plan stub is only necessary if you need to call functions which will create or update a matplotlib
21
21
plot from a plan directly - for example to create or close a set of axes before passing them to callbacks.
[`polling_plan`](ibex_bluesky_core.plans.polling_plan) - is used for moving a motor and dropping updates from a "readable" if no motor updates are provided. An example of this is a laser reading which updates much more quickly than a motor might register it's moved, so the laser readings are not really useful information.
3
+
{py:obj}`ibex_bluesky_core.plans.polling_plan` can be used to perform a software continuous scan - setting off a motor
4
+
move, and then monitoring both the motor position and a readable, zipping them together into a single dataset suitable
5
+
for our usual plotting and fitting callbacks.
4
6
5
-
This in itself doesn't start a bluesky "run" so you will need to use a `run_decorator` on any outer plan which calls this plan stub.
7
+
Updates from the readable may be dropped if they occur at a higher rate than updates from the motor position.
6
8
9
+
{py:obj}`ibex_bluesky_core.plans.polling_plan` does not start a bluesky run, so you will need to use a {py:obj}`~bluesky.preprocessors.run_decorator` on an outer plan which calls this plan stub. This is so that _multiple_ continuous moves can be done as part of the same bluesky run.
The {py:obj}`ibex_bluesky_core.plan_stubs.redefine_refl_parameter` plan stub can be used to redefine the current
40
-
position of a {py:obj}`ibex_bluesky_core.devices.reflectometry.ReflParameter` to a new value. Note that some reflectometry parameters ie.`Theta` cannot be redefined, so these must be constructed with `has_redefine=False`. This plan stub will handle this case and raise an error if a user tries to redefine it.
40
+
position of a {py:obj}`~ibex_bluesky_core.devices.reflectometry.ReflParameter` to a new value. Note that some reflectometry parameters (e.g.`Theta`) cannot be redefined, so these must be constructed with `has_redefine=False`. {py:obj}`ibex_bluesky_core.plan_stubs.redefine_refl_parameter`will raise an error if a user tries to redefine a parameter that was created with `has_redefine=False`.
41
41
42
-
This plan stub has an identical API to that of the {py:obj}`ibex_bluesky_core.plan_stubs.redefine_motor` plan stub
42
+
This plan stub has an identical API to that of the {py:obj}`~ibex_bluesky_core.plan_stubs.redefine_motor` plan stub
43
43
described above, but operates on a reflectometry parameter rather than a motor.
0 commit comments