From 5cb7751235f8407e46b5afde7c23837aaf80b1a9 Mon Sep 17 00:00:00 2001 From: "William F. Broderick" Date: Thu, 22 Oct 2026 15:30:16 -0400 Subject: [PATCH 1/4] fix set ax --- src/pyrtools/tools/display.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/pyrtools/tools/display.py b/src/pyrtools/tools/display.py index c52ba02..1865526 100644 --- a/src/pyrtools/tools/display.py +++ b/src/pyrtools/tools/display.py @@ -705,7 +705,10 @@ def _setup_figure(ax, col_wrap, image, zoom, max_shape, vert_pct): axes = fig.axes else: fig = ax.figure + if len(image) > 1: + raise ValueError("Can only display one image if passing an axis!") axes = [reshape_axis(ax, zoom * max_shape)] + n_cols = 1 return fig, axes, n_cols From 05f3190b37e205ae63dd7a2707aab91c29502bd2 Mon Sep 17 00:00:00 2001 From: "William F. Broderick" Date: Thu, 22 Oct 2026 15:47:49 -0400 Subject: [PATCH 2/4] adds versionchanged tag --- src/pyrtools/tools/display.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/pyrtools/tools/display.py b/src/pyrtools/tools/display.py index 1865526..bf53c90 100644 --- a/src/pyrtools/tools/display.py +++ b/src/pyrtools/tools/display.py @@ -1042,6 +1042,9 @@ def animate_video(t): def pyrshow(pyr_coeffs, vrange='auto1pyr', col_wrap=None, zoom=1, show_residuals=True, **kwargs): """Display the coefficients of the pyramid in an orderly fashion + .. versionchanged:: 1.1 + Removed ``"is_complex"`` argument -- complexity of input is now determined automatically. + Arguments --------- pyr_coeffs : `dict` From a6e8399c8fc3242ebf4b8b3367f46a47d55d1bbf Mon Sep 17 00:00:00 2001 From: "William F. Broderick" Date: Thu, 22 Oct 2026 16:22:58 -0400 Subject: [PATCH 3/4] adds tests for new fixes --- TESTS/unitTests.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/TESTS/unitTests.py b/TESTS/unitTests.py index 6bb55e3..7d7b7f7 100755 --- a/TESTS/unitTests.py +++ b/TESTS/unitTests.py @@ -1467,6 +1467,18 @@ def test_imshow25(self): fig = pt.imshow(im, vrange="auto1") _check_ranges(fig, ranges) + def test_imshow26(self): + im = np.random.randn(32, 32) + fig, ax = plt.subplots(1, 1) + fig = pt.imshow(im, ax=ax) + plt.close(fig) + + def test_imshow27(self): + im = np.random.randn(32, 32) + fig, ax = plt.subplots(1, 1) + with self.assertRaises(ValueError, msg="Can only display one image"): + pt.imshow([im, im], ax=ax) + class TestAnimshow(unittest.TestCase): def test_animshow0(self): From a73d4491edf04d22c1b41a0833777b2a6381f77b Mon Sep 17 00:00:00 2001 From: "William F. Broderick" Date: Thu, 22 Oct 2026 16:24:49 -0400 Subject: [PATCH 4/4] adds test to animshow --- TESTS/unitTests.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/TESTS/unitTests.py b/TESTS/unitTests.py index 7d7b7f7..52b05da 100755 --- a/TESTS/unitTests.py +++ b/TESTS/unitTests.py @@ -1636,6 +1636,18 @@ def test_animshow19(self): fig = pt.animshow([vid, 2*vid, 3*vid], vrange="auto1col", col_wrap=2, as_html5=False)._fig _check_ranges(fig, ranges) + def test_animshow20(self): + vid = np.random.randn(3, 32, 32) + fig, ax = plt.subplots(1, 1) + fig = pt.animshow(vid, ax=ax, as_html5=False)._fig + plt.close(fig) + + def test_animshow21(self): + vid = np.random.randn(3, 32, 32) + fig, ax = plt.subplots(1, 1) + with self.assertRaises(ValueError, msg="Can only display one image"): + pt.animshow([vid, vid], ax=ax, as_html5=False)._fig + class TestPyrshow(unittest.TestCase):