diff --git a/ophyd_devices/utils/bec_roi_signals/ad_roi_signal.py b/ophyd_devices/utils/bec_roi_signals/ad_roi_signal.py index 94165e8..480e661 100644 --- a/ophyd_devices/utils/bec_roi_signals/ad_roi_signal.py +++ b/ophyd_devices/utils/bec_roi_signals/ad_roi_signal.py @@ -335,29 +335,25 @@ class ADROIProcessing(ROIProcessing): return if not self.scan_server_scan_info: return - async_update = { - "type": "add", - "max_shape": [ - self.scan_server_scan_info.frames_per_trigger - * len(self.scan_server_scan_info.positions) - ], - } + + n_points = int( + len(self.scan_server_scan_info.positions) + * self.scan_server_scan_info.frames_per_trigger + ) if self.average_frames_per_trigger.get() is True: + n_points = int(len(self.scan_server_scan_info.positions)) if isinstance(value, (list, np.ndarray)): value = value / len(value) # Average over the number of frames per trigger value = float(value) # Ensure the value is a float for list and np.ndarray types - async_update["max_shape"] = [ - len(self.scan_server_scan_info.positions) - ] # Only one value per position if output_kind == "scalar": + async_update = {"type": "add", "max_shape": [n_points]} self.result_scalar.put( {result_name: {"value": value, "timestamp": timestamp or time.time()}}, async_update=async_update, ) else: - shape_0 = async_update["max_shape"][0] - async_update["max_shape"] = [shape_0, None] # Allow the second dimension to be variable + async_update = {"type": "add", "max_shape": [n_points, None]} self.result_waveform.put( {result_name: {"value": value, "timestamp": timestamp or time.time()}}, async_update=async_update,