mirror of
https://github.com/bec-project/ophyd_devices.git
synced 2025-06-03 02:20:40 +02:00
refactor: add .wait() to set methods
This commit is contained in:
parent
c5544226be
commit
73349257ee
@ -35,7 +35,7 @@ class SimMonitorAsyncPrepare(CustomDetectorMixin):
|
||||
def prep_random_interval(self):
|
||||
"""Prepare counter and random interval to send data to BEC."""
|
||||
self._random_send_interval = np.random.randint(1, 10)
|
||||
self.parent.current_trigger.set(0)
|
||||
self.parent.current_trigger.set(0).wait()
|
||||
self._counter = self.parent.current_trigger.get()
|
||||
|
||||
def on_stage(self):
|
||||
@ -74,7 +74,7 @@ class SimMonitorAsyncPrepare(CustomDetectorMixin):
|
||||
self.parent.data_buffer["value"].append(self.parent.readback.get())
|
||||
self.parent.data_buffer["value"].append(self.parent.readback.timestamp)
|
||||
self._counter += 1
|
||||
self.parent.current_trigger.set(self._counter)
|
||||
self.parent.current_trigger.set(self._counter).wait()
|
||||
if self._counter % self._random_send_interval == 0:
|
||||
self._send_data_to_bec()
|
||||
|
||||
|
@ -399,7 +399,7 @@ def test_async_monitor_complete(async_monitor):
|
||||
def test_async_mon_on_trigger(async_monitor):
|
||||
"""Test the on_trigger method of SimMonitorAsync."""
|
||||
with (mock.patch.object(async_monitor.custom_prepare, "_send_data_to_bec") as mock_send,):
|
||||
async_monitor.stage()
|
||||
async_monitor.custom_prepare.on_stage()
|
||||
upper_limit = async_monitor.custom_prepare._random_send_interval
|
||||
for ii in range(1, upper_limit + 1):
|
||||
async_monitor.custom_prepare.on_trigger()
|
||||
|
Loading…
x
Reference in New Issue
Block a user