Skip to content

Commit e821b80

Browse files
committed
tst: lta file parsing
1 parent 6c84ea8 commit e821b80

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

nitransforms/tests/test_io.py

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import os
2+
3+
import numpy as np
4+
5+
from ..io import LinearTransformArray as LTA
6+
7+
8+
def test_LinearTransformArray_input(tmpdir, data_path):
9+
lta = LTA()
10+
assert lta['nxforms'] == 0
11+
assert len(lta['xforms']) == 0
12+
13+
test_lta = os.path.join(data_path, 'inv.lta')
14+
with open(test_lta) as fp:
15+
lta = LTA.from_fileobj(fp)
16+
17+
assert lta.get('type') == 1
18+
assert len(lta['xforms']) == lta['nxforms'] == 1
19+
xform = lta['xforms'][0]
20+
21+
assert np.allclose(
22+
xform['m_L'], np.genfromtxt(test_lta, skip_header=5, skip_footer=20)
23+
)

0 commit comments

Comments
 (0)