From 4eaf1101096b49ff5381e312cf1ae22714494d2f Mon Sep 17 00:00:00 2001 From: kushalkolar Date: Mon, 20 Oct 2025 18:57:07 -0400 Subject: [PATCH] skip existing arrays in ImageWidget.set_data() --- fastplotlib/widgets/image_widget/_widget.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fastplotlib/widgets/image_widget/_widget.py b/fastplotlib/widgets/image_widget/_widget.py index 9668b7182..715fe3489 100644 --- a/fastplotlib/widgets/image_widget/_widget.py +++ b/fastplotlib/widgets/image_widget/_widget.py @@ -929,6 +929,11 @@ def set_data( for i, (new_array, current_array, subplot) in enumerate( zip(new_data, self._data, self.figure) ): + # if the new array is the same as the existing array, skip + # this allows setting just a subset of the arrays in the ImageWidget + if new_data is self._data[i]: + continue + # check last two dims (x and y) to see if data shape is changing old_data_shape = self._data[i].shape[-self.n_img_dims[i] :] self._data[i] = new_array