@@ -137,20 +137,24 @@ def test_gen_spinsamples():
137137 # generate "normal" test spins
138138 spins , cost = stats .gen_spinsamples (coords , hemi , n_rotate = 10 , seed = 1234 ,
139139 return_cost = True )
140- assert spins .shape == (len (coords ), 10 )
141- assert cost .shape == (len (coords ), 10 )
140+ assert spins .shape == spins .shape == (len (coords ), 10 )
142141
143- # confirm that `exact ` parameter functions as desired
142+ # confirm that `method ` parameter functions as desired
144143 for method in ['vasa' , 'hungarian' ]:
145144 spin_exact , cost_exact = stats .gen_spinsamples (coords , hemi ,
146145 n_rotate = 10 , seed = 1234 ,
147146 method = method ,
148147 return_cost = True )
149- assert spin_exact .shape == (len (coords ), 10 )
150- assert cost .shape == (len (coords ), 10 )
148+ assert spin_exact .shape == cost .shape == (len (coords ), 10 )
151149 for s in spin_exact .T :
152150 assert len (np .unique (s )) == len (s )
153151
152+ # check that one hemisphere works
153+ mask = hemi == 0
154+ spins , cost = stats .gen_spinsamples (coords [mask ], hemi [mask ], n_rotate = 10 ,
155+ seed = 1234 , return_cost = True )
156+ assert spins .shape == cost .shape == (len (coords [mask ]), 10 )
157+
154158 # confirm that check_duplicates will raise warnings
155159 # since spins aren't exact permutations we need to use 4C4 with repeats
156160 # and then perform one more rotation than that number (i.e., 35 + 1)
@@ -169,8 +173,3 @@ def test_gen_spinsamples():
169173 # different length coords and hemi
170174 with pytest .raises (ValueError ):
171175 stats .gen_spinsamples (coords , hemi [:- 1 ])
172-
173- # only one hemisphere
174- # TODO: should this be allowed?
175- with pytest .raises (ValueError ):
176- stats .gen_spinsamples (coords [hemi == 0 ], hemi [hemi == 0 ])
0 commit comments