1
1
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
2
2
# vi: set ft=python sts=4 ts=4 sw=4 et:
3
- import nipype
4
- from ...testing import (assert_equal , assert_true , assert_false , skipif , utils ,
5
- assert_almost_equal , raises )
6
- from .. import stats
7
-
8
3
import unittest
9
- import nibabel as nb
10
- import numpy as np
11
4
import os
12
5
import tempfile
13
6
import shutil
14
7
8
+ import numpy as np
9
+
10
+ from ...testing import (assert_equal , utils , assert_almost_equal , raises )
11
+ from .. import stats
12
+
15
13
class TestSignalExtraction (unittest .TestCase ):
16
14
17
15
filenames = {
@@ -50,11 +48,10 @@ def test_signal_extraction(self):
50
48
assert_equal (len (got ), num_timepoints_wanted )
51
49
# convert from string to float
52
50
got = [[float (num ) for num in row ] for row in got ]
53
- for time in range (len (got )):
54
- assert_equal (len (labels_wanted ), len (got [time ]))
55
- for segment in range (len (got [time ])):
56
- assert_almost_equal (got [time ][segment ],
57
- wanted [time ][segment ], decimal = 1 )
51
+ for i , time in enumerate (got ):
52
+ assert_equal (len (labels_wanted ), len (time ))
53
+ for j , segment in enumerate (time ):
54
+ assert_almost_equal (segment , wanted [i ][j ], decimal = 1 )
58
55
59
56
@raises (ValueError )
60
57
def test_signal_extraction_bad_class_labels (self ):
@@ -67,18 +64,18 @@ def tearDown(self):
67
64
os .chdir (self .orig_dir )
68
65
shutil .rmtree (self .temp_dir )
69
66
70
- fake_fmri_data = np .array ([[[[ 2 , - 1 , 4 , - 2 , 3 ],
71
- [ 4 , - 2 , - 5 , - 1 , 0 ]],
67
+ fake_fmri_data = np .array ([[[[2 , - 1 , 4 , - 2 , 3 ],
68
+ [4 , - 2 , - 5 , - 1 , 0 ]],
72
69
73
- [[- 2 , 0 , 1 , 4 , 4 ],
74
- [- 5 , 3 , - 3 , 1 , - 5 ]]],
70
+ [[- 2 , 0 , 1 , 4 , 4 ],
71
+ [- 5 , 3 , - 3 , 1 , - 5 ]]],
75
72
76
73
77
- [[[ 2 , - 2 , - 1 , - 2 , - 5 ],
78
- [ 3 , 0 , 3 , - 5 , - 2 ]],
74
+ [[[2 , - 2 , - 1 , - 2 , - 5 ],
75
+ [3 , 0 , 3 , - 5 , - 2 ]],
79
76
80
- [[- 4 , - 2 , - 2 , 1 , - 2 ],
81
- [ 3 , 1 , 4 , - 3 , - 2 ]]]])
77
+ [[- 4 , - 2 , - 2 , 1 , - 2 ],
78
+ [3 , 1 , 4 , - 3 , - 2 ]]]])
82
79
83
80
fake_label_data = np .array ([[[1 , 0 ],
84
81
[3 , 1 ]],
0 commit comments