Skip to content
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

Return to original position after scan #29

Open
silkenelson opened this issue Aug 19, 2020 · 3 comments
Open

Return to original position after scan #29

silkenelson opened this issue Aug 19, 2020 · 3 comments
Labels
enhancement New feature or request intermediate issue May require some familiarity with the pcdshub stack

Comments

@silkenelson
Copy link

Feature Request
Devices scanned should return to their start position.

Existing Alternatives
Have to add this step by hand.

Context
This was the behavior in old python. I also believe this is the intended behavior here, but it's not what the code does.

@silkenelson silkenelson added the enhancement New feature or request label Aug 19, 2020
@ZLLentz
Copy link
Member

ZLLentz commented Aug 19, 2020

This can be done using the reset_positions_wrapper in bluesky.preprocessors, or the equivalent reset_positions_decorator.

Quick example:

from bluesky.preprocessors import reset_positions_decorator

@reset_positions_decorator
def my_scan(*args, **kwargs):
    yield from some_plan()

In this way we can apply this to any plan that wants this. At LCLS I suspect this is desired on most scans, the only exception being if the pre-scan positions are further from the first point than the end positions...

Internally this is doing some voodoo to restore all moved devices to their original positions. If you don't want to do this to every device, you need to pass in a list of which devices to restore. See https://github.com/bluesky/bluesky/blob/master/bluesky/preprocessors.py#L1078

@dlzhu
Copy link

dlzhu commented Aug 22, 2020

I would say half the scans we would like to return to original position, and another half we actually would want to go to the peak (being it a fitting position or simply the maximum). The 'maximum' option probably need some sanity check for 'noisy' scans, if no clear peak is present, can be a query at the end of the scan.

@ZLLentz
Copy link
Member

ZLLentz commented Aug 24, 2020

This is something that can be done. Bluesky has hooks for soliciting user input, and we can cache all points from the scan and use the peak as the end of scan goal position. We need some way to determine the user's desired end of scan behavior, but we can probably bake this in as a standard scan arg.

@ZLLentz ZLLentz added the intermediate issue May require some familiarity with the pcdshub stack label Aug 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request intermediate issue May require some familiarity with the pcdshub stack
Projects
None yet
Development

No branches or pull requests

3 participants