-
Notifications
You must be signed in to change notification settings - Fork 3
Add scan wth delay plan #83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
e87e350
c90b434
8c26f3c
02bfa13
95a1db6
7538aeb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,2 @@ | ||
| from .cumulative_scans import * | ||
| from .cumulative_scans import cumulative_rel_scan | ||
| from .scan_with_delay import scan_with_delay |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| from bluesky.plans import scan | ||
| from bluesky.plan_stubs import move_per_step, sleep, trigger_and_read | ||
| from sophys.common.plans.annotated_default_plans import ( | ||
| DETECTORS_TYPE, | ||
| PER_STEP_TYPE, | ||
| MD_TYPE, | ||
| ) | ||
|
|
||
|
|
||
| def scan_with_delay( | ||
| detectors: DETECTORS_TYPE, | ||
| /, | ||
| *args, | ||
| num: int = None, | ||
| delay: float = 0.2, | ||
| per_step: PER_STEP_TYPE = None, | ||
| md: MD_TYPE = None, | ||
| ): | ||
| """ | ||
| Scan over one multi-motor trajectory. | ||
|
|
||
| Parameters | ||
| ---------- | ||
| detectors : list or tuple | ||
| list of 'readable' objects | ||
| *args : | ||
| For one dimension, ``motor, start, stop``. | ||
| In general: | ||
|
|
||
| .. code-block:: python | ||
|
|
||
| motor1, start1, stop1, | ||
| motor2, start2, stop2, | ||
| ..., | ||
| motorN, startN, stopN | ||
|
|
||
| -.-motor,start,stop;the n-th motor to move from slowest to fastest,the starting point in the motor's trajectory relative to the current position,the ending point in the motor's trajectory relative to the current position;__MOVABLE__,typing.Any,typing.Any-.- | ||
| num : integer | ||
| number of points | ||
| delay : integer | ||
| Delay between the triggers of the scan. | ||
| per_step : callable, optional | ||
| hook for customizing action of inner loop (messages per step). | ||
| See docstring of :func:`bluesky.plan_stubs.one_nd_step` (the default) | ||
| with and sleep plan after it. | ||
| md : dict, optional | ||
| metadata | ||
|
|
||
| See Also | ||
| -------- | ||
| :func:`bluesky.plans.rel_grid_scan` | ||
| :func:`bluesky.plans.inner_product_scan` | ||
| :func:`bluesky.plans.scan_nd` | ||
| """ | ||
|
|
||
| def one_nd_step_with_delay(detectors, step, pos_cache): | ||
| "This is a copy of bluesky.plan_stubs.one_nd_step with a sleep added." | ||
| motors = step.keys() | ||
| yield from move_per_step(step, pos_cache) | ||
| yield from sleep(delay) | ||
| yield from trigger_and_read(list(detectors) + list(motors)) | ||
|
|
||
| def per_step_with_delay(detectors, step, pos_cache): | ||
| yield from per_step(detectors, step, pos_cache) | ||
| yield from sleep(delay) | ||
|
Comment on lines
+64
to
+65
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will always cause the sleep to occur after the |
||
|
|
||
| per_step_scan = one_nd_step_with_delay | ||
| if per_step is not None: | ||
| per_step_scan = per_step_with_delay | ||
|
|
||
| yield from scan(detectors, *args, num=num, per_step=per_step_scan, md=md) | ||
Uh oh!
There was an error while loading. Please reload this page.