mirror of
https://github.com/bec-project/ophyd_devices.git
synced 2025-06-05 19:30:41 +02:00
fix(sim): moved SimWaveform and SimMonitor to new async update structure
This commit is contained in:
parent
75f32800f8
commit
63eff57ec4
@ -176,7 +176,14 @@ class SimMonitorAsync(PSIDeviceBase, SimMonitorAsyncControl):
|
|||||||
|
|
||||||
def _send_data_to_bec(self) -> None:
|
def _send_data_to_bec(self) -> None:
|
||||||
"""Sends bundled data to BEC"""
|
"""Sends bundled data to BEC"""
|
||||||
metadata = {"async_update": self.async_update.get()}
|
async_update = self.async_update.get()
|
||||||
|
if async_update not in ["extend", "append"]:
|
||||||
|
raise ValueError(f"Invalid async_update value for device {self.name}: {async_update}")
|
||||||
|
|
||||||
|
if async_update == "extend":
|
||||||
|
metadata = {"async_update": {"type": "add", "max_shape": [None]}}
|
||||||
|
elif async_update == "append":
|
||||||
|
metadata = {"async_update": {"type": "add", "max_shape": [None, None]}}
|
||||||
|
|
||||||
msg = messages.DeviceMessage(
|
msg = messages.DeviceMessage(
|
||||||
signals={self.readback.name: self.data_buffer}, metadata=metadata
|
signals={self.readback.name: self.data_buffer}, metadata=metadata
|
||||||
|
@ -133,7 +133,13 @@ class SimWaveform(Device):
|
|||||||
async_update_type = self.async_update.get()
|
async_update_type = self.async_update.get()
|
||||||
if async_update_type not in ["extend", "append"]:
|
if async_update_type not in ["extend", "append"]:
|
||||||
raise ValueError(f"Invalid async_update type: {async_update_type}")
|
raise ValueError(f"Invalid async_update type: {async_update_type}")
|
||||||
metadata = {"async_update": async_update_type}
|
|
||||||
|
waveform_shape = self.waveform_shape.get()
|
||||||
|
if async_update_type == "append":
|
||||||
|
metadata = {"async_update": {"type": "add", "max_shape": [None, waveform_shape]}}
|
||||||
|
else:
|
||||||
|
metadata = {"async_update": {"type": "add", "max_shape": [None]}}
|
||||||
|
|
||||||
msg = messages.DeviceMessage(
|
msg = messages.DeviceMessage(
|
||||||
signals={self.waveform.name: {"value": self.waveform.get(), "timestamp": time.time()}},
|
signals={self.waveform.name: {"value": self.waveform.get(), "timestamp": time.time()}},
|
||||||
metadata=metadata,
|
metadata=metadata,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user