From 1a73f82ebeb3efea1571afd439645479a1712331 Mon Sep 17 00:00:00 2001 From: tangkong Date: Mon, 7 Mar 2022 15:51:06 -0800 Subject: [PATCH 1/2] BUG: Properly pass daq config params, disable bec plots for delay_scan --- experiments/ly5320.py | 13 +++++++++---- xcs/delay_scan.py | 18 +++++++++++++++--- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/experiments/ly5320.py b/experiments/ly5320.py index 4625795..47b0b53 100644 --- a/experiments/ly5320.py +++ b/experiments/ly5320.py @@ -21,11 +21,14 @@ 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 nabs.plans import daq_delay_scan #from macros import * import time @@ -140,17 +143,19 @@ def a3scan(self, m1, a1, b1, m2, a2, b2, m3, a3, b3, nsteps, nEvents, record=Tru def delay_scan(self, start, end, sweep_time, record=True, use_l3t=False, duration=None): - """Delay scan with the daq.""" + """Delay scan with the daq. Uses nabs.plans.delay_scan""" 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): diff --git a/xcs/delay_scan.py b/xcs/delay_scan.py index 02ef153..b12e9c7 100644 --- a/xcs/delay_scan.py +++ b/xcs/delay_scan.py @@ -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. @@ -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 = [] @@ -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 From 9c55ed56c8a322cc7a3deb9d6a3028dbd8daa48e Mon Sep 17 00:00:00 2001 From: tangkong Date: Mon, 7 Mar 2022 16:06:52 -0800 Subject: [PATCH 2/2] MAINT: actually not using nabs delay_scan --- experiments/ly5320.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/experiments/ly5320.py b/experiments/ly5320.py index 47b0b53..8867a95 100644 --- a/experiments/ly5320.py +++ b/experiments/ly5320.py @@ -28,7 +28,6 @@ from pcdsdevices.device_types import Newport, IMS from pcdsdevices.evr import Trigger -from nabs.plans import daq_delay_scan #from macros import * import time @@ -143,7 +142,7 @@ def a3scan(self, m1, a1, b1, m2, a2, b2, m3, a3, b3, nsteps, nEvents, record=Tru def delay_scan(self, start, end, sweep_time, record=True, use_l3t=False, duration=None): - """Delay scan with the daq. Uses nabs.plans.delay_scan""" + """Delay scan with the daq.""" self.cleanup_RE() bec.disable_plots() controls = [lxt_fast]