@@ -30,25 +30,31 @@ def test_compcor(self):
30
30
mask [0 ,0 ,1 ] = 0
31
31
mask_file = utils .save_toy_nii (mask , self .filenames ['masknii' ])
32
32
33
- expected_sha1 = 'b0dd7f9ab7ba8f516712eb0204dacc9e397fc6aa'
33
+ expected_components = [['-0.1989607212' , '-0.5753813646' ],
34
+ ['0.5692369697' , '0.5674945949' ],
35
+ ['-0.6662573243' , '0.4675843432' ],
36
+ ['0.4206466244' , '-0.3361270124' ],
37
+ ['-0.1246655485' , '-0.1235705610' ]]
34
38
35
39
ccresult = self .run_cc (CompCor (realigned_file = self .realigned_file ,
36
40
mask_file = mask_file ),
37
- expected_sha1 )
41
+ expected_components )
38
42
39
43
accresult = self .run_cc (ACompCor (realigned_file = self .realigned_file ,
40
44
mask_file = mask_file ,
41
45
components_file = 'acc_components_file' ),
42
- expected_sha1 )
46
+ expected_components )
43
47
44
48
assert_equal (os .path .getsize (ccresult .outputs .components_file ),
45
49
os .path .getsize (accresult .outputs .components_file ))
46
50
47
51
def test_tcompcor (self ):
48
52
ccinterface = TCompCor (realigned_file = self .realigned_file )
49
- self .run_cc (ccinterface , '12e54c07281a28ac0da3b934dce5c9d27626848a' )
53
+ self .run_cc (ccinterface , [['-0.2846272268' ], ['0.7115680670' ],
54
+ ['-0.6048328569' ], ['0.2134704201' ],
55
+ ['-0.0355784033' ]])
50
56
51
- def run_cc (self , ccinterface , expected_components_data_sha1 ):
57
+ def run_cc (self , ccinterface , expected_components ):
52
58
# run
53
59
ccresult = ccinterface .run ()
54
60
@@ -60,12 +66,12 @@ def run_cc(self, ccinterface, expected_components_data_sha1):
60
66
assert_equal (ccinterface .inputs .num_components , 6 )
61
67
62
68
with open (ccresult .outputs .components_file , 'r' ) as components_file :
63
- components_data = [line for line in components_file ]
69
+ components_data = [line . split () for line in components_file ]
64
70
num_got_components = len (components_data )
65
71
assert_true (num_got_components == ccinterface .inputs .num_components
66
72
or num_got_components == self .fake_data .shape [3 ])
67
- print ( str ( components_data ), "comdata" )
68
- assert_equal (sha1 ( str ( components_data )). hexdigest (), expected_components_data_sha1 )
73
+ first_two = [ row [: 2 ] for row in components_data ]
74
+ assert_equal (first_two , expected_components )
69
75
return ccresult
70
76
71
77
def tearDown (self ):
0 commit comments