From cacac5804e48df969fbfd3e1285c4feaee21fab3 Mon Sep 17 00:00:00 2001 From: Garrett Bischof Date: Fri, 7 Feb 2020 12:44:37 -0600 Subject: [PATCH] MNT #146 cleanup --- profile_bluesky/startup/26-lambda.py | 42 +++++++++++++++++----------- 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/profile_bluesky/startup/26-lambda.py b/profile_bluesky/startup/26-lambda.py index 056e5dd..48d24c1 100644 --- a/profile_bluesky/startup/26-lambda.py +++ b/profile_bluesky/startup/26-lambda.py @@ -229,6 +229,15 @@ def setup_trigger_mode_internal(self): yield from self.setImageMode(self.MODE_MULTIPLE_IMAGE) +class IMMnLocal(Device): + """ + local interface to the IMM0, IMM1, & IMM2 plugins + """ + capture = Component(EpicsSignalWithRBV, "Capture", kind='config') + file_format = Component(EpicsSignalWithRBV, "NDFileIMM_format", string=True, kind="config") + num_captured = Component(EpicsSignalRO, "NumCaptured_RBV") + + class IMMoutLocal(Device): """ local interface to the IMMout plugin @@ -406,12 +415,11 @@ class Lambda750kLocal(DM_DeviceMixinAreaDetector, Device): # implement just the parts needed by our data acquisition detector_number = 25 # 8-ID-I numbering of this detector - # only need cam1 and IMMout plugins cam = Component(Lambda750kCamLocal, "cam1:") immout = Component(IMMoutLocal, "IMMout:") - imm0 = Component(IMMoutLocal, "IMM0:") - imm1 = Component(IMMoutLocal, "IMM1:") - imm2 = Component(IMMoutLocal, "IMM2:") + imm0 = Component(IMMnLocal, "IMM0:") + imm1 = Component(IMMnLocal, "IMM1:") + imm2 = Component(IMMnLocal, "IMM2:") stats1 = Component(StatsLocal, "Stats1:") image = Component(ExternalFileReference, value="", shape=[]) @@ -545,11 +553,8 @@ def stage(self): def trigger(self): "trigger device acquisition and return a status object" - acquire_signal = self.cam.acquire start_value = 1 done_value = 0 - # watch_signal = self.cam.acquire - watch_signal = self.immout.capture status = DeviceStatus(self) @@ -565,23 +570,28 @@ def watch_state(value, old_value, **kwargs): self.cam.state.clear_sub(watch_state) logger.debug("closed shutter") - def closure(value, old_value, **kwargs): + def watch_acquire(value, old_value, **kwargs): + """ + watch the acquire button, waiting for it to Stop (0) + """ if value == done_value and old_value != value: - watch_signal.clear_sub(closure) - print("closure() method ends") - print(f"cam.acquire.get()={self.cam.acquire.get()}") - print(f"immout.capture.get()={self.immout.capture.get()}") - print(f"immout.num_captured.get()={self.immout.num_captured.get()}") + self.immout.capture.clear_sub(watch_acquire) + logger.info("watch_acquire() method ends") + logger.info(f"cam.acquire.get()={self.cam.acquire.get()}") + logger.info(f"immout.capture.get()={self.immout.capture.get()}") + logger.info(f"immout.num_captured.get()={self.immout.num_captured.get()}") status._finished() shutter.close() - print(f"status={status}") + logger.info(f"status={status}") shutter.open() time.sleep(0.005) # wait for the shutter to move out of the way self.cam.state.subscribe(watch_state) - watch_signal.subscribe(closure) + self.immout.capture.subscribe(watch_acquire) + for plugin in (self.imm0, self.imm1, self.imm2): + plugin.capture.put(1, wait=False) self.immout.capture.put(1, wait=False) - acquire_signal.put(start_value, wait=False) + self.cam.acquire.put(start_value, wait=False) if self.cam.EXT_TRIGGER > 0: t0 = time.time() # while soft_glue.acquire_ext_trig_status.get() != 1: