0
0
mirror of https://github.com/bec-project/bec_widgets.git synced 2025-07-13 19:21:50 +02:00

fix(image_processor): support for nans in nd arrays

This commit is contained in:
2025-07-04 13:31:39 +02:00
committed by Klaus Wakonig
parent 324a5bd3d9
commit a6fc7993a3

View File

@ -27,7 +27,12 @@ class ImageStats:
Returns: Returns:
ImageStats: The statistics of the image data. ImageStats: The statistics of the image data.
""" """
return cls(maximum=np.max(data), minimum=np.min(data), mean=np.mean(data), std=np.std(data)) return cls(
maximum=np.nanmax(data),
minimum=np.nanmin(data),
mean=np.nanmean(data),
std=np.nanstd(data),
)
# noinspection PyDataclass # noinspection PyDataclass
@ -81,7 +86,7 @@ class ImageProcessor(QObject):
Returns: Returns:
np.ndarray: The processed data. np.ndarray: The processed data.
""" """
return np.abs(np.fft.fftshift(np.fft.fft2(data))) return np.abs(np.fft.fftshift(np.fft.fft2(np.nan_to_num(data))))
def rotation(self, data: np.ndarray, rotate_90: int) -> np.ndarray: def rotation(self, data: np.ndarray, rotate_90: int) -> np.ndarray:
""" """