Skip to content

Instantly share code, notes, and snippets.

@chiahaoliu
Last active March 24, 2019 17:40
Show Gist options
  • Save chiahaoliu/4e96c5daf5a6859ea322081ed9573e43 to your computer and use it in GitHub Desktop.
Save chiahaoliu/4e96c5daf5a6859ea322081ed9573e43 to your computer and use it in GitHub Desktop.
from functools import partial
import bluesky.plans as bp
import bluesky.plan_stubs as bps
from xpdacq.glbl import glbl
from xpdacq.xpdacq_conf import xpd_configuration
from xpdconf.conf import XPD_SHUTTER_CONF
def _open_shutter_stub():
"""simple function to return a generator that yields messages to
open the shutter"""
yield from bps.abs_set(
xpd_configuration["shutter"], XPD_SHUTTER_CONF["open"], wait=True
)
yield from bps.sleep(glbl['shutter_sleep'])
yield from bps.checkpoint()
def _close_shutter_stub():
"""simple function to return a generator that yields messages to
close the shutter"""
yield from bps.abs_set(
xpd_configuration["shutter"], XPD_SHUTTER_CONF["close"], wait=True
)
yield from bps.checkpoint()
def singe_count(dets):
yield from _open_shutter_stub()
yield from bps.trigger_and_read(dets)
yield from _close_shutter_stub()
def Tseries_arb_dets(dets, nums, delay):
yield from bps.repeat(partial(single_count, dets),
nums, delay)
# example
# %run -i tseries_arb_dets.py
# plan = Tseries_arb_dets([pe2c, current, blah], 100, 1)
# xrun(0, plan)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment