Skip to content

Commit

Permalink
Cleanup test_labeled_comprehension_struct (#80)
Browse files Browse the repository at this point in the history
* Simplify `test_labeled_comprehension_struct` case

For some reason this was using `argmax` and then selecting the max value
from the array. In reality, this can just find the max value and return
it. So this simplifies the test accordingly.

* Drop extra blank line

As both of these are being defined to fill out values in
`labeled_comprehension`, go ahead and group them together.
  • Loading branch information
jakirkham committed Oct 1, 2018
1 parent b470898 commit 2d4c240
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions tests/test_dask_image/test_ndmeasure/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,11 +348,10 @@ def test_labeled_comprehension_struct(shape, chunks, ind):
d_lbls = da.from_array(lbls, chunks=d.chunks)

dtype = np.dtype([("val", np.float64), ("pos", np.int)])

default = np.array((np.nan, -1), dtype=dtype)

def func_max(val):
return val[np.argmax(val)]
return np.max(val)

def func_argmax(val, pos):
return pos[np.argmax(val)]
Expand Down

0 comments on commit 2d4c240

Please sign in to comment.