Skip to content

Instantly share code, notes, and snippets.

@chiahaoliu
chiahaoliu / tramp_time_series.py
Last active August 9, 2019 21:38
2019.08.08 Milinda Tramp time series plan
##### imports ######
import time
from functools import partial
import bluesky.plan_stubs as bps
import bluesky.preprocessors as bpp
from bluesky.simulators import summarize_plan
from bluesky.callbacks import LiveTable
from xpdacq.xpdacq import glbl
from xpdacq.beamtime import (
close_shutter_stub,
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
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():
@chiahaoliu
chiahaoliu / msg_conf_area_det.py
Last active February 19, 2019 05:16
configure area det by Msg
import bluesky.plan_stubs as bps
from xpdacq.beamtime import _check_mini_expo
def configure_area_det_expo(expo):
area_det = xpd_configuration['area_det']
# compute number of frames
acq_time = area_det.cam.acquire_time.get()
_check_mini_expo(exposure, acq_time)
num_frame = np.ceil(exposure / acq_time)
computed_exposure = num_frame * acq_time
import time
import numpy as np
import bluesky.plans as bp
import bluesky.plan_stubs as bps
import bluesky.preprocessors as bpp
from bluesky.utils import Msg, short_uid as _short_uid
from bluesky.preprocessors import subs_wrapper
from bluesky.simulators import summarize_plan
from bluesky.callbacks import LiveTable
from xpdacq.xpdacq_conf import xpd_configuration
@chiahaoliu
chiahaoliu / chris_cryostat_scanplan.py
Last active July 20, 2018 19:58 — forked from CJ-Wright/customized_per_step.py
customized per_step to collect light and dark frames at each motor point
# ACQ SIDE
# ======================================================
import bluesky.plans as bp
import bluesky.preprocessors as bpp
import bluesky.plan_stubs as bps
from bluesky.utils import Msg, short_uid as _short_uid
from bluesky.preprocessors import subs_wrapper
from bluesky.simulators import summarize_plan
from bluesky.callbacks import LiveTable
@chiahaoliu
chiahaoliu / PE_test.py
Last active June 25, 2018 21:24
PE_det test with Julien_20180625
# command at bluesky level
test_det = pe3c
test_det.cam.acquire_time.put(1)
test_det.images_per_set.put(60)
RE(bp.count(1))
# reproduce the bug in xpdAcq
glbl['frame_acq_time'] = 1
glbl['dk_window'] = 0.1
@chiahaoliu
chiahaoliu / customized_per_step.py
Last active June 11, 2018 20:07
customized per_step to collect light and dark frames at each motor point
import bluesky.plans as bp
import bluesky.plan_stubs as bps
from bluesky.utils import Msg, short_uid as _short_uid
from bluesky.preprocessors import subs_wrapper
from bluesky.simulators import summarize_plan
from bluesky.callbacks import LiveTable
# shutter configuration, change wrt beamline!
shutter = sh
from itertools import tee
import bluesky.plans as bp
import bluesky.plan_stubs as bps
import bluesky.preprocessors as bpp
from bluesky.run_engine import RunEngine
from bluesky.simulators import summarize_plan
from ophyd.sim import hw
ns = hw()
@chiahaoliu
chiahaoliu / 1D_area_det_scan.py
Created March 17, 2018 18:09
1D line scan on area detector
import bluesky.plans as bp
import bluesky.preprocessors as bpp
from bluesky.callbacks import LiveTable
from xpdacq.beamtime import _configure_area_det
# configure to 5s
_configure_area_det(5)