diff --git a/src/useq/_mda_event.py b/src/useq/_mda_event.py index 56e8205..eea198e 100644 --- a/src/useq/_mda_event.py +++ b/src/useq/_mda_event.py @@ -71,7 +71,7 @@ class SLMImage(UseqModel): used. By default, `None`. """ - data: Any + data: Any = Field(..., repr=False) device: Optional[str] = None exposure: Optional[float] = None @@ -86,6 +86,15 @@ def __array__(self, *args: Any, **kwargs: Any) -> npt.NDArray: """Cast the image data to a numpy array.""" return np.asarray(self.data, *args, **kwargs) + def __eq__(self, other: object) -> bool: + if not isinstance(other, SLMImage): + return False + return ( + self.device == other.device + and self.exposure == other.exposure + and np.array_equal(self.data, other.data) + ) + class PropertyTuple(NamedTuple): """Three-tuple capturing a device, property, and value. diff --git a/tests/test_sequence.py b/tests/test_sequence.py index a620f32..9ecb205 100644 --- a/tests/test_sequence.py +++ b/tests/test_sequence.py @@ -488,3 +488,5 @@ def test_slm_image() -> None: # directly provide numpy array event3 = MDAEvent(slm_image=SLMImage(data=np.ones((10, 10)))) print(repr(event3)) + + assert event3 != event2