Skip to content

Commit

Permalink
Merge pull request #7 from tangkong/delay_scan_fixes
Browse files Browse the repository at this point in the history
BUG: Properly pass daq config params, disable bec plots for delay_scan
  • Loading branch information
tangkong authored Mar 17, 2022
2 parents eae4671 + 9c55ed5 commit de453fa
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
10 changes: 7 additions & 3 deletions experiments/ly5320.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@
from xcs.db import daq
from xcs.db import camviewer
from xcs.db import RE
from xcs.db import bec
from xcs.db import xcs_ccm as ccm
from xcs.delay_scan import delay_scan
from xcs.db import lxt_fast, lxt_fast_enc
from pcdsdevices.device_types import Newport, IMS
from pcdsdevices.evr import Trigger

#from macros import *
import time

Expand Down Expand Up @@ -142,15 +144,17 @@ def delay_scan(self, start, end, sweep_time, record=True, use_l3t=False,
duration=None):
"""Delay scan with the daq."""
self.cleanup_RE()
daq.configure(events=None, duration=duration, record=record,
use_l3t=use_l3t, controls=[lxt_fast])
bec.disable_plots()
controls = [lxt_fast]
try:
RE(delay_scan(daq, lxt_fast, [start, end], sweep_time,
duration=duration))
duration=duration, record=record, use_l3t=use_l3t,
controls=controls))
except Exception:
logger.debug('RE Exit', exc_info=True)
finally:
self.cleanup_RE()
bec.enable_plots()

def empty_delay_scan(self, start, end, sweep_time, record=True,
use_l3t=False, duration=None):
Expand Down
18 changes: 15 additions & 3 deletions xcs/delay_scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
from pcdsdaq.preprocessors import daq_during_wrapper
from pcdsdevices.interface import BaseInterface

def delay_scan(daq, time_motor, time_points, sweep_time, duration=None):
def delay_scan(daq, time_motor, time_points, sweep_time, duration=None,
record=None, use_l3t=False, controls=None):
"""
Bluesky plan that sets up and executes the delay scan.
Expand All @@ -28,8 +29,18 @@ def delay_scan(daq, time_motor, time_points, sweep_time, duration=None):
sweep_time: float
The duration we take to move from one end of the range to the other.
duration: float
record: bool, optional
Whether or not to record in the daq
duration: float, optional
If provided, the time to run in seconds. If omitted, we'll run forever.
use_l3t: bool, optional
If True, events argument will be interpreted to only count events that
pass the level 3 trigger
controls: dict or list of devices, optional
If provided, values will make it to DAQ data stream as variables
"""

spatial_pts = []
Expand All @@ -46,7 +57,8 @@ def delay_scan(daq, time_motor, time_points, sweep_time, duration=None):
scan = infinite_scan([], time_motor, time_points, duration=duration)

if daq is not None:
yield from daq_during_wrapper(scan)
yield from daq_during_wrapper(scan, record=record, use_l3t=use_l3t,
controls=controls)
else:
yield from scan

Expand Down

0 comments on commit de453fa

Please sign in to comment.