Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Untracked profile #16

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 2 additions & 37 deletions startup/00-base.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,6 @@
from datetime import datetime
from ophyd.signal import EpicsSignalBase, EpicsSignal, DEFAULT_CONNECTION_TIMEOUT

try:
from bluesky_queueserver import is_re_worker_active, parameter_annotation_decorator

except ImportError:
# Remove the try..except once 'bluesky_queueserver' is included in the collection environment

def is_re_worker_active():
return False

import functools

def parameter_annotation_decorator(annotation):
def function_wrap(func):
if inspect.isgeneratorfunction(func):

@functools.wraps(func)
def wrapper(*args, **kwargs):
return (yield from func(*args, **kwargs))

else:

@functools.wraps(func)
def wrapper(*args, **kwargs):
return func(*args, **kwargs)

return wrapper

return function_wrap


def print_now():
return datetime.strftime(datetime.now(), "%Y-%m-%d %H:%M:%S.%f")
Expand Down Expand Up @@ -76,10 +47,9 @@ def wait_for_connection(self, timeout=DEFAULT_CONNECTION_TIMEOUT):
from datetime import datetime

# Register bluesky IPython magics.
if not is_re_worker_active():
from bluesky.magics import BlueskyMagics
from bluesky.magics import BlueskyMagics

get_ipython().register_magics(BlueskyMagics)
get_ipython().register_magics(BlueskyMagics)

from bluesky.preprocessors import stage_decorator, run_decorator
from databroker.v0 import Broker
Expand All @@ -89,11 +59,6 @@ def wait_for_connection(self, timeout=DEFAULT_CONNECTION_TIMEOUT):

nslsii.configure_base(get_ipython().user_ns, db, bec=True)

# The following plan stubs should not be imported directly in the global namespace.
# Otherwise Queue Server will not be able to load the startup files.
del one_1d_step
del one_nd_step
del one_shot

# Make new RE.md storage available in old environments.
from pathlib import Path
Expand Down
1 change: 0 additions & 1 deletion startup/10-area-detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ class AndorKlass(SingleTriggerV33, DetectorBase):
)

ac_period = Cpt(EpicsSignal, "cam1:AcquirePeriod")
binning = Cpt(EpicsSignal, "cam1:A3Binning")

def stop(self):
self.hdf5.capture.put(0)
Expand Down
3 changes: 0 additions & 3 deletions startup/11-txm_motor.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,6 @@ class Scint(Device):
zps = TXMSampleStage("XF:18IDB-OP", name="zps")
XEng = MyEpicsMotor("XF:18IDA-OP{Mono:DCM-Ax:En}Mtr", name="XEng")

zps_sy = zps.sy # Required by the Queue Server
zps_sz = zps.sz # Required by the Queue Server

th2_motor = MyEpicsMotor("XF:18IDA-OP{Mono:DCM-Ax:Th2}Mtr", name="th2_motor")
th2_feedback = EpicsSignal("XF:18IDA-OP{Mono:DCM-Ax:Th2}PID", name="th2_feedback")
th2_feedback_enable = EpicsSignal(
Expand Down
4 changes: 1 addition & 3 deletions startup/12-optics_motor.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ class PBSL(Device):
dcm = DCM("XF:18IDA-OP{Mono:DCM", name="dcm")
pbsl = PBSL("XF:18IDA-OP{PBSL:1", name="pbsl")

dcm_th2 = dcm.th2 # Required by the Queue Server

motor_optics = [
cm.x,
cm.yaw,
Expand Down Expand Up @@ -76,5 +74,5 @@ class PBSL(Device):
pbsl.ib,
]

# get_ipython().register_magics(BlueskyMagics)
get_ipython().register_magics(BlueskyMagics)
# BlueskyMagics.positioners = motor_txm + motor_optics
4 changes: 3 additions & 1 deletion startup/40-scan_pre_define.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def _take_image(detectors, motor, num, stream_name="primary"):
def _set_Andor_chunk_size(detectors, chunk_size):
for detector in detectors:
yield from unstage(detector)
yield from bps.configure(Andor, {"cam.num_images": chunk_size})
yield from mv(Andor.cam.num_images, chunk_size)
for detector in detectors:
yield from stage(detector)

Expand Down Expand Up @@ -89,6 +89,8 @@ def _take_bkg_image(
def _set_andor_param(exposure_time=0.1, period=0.1, chunk_size=1, binning=[1, 1]):
yield from mv(Andor.cam.acquire, 0)
yield from mv(Andor.cam.image_mode, 0)
if (not binning is None) and len(binning) == 2:
yield from mv(Andor.cam.bin_y, binning[0], Andor.cam.bin_x, binning[1])
yield from mv(Andor.cam.num_images, chunk_size)
period_cor = period
yield from mv(Andor.cam.acquire_time, exposure_time)
Expand Down
Loading