|
6 | 6 | import bluesky.plans as bp |
7 | 7 | import matplotlib.pyplot as plt |
8 | 8 | from bluesky import plan_stubs as bps |
9 | | -from bluesky.plan_stubs import trigger_and_read |
10 | | -from bluesky.preprocessors import run_decorator |
11 | | -from bluesky.protocols import NamedMovable, Readable |
| 9 | +from bluesky.protocols import NamedMovable |
12 | 10 | from bluesky.utils import Msg |
13 | 11 | from matplotlib.axes import Axes |
14 | 12 | from ophyd_async.plan_stubs import ensure_connected |
|
17 | 15 | from ibex_bluesky_core.devices.block import BlockWriteConfig, block_rw |
18 | 16 | from ibex_bluesky_core.devices.simpledae import monitor_normalising_dae |
19 | 17 | from ibex_bluesky_core.fitting import FitMethod |
20 | | -from ibex_bluesky_core.plan_stubs import call_qt_aware |
| 18 | +from ibex_bluesky_core.plan_stubs import call_qt_aware, polling_plan |
21 | 19 | from ibex_bluesky_core.utils import NamedReadableAndMovable, centred_pixel |
22 | 20 |
|
23 | 21 | if TYPE_CHECKING: |
24 | 22 | from ibex_bluesky_core.devices.simpledae import SimpleDae |
25 | 23 |
|
26 | | -__all__ = ["adaptive_scan", "motor_adaptive_scan", "motor_scan", "polling_plan", "scan"] |
| 24 | +__all__ = [ |
| 25 | + "NamedReadableAndMovable", |
| 26 | + "adaptive_scan", |
| 27 | + "motor_adaptive_scan", |
| 28 | + "motor_scan", |
| 29 | + "polling_plan", |
| 30 | + "scan", |
| 31 | +] |
27 | 32 |
|
28 | 33 |
|
29 | 34 | def scan( # noqa: PLR0913 |
@@ -296,45 +301,3 @@ def motor_adaptive_scan( # noqa: PLR0913 |
296 | 301 | rel=rel, |
297 | 302 | ) |
298 | 303 | ) |
299 | | - |
300 | | - |
301 | | -@run_decorator(md={}) |
302 | | -def polling_plan( |
303 | | - motor: NamedReadableAndMovable, readable: Readable[Any], destination: float |
304 | | -) -> Generator[Msg, None, None]: |
305 | | - """Move to a destination but drop updates from readable if motor position has not changed. |
306 | | -
|
307 | | - Args: |
308 | | - motor: the motor to move. |
309 | | - readable: the readable to read updates from, but drop if motor has not moved. |
310 | | - destination: the destination position. |
311 | | -
|
312 | | - Returns: |
313 | | - None |
314 | | -
|
315 | | - If we just used bp.scan() with a readable that updates more frequently than a motor can |
316 | | - register that it has moved, we would have lots of updates with the same motor position, |
317 | | - which may not be helpful. |
318 | | -
|
319 | | - """ |
320 | | - yield from bps.checkpoint() |
321 | | - yield from bps.create() |
322 | | - reading = yield from bps.read(motor) |
323 | | - yield from bps.read(readable) |
324 | | - yield from bps.save() |
325 | | - |
326 | | - # start the ramp |
327 | | - status = yield from bps.abs_set(motor, destination, wait=False) |
328 | | - while not status.done: |
329 | | - yield from bps.create() |
330 | | - new_reading = yield from bps.read(motor) |
331 | | - yield from bps.read(readable) |
332 | | - |
333 | | - if new_reading[motor.name]["value"] == reading[motor.name]["value"]: |
334 | | - yield from bps.drop() |
335 | | - else: |
336 | | - reading = new_reading |
337 | | - yield from bps.save() |
338 | | - |
339 | | - # take a 'post' data point |
340 | | - yield from trigger_and_read([motor, readable]) |
0 commit comments