|
8 | 8 | import nibabel as nb |
9 | 9 | import numpy as np |
10 | 10 |
|
11 | | -from ...testing import assert_equal, assert_true, utils |
| 11 | +from ...testing import assert_equal, assert_true, utils, assert_in |
12 | 12 | from ..confounds import CompCor, TCompCor, ACompCor |
13 | 13 |
|
14 | 14 | class TestCompCor(unittest.TestCase): |
@@ -39,7 +39,7 @@ def test_compcor(self): |
39 | 39 | ['-0.1246655485', '-0.1235705610']] |
40 | 40 |
|
41 | 41 | self.run_cc(CompCor(realigned_file=self.realigned_file, mask_file=self.mask_file), |
42 | | - expected_components) |
| 42 | + expected_components) |
43 | 43 |
|
44 | 44 | self.run_cc(ACompCor(realigned_file=self.realigned_file, mask_file=self.mask_file, |
45 | 45 | components_file='acc_components_file'), |
@@ -105,10 +105,12 @@ def run_cc(self, ccinterface, expected_components, expected_header='CompCor'): |
105 | 105 | with open(ccresult.outputs.components_file, 'r') as components_file: |
106 | 106 | expected_n_components = min(ccinterface.inputs.num_components, self.fake_data.shape[3]) |
107 | 107 |
|
108 | | - components_data = [line.split() for line in components_file] |
| 108 | + components_data = [line.split('\t') for line in components_file] |
109 | 109 |
|
110 | | - header = components_data.pop(0)[1:] # the first item will be '#', we can throw it out |
111 | | - assert_equal(header, [expected_header + str(i) for i in range(expected_n_components)]) |
| 110 | + header = components_data.pop(0) # the first item will be '#', we can throw it out |
| 111 | + expected_header = [expected_header + str(i) for i in range(expected_n_components)] |
| 112 | + for i, heading in enumerate(header): |
| 113 | + assert_in(expected_header[i], heading) |
112 | 114 |
|
113 | 115 | num_got_timepoints = len(components_data) |
114 | 116 | assert_equal(num_got_timepoints, self.fake_data.shape[3]) |
|
0 commit comments