Skip to content

Commit aa20cc9

Browse files
committed
[TEST] Add nncivet tests
1 parent d370c0c commit aa20cc9

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

netneurotools/tests/test_civet.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# -*- coding: utf-8 -*-
2+
"""
3+
For testing netneurotools.civet functionality
4+
"""
5+
6+
import numpy as np
7+
import pytest
8+
9+
from netneurotools import civet, datasets
10+
11+
12+
@pytest.fixture(scope='module')
13+
def civet_surf(tmp_path_factory):
14+
tmpdir = str(tmp_path_factory.getbasetemp())
15+
return datasets.fetch_civet(data_dir=tmpdir, verbose=0)['mid']
16+
17+
18+
def test_read_civet(civet_surf):
19+
vertices, triangles = civet.read_civet(civet_surf.lh)
20+
assert len(vertices) == 40962
21+
assert len(triangles) == 81920
22+
assert np.all(triangles.max(axis=0) < vertices.shape[0])
23+
24+
25+
def test_civet_to_freesurfer():
26+
brainmap = np.random.rand(81924)
27+
out = civet.civet_to_freesurfer(brainmap)
28+
out2 = civet.civet_to_freesurfer(brainmap, method='linear')
29+
assert out.shape[0] == out2.shape[0] == 81924
30+
31+
with pytest.raises(ValueError):
32+
civet.civet_to_freesurfer(np.random.rand(10))

0 commit comments

Comments
 (0)