mirror of
https://github.com/bec-project/ophyd_devices.git
synced 2025-06-06 03:40:41 +02:00
feat(sim): add preview signal to camera simulation
This commit is contained in:
parent
42e7b56758
commit
ed9d8136b8
@ -9,6 +9,7 @@ from ophyd_devices.interfaces.base_classes.psi_device_base import PSIDeviceBase
|
||||
from ophyd_devices.sim.sim_data import SimulatedDataCamera
|
||||
from ophyd_devices.sim.sim_signals import ReadOnlySignal, SetableSignal
|
||||
from ophyd_devices.sim.sim_utils import H5Writer
|
||||
from ophyd_devices.utils.bec_signals import PreviewSignal
|
||||
|
||||
logger = bec_logger.logger
|
||||
|
||||
@ -38,6 +39,7 @@ class SimCameraControl(Device):
|
||||
compute_readback=True,
|
||||
kind=Kind.omitted,
|
||||
)
|
||||
preview = Cpt(PreviewSignal, name="preview", ndim=2)
|
||||
write_to_disk = Cpt(SetableSignal, name="write_to_disk", value=False, kind=Kind.config)
|
||||
|
||||
def __init__(self, name, *, parent=None, sim_init: dict = None, device_manager=None, **kwargs):
|
||||
@ -92,6 +94,7 @@ class SimCamera(PSIDeviceBase, SimCameraControl):
|
||||
for _ in range(self.burst.get()):
|
||||
data = self.image.get()
|
||||
# pylint: disable=protected-access
|
||||
self.preview.put(data)
|
||||
self._run_subs(sub_type=self.SUB_MONITOR, value=data)
|
||||
if self.write_to_disk.get():
|
||||
self.h5_writer.receive_data(data)
|
||||
|
@ -347,10 +347,10 @@ class PreviewSignal(BECMessageSignal):
|
||||
**kwargs,
|
||||
) -> None:
|
||||
"""
|
||||
Put method for Preview1DSignal.
|
||||
Put method for PreviewSignal.
|
||||
|
||||
If value is a DeviceMonitor1DMessage, it will be directly set,
|
||||
if value is a dict, it will be converted to a DeviceMonitor1DMessage.
|
||||
If value is a DevicePreviewMessage, it will be directly set,
|
||||
if value is a dict, it will be converted to a DevicePreviewMessage.
|
||||
|
||||
Args:
|
||||
value (list | np.ndarray | dict | self._bec_message_type): The preview data. Must be 1D.
|
||||
@ -378,10 +378,10 @@ class PreviewSignal(BECMessageSignal):
|
||||
self, value: list | np.ndarray | dict, *, metadata: dict | None = None, **kwargs
|
||||
) -> DeviceStatus:
|
||||
"""
|
||||
Put method for Preview1DSignal.
|
||||
Put method for PreviewSignal.
|
||||
|
||||
If value is a DeviceMonitor1DMessage, it will be directly set,
|
||||
if value is a dict, it will be converted to a DeviceMonitor1DMessage.
|
||||
If value is a DevicePreviewMessage, it will be directly set,
|
||||
if value is a dict, it will be converted to a DevicePreviewMessage.
|
||||
|
||||
Args:
|
||||
value (list | np.ndarray | dict | self._bec_message_type) : The preview data. Must be 1D.
|
||||
|
Loading…
x
Reference in New Issue
Block a user