Skip to content

Commit

Permalink
TST: add basic tests for find_maxsep_cut_coords
Browse files Browse the repository at this point in the history
A very limited set of tests for the find_maxsep_cut_coords function.
  • Loading branch information
matthew-brett committed Aug 27, 2015
1 parent 7b5953a commit 2b6460e
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion nipy/labs/viz_tools/test/test_coord_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
# vi: set ft=python sts=4 ts=4 sw=4 et:
import numpy as np

from ..coord_tools import coord_transform, find_cut_coords
from ..coord_tools import (coord_transform, find_cut_coords,
find_maxsep_cut_coords)

from numpy.testing import assert_array_equal

def test_coord_transform_trivial():
sform = np.eye(4)
Expand Down Expand Up @@ -32,3 +35,21 @@ def test_find_cut_coords():
(x_map, y_map, z_map))


def test_find_maxsep_cut_coords():
# Test find_maxsep_cut_coords function
assert_array_equal(
find_maxsep_cut_coords(np.ones((2, 3, 5)), np.eye(4)), range(5))
assert_array_equal(
find_maxsep_cut_coords(np.ones((2, 3, 5)), np.eye(4), threshold=1),
range(5))
assert_array_equal(
find_maxsep_cut_coords(np.ones((2, 3, 4)), np.eye(4), n_cuts=4),
range(4))
map_3d = np.ones((2, 3, 5))
map_3d[:, :, 1] = 0
assert_array_equal(
find_maxsep_cut_coords(map_3d, np.eye(4), n_cuts=4), [0, 2, 3, 4])
map_3d[:, :, 1] = 0.5
assert_array_equal(
find_maxsep_cut_coords(map_3d, np.eye(4), n_cuts=4, threshold=0.6),
[0, 2, 3, 4])

0 comments on commit 2b6460e

Please sign in to comment.