From 2120fc98772e2ce9dbea8773b507325a8f107e5f Mon Sep 17 00:00:00 2001 From: Talley Lambert Date: Tue, 11 Feb 2025 18:40:36 -0500 Subject: [PATCH] fix: fix conditional when normalized channel axis resolves to 0 (#135) --- src/ndv/controllers/_array_viewer.py | 2 +- src/ndv/models/_data_display_model.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ndv/controllers/_array_viewer.py b/src/ndv/controllers/_array_viewer.py index d47139f6..cdc1a559 100644 --- a/src/ndv/controllers/_array_viewer.py +++ b/src/ndv/controllers/_array_viewer.py @@ -335,7 +335,7 @@ def _update_visible_sliders(self) -> None: return hidden_indices: set[int] = set(self._data_model.normed_visible_axes) if self._data_model.display.channel_mode.is_multichannel(): - if ch := self._data_model.normed_channel_axis: + if (ch := self._data_model.normed_channel_axis) is not None: hidden_indices.add(ch) # hide singleton axes diff --git a/src/ndv/models/_data_display_model.py b/src/ndv/models/_data_display_model.py index 810812d8..45b5bf5e 100644 --- a/src/ndv/models/_data_display_model.py +++ b/src/ndv/models/_data_display_model.py @@ -200,7 +200,7 @@ def current_slice_requests(self) -> list[DataRequest]: # if we need to request multiple channels (composite mode or RGB), # ensure that the channel axis is also sliced - if c_ax := self.normed_channel_axis: + if (c_ax := self.normed_channel_axis) is not None: if self.display.channel_mode.is_multichannel(): if not isinstance(requested_slice.get(c_ax), slice): requested_slice[c_ax] = slice(None)