Skip to content

Commit

Permalink
fix test by correcting my former change
Browse files Browse the repository at this point in the history
  • Loading branch information
haesleinhuepf committed Dec 2, 2022
1 parent 0ccbeb3 commit 550f1f0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
10 changes: 3 additions & 7 deletions pyclesperanto_prototype/_tier3/_maximum_position.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
13 changes: 13 additions & 0 deletions tests/test_maximum_position.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit 550f1f0

Please sign in to comment.