Skip to content

Instantly share code, notes, and snippets.

@chiahaoliu
Last active March 24, 2019 19:54
Show Gist options
  • Save chiahaoliu/ef1426452c7ab2e366c41cfb6fb9c8fa to your computer and use it in GitHub Desktop.
Save chiahaoliu/ef1426452c7ab2e366c41cfb6fb9c8fa to your computer and use it in GitHub Desktop.
from xpdacq.beamtime import _open_shutter_stub, _close_shutter_stub
import bluesky.plans as bp
import bluesky.plan_stubs as bps
import bluesky.preprocessors as bpp
def inner_shutter_control(msg):
if msg.command == "trigger":
def inner():
yield from _open_shutter_stub()
yield msg
return inner(), None
elif msg.command == "save":
return None, _close_shutter_stub()
else:
return None, None
def tseries_arb_dets(dets, nums, delay):
plan = bp.count(dets, num, delay)
plan = bpp.plan_mutator(plan, inner_shutter_control)
yield from plan
# example:
# %run -i tseries_arb_dets_v2.py
# plan = tseries_arb_dets([pe2c, blah, blah], 100, 1)
# xrun(5, plan)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment