ibex_bluesky_core.plan_stubs
Core plan stubs.
Members
Call a matplotlib function in a Qt-aware context, from within a plan. |
|
Call a synchronous user function in a plan, and returns the result of that call. |
|
Prompt the user to choose between a limited set of options. |
|
Redefines the current positions of a motor. |
|
Redefines the current positions of a reflectometry parameter. |
- ibex_bluesky_core.plan_stubs.call_qt_aware(func: ~collections.abc.Callable[[~P], ~ibex_bluesky_core.plan_stubs.T], *args: ~typing.~P, **kwargs: ~typing.~P) Generator[Msg, None, T] [source]
Call a matplotlib function in a Qt-aware context, from within a plan.
If matplotlib is using a Qt backend then UI operations are run on the Qt thread via Qt signals.
Only matplotlib functions may be run using this plan stub.
- Parameters:
func – A matplotlib function reference.
*args – Arbitrary arguments, passed through to matplotlib.pyplot.subplots
**kwargs – Arbitrary keyword arguments, passed through to matplotlib.pyplot.subplots
- Raises:
ValueError – if the passed function is not a matplotlib function.
- Returns:
The return value of the wrapped function
- ibex_bluesky_core.plan_stubs.call_sync(func: ~collections.abc.Callable[[~P], ~ibex_bluesky_core.plan_stubs.T], *args: ~typing.~P, **kwargs: ~typing.~P) Generator[Msg, None, T] [source]
Call a synchronous user function in a plan, and returns the result of that call.
Attempts to guard against the most common pitfalls of naive implementations, for example:
Blocking the whole event loop
Breaking keyboard interrupt handling
It does not necessarily guard against all possible cases, and as such it is recommended to use native bluesky functionality wherever possible in preference to this plan stub. This should be seen as an escape-hatch.
The wrapped function will be run in a new thread.
- Parameters:
func – A callable to run.
*args – Arbitrary arguments to be passed to the wrapped function
**kwargs – Arbitrary keyword arguments to be passed to the wrapped function
- Returns:
The return value of the wrapped function
- ibex_bluesky_core.plan_stubs.prompt_user_for_choice(*, prompt: str, choices: list[str]) Generator[Msg, None, str] [source]
Prompt the user to choose between a limited set of options.
- Parameters:
prompt – The user prompt string.
choices – A list of allowable choices.
- Returns:
One of the entries in the choices list.
- ibex_bluesky_core.plan_stubs.redefine_motor(motor: Motor, position: float) Generator[Msg, None, None] [source]
Redefines the current positions of a motor.
Note
This does not move the motor, it just redefines its position to be the given value.
- Parameters:
motor – The motor to set a position on.
position – The position to set.
- ibex_bluesky_core.plan_stubs.redefine_refl_parameter(parameter: ReflParameter, position: float) Generator[Msg, None, None] [source]
Redefines the current positions of a reflectometry parameter.
Note
This does not move the parameter, it just redefines its position to be the given value.
- Parameters:
parameter – The reflectometry parameter to set a position on.
position – The position to set.