This commit is contained in:
2025-12-08 16:44:19 +08:00
parent 7ea7dce602
commit c4e11cf1d9
2 changed files with 30 additions and 1 deletions

View File

@@ -408,7 +408,7 @@ microscopes:
camera:
hardware:
type: Andor Test Camera
type: Andor
serial_number: 0
defect_correct_mode: 2.0
delay: 1.0
@@ -454,6 +454,7 @@ microscopes:
hardware:
-
type: synthetic
serial_number: 000000
axes: [x, y, z, theta, f]
axes_mapping: [1, 2, 3, 4, 5]
min: 0.0

View File

@@ -509,3 +509,31 @@ class AndorCamera(CameraBase):
def set_readout_direction(self, mode) -> None:
super().set_readout_direction(mode)
def generate_new_frame(self) -> None:
"""Generate a synthetic image for testing with synthetic DAQ.
This method is called by SyntheticDAQ when running in synthetic hardware mode.
It generates a random test image and copies it to the data buffer.
"""
if not self.is_acquiring or self.data_buffer is None:
return
# Generate random noise image
image = np.random.normal(
100, # mean background
20, # standard deviation (noise)
size=(self.y_pixels, self.x_pixels),
).astype(np.uint16)
# Ensure values are in valid uint16 range
image = np.clip(image, 0, 65535)
# Copy to buffer
ctypes.memmove(
self.data_buffer[self.current_frame_idx].ctypes.data,
image.ctypes.data,
self.x_pixels * self.y_pixels * 2,
)
self.current_frame_idx = (self.current_frame_idx + 1) % self.num_of_frame