From 550f1f07eb77aaeea5b9b9783b12b2ecb90d1e43 Mon Sep 17 00:00:00 2001 From: Robert Haase Date: Fri, 2 Dec 2022 08:31:54 +0100 Subject: [PATCH] fix test by correcting my former change --- pyclesperanto_prototype/_tier3/_maximum_position.py | 10 +++------- tests/test_maximum_position.py | 13 +++++++++++++ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/pyclesperanto_prototype/_tier3/_maximum_position.py b/pyclesperanto_prototype/_tier3/_maximum_position.py index 3ecdeb3c..b109a457 100644 --- a/pyclesperanto_prototype/_tier3/_maximum_position.py +++ b/pyclesperanto_prototype/_tier3/_maximum_position.py @@ -15,16 +15,12 @@ def maximum_position(source: Image) -> tuple: Returns ------- - float + tuple Examples -------- >>> import pyclesperanto_prototype as cle >>> cle.maximum_position(source) - - References - ---------- - """ from .._tier1 import maximum_x_projection from .._tier1 import maximum_y_projection @@ -52,8 +48,8 @@ def maximum_position(source: Image) -> tuple: source = temp_max if len(dimensionality) > 2: - # Use z position as input array is 3d - pos_z = z_position_of_maximum_z_projection(source) + # Use x position as the updated input array is 2d + pos_z = x_position_of_maximum_x_projection(source) # Use calculated max positions to find coordinates of each axis if pos_z is not None: diff --git a/tests/test_maximum_position.py b/tests/test_maximum_position.py index 886c6766..1d132802 100644 --- a/tests/test_maximum_position.py +++ b/tests/test_maximum_position.py @@ -46,3 +46,16 @@ def test_maximum_position_2d(): result = cle.maximum_position(gpu_input) assert (result == reference) + + +def test_maximum_position_2d_2(): + np_input = np.zeros((10, 11)) + + np_input[1, 2] = 1 + np_input[6, 7] = 1 + + reference = ndimage.maximum_position(np_input) + gpu_input = cle.push(np_input) + result = cle.maximum_position(gpu_input) + + assert (result == reference)