Open gfabbris opened 5 months ago
A couple of extra ideas:
Some extra tweaks
def flyscan(detectors, motor, start, end, speed, delay=0, per_shot=None):
yield from mv(motor, start)
# change this to staging
speed_stash = yield from rd(motor.velocity)
print(speed_stash)
yield from mv(motor.velocity, speed)
if per_shot is None:
per_shot = trigger_and_read
devices = list(detectors) + [motor]
@stage_decorator(devices)
@monitor_during_decorator([motor])
@run_decorator(md={})
def inner_count():
yield from abs_set(motor.user_setpoint, end)
_motor_moving_stash = False
while True:
t0 = time()
if (_motor_moving_stash is True) and (motor.moving is False):
break
if (_motor_moving_stash is False) and (motor.moving is True):
_motor_moving_stash = True
yield Msg('checkpoint')
yield from trigger_and_read(devices)
d = delay - (time() - t0)
if d > 0:
yield from sleep(d)
yield from mv(motor, end)
yield from mv(motor.velocity, speed_stash)
return (yield from inner_count())
To get the .read() timestamps:
cat[-1].primary.timestamps.read()
We will need to tweak the detector trigger
trigger
method).Using the ACS controller, the fastest EPICS updated the position was ~200 Hz. This was done by only changing the MOVING_POLL
to 0.001 (smaller numbers didn't make it faster), this can be added as an option here: https://github.com/epics-motor/motorAcsMotion/blob/f99eda1de1cdb43fae1f9c8b9f9d763f5aceca4b/iocs/acsMotionIOC/iocBoot/iocAcsMotion/AcsMotion.cmd#L4
We did some testing on running a "rough" flyscan that is completely managed by Bluesky, meaning that there is no external synchronization. First, the IOC motor setup needs to be modified to increase the readout speed:
From @jwkim-anl :
So we can have a plan that sends the motor to the final position and then reads the data as fast as it can. Based on our preliminary tests, a
bluesky.plan_stubs.trigger_and_read
can process 1 scaler + 1 motor in around 40 msec, with scaler counting for 10 msec. See plan and data below.Some of what remains to be done:
trigger_and_read
?.unstage
ofEpicsMotor
, for example: https://github.com/APS-4ID-POLAR/polar_instrument/blob/50961b8ce4740430f07cc7cd64f791a746b96519/instrument/devices/nanopositioner.py#L13