Open silkenelson opened 4 years ago
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
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.
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.
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.