diff --git a/src/navigate/config/configuration.yaml b/src/navigate/config/configuration.yaml index 30de8d8..3b0a440 100644 --- a/src/navigate/config/configuration.yaml +++ b/src/navigate/config/configuration.yaml @@ -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 diff --git a/src/navigate/model/devices/camera/andor.py b/src/navigate/model/devices/camera/andor.py index 183472c..df70cc9 100644 --- a/src/navigate/model/devices/camera/andor.py +++ b/src/navigate/model/devices/camera/andor.py @@ -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