diff --git a/scilpy/connectivity/tests/test_connectivity.py b/scilpy/connectivity/tests/test_connectivity.py index 0931162a1..384084e7d 100644 --- a/scilpy/connectivity/tests/test_connectivity.py +++ b/scilpy/connectivity/tests/test_connectivity.py @@ -23,8 +23,8 @@ def test_compute_triu_connectivity_from_labels(): tractogram, labels) assert np.array_equal(output.shape, [8, 8]) expected_out = np.zeros((8, 8)) - expected_out[1, 3] = 1 - expected_out[4, 6] = 2 + expected_out[1, 3] = 1 # This is labels (4, 6) + expected_out[4, 6] = 2 # This is labels (7, 9) assert np.array_equal(output, expected_out) diff --git a/scilpy/connectivity/tests/test_matrix_tools.py b/scilpy/connectivity/tests/test_matrix_tools.py index d3b0595d2..02b6b265d 100644 --- a/scilpy/connectivity/tests/test_matrix_tools.py +++ b/scilpy/connectivity/tests/test_matrix_tools.py @@ -1,4 +1,7 @@ # -*- coding: utf-8 -*- +import numpy as np + +from scilpy.connectivity.matrix_tools import apply_reordering def test_compute_olo(): @@ -10,8 +13,24 @@ def test_apply_olo(): def test_apply_reordering(): - pass - + conn_matrix = np.asarray([[1, 2, 3, 4], + [5, 6, 7, 8], + [9, 10, 11, 12], + [13, 14, 15, 16]]) + output = apply_reordering(conn_matrix, [[0, 1, 3, 2], + [1, 2, 3, 0]]) + # First changing rows 2 and 3 + expected_out = np.asarray([[1, 2, 3, 4], + [5, 6, 7, 8], + [13, 14, 15, 16], + [9, 10, 11, 12]]) + # Permuting columns + expected_out = np.asarray([[2, 3, 4, 1], + [6, 7, 8, 5], + [14, 15, 16, 13], + [10, 11, 12, 9]]) + assert np.array_equal(output, expected_out) + def test_evaluate_graph_measures(): pass