@@ -128,7 +128,9 @@ def test_brain_models():
128128 assert (bml [4 ].vertex == [2 , 9 , 14 ]).all ()
129129
130130 for bm , label , is_surface in zip (
131- bml , ['ThalamusRight' , 'Other' , 'cortex_left' , 'Other' ], (False , False , True , True )
131+ bml ,
132+ ['ThalamusRight' , 'Other' , 'cortex_left' , 'Other' ],
133+ (False , False , True , True ),
132134 ):
133135 assert np .all (bm .surface_mask == ~ bm .volume_mask )
134136 structures = list (bm .iter_structures ())
@@ -176,18 +178,27 @@ def test_brain_models():
176178
177179 # Test the constructor
178180 bm_vox = axes .BrainModelAxis (
179- 'thalamus_left' , voxel = np .ones ((5 , 3 ), dtype = int ), affine = np .eye (4 ), volume_shape = (2 , 3 , 4 )
181+ 'thalamus_left' ,
182+ voxel = np .ones ((5 , 3 ), dtype = int ),
183+ affine = np .eye (4 ),
184+ volume_shape = (2 , 3 , 4 ),
180185 )
181186 assert np .all (bm_vox .name == ['CIFTI_STRUCTURE_THALAMUS_LEFT' ] * 5 )
182187 assert np .array_equal (bm_vox .vertex , np .full (5 , - 1 ))
183188 assert np .array_equal (bm_vox .voxel , np .full ((5 , 3 ), 1 ))
184189 with pytest .raises (ValueError ):
185190 # no volume shape
186- axes .BrainModelAxis ('thalamus_left' , voxel = np .ones ((5 , 3 ), dtype = int ), affine = np .eye (4 ))
191+ axes .BrainModelAxis (
192+ 'thalamus_left' ,
193+ voxel = np .ones ((5 , 3 ), dtype = int ),
194+ affine = np .eye (4 ),
195+ )
187196 with pytest .raises (ValueError ):
188197 # no affine
189198 axes .BrainModelAxis (
190- 'thalamus_left' , voxel = np .ones ((5 , 3 ), dtype = int ), volume_shape = (2 , 3 , 4 )
199+ 'thalamus_left' ,
200+ voxel = np .ones ((5 , 3 ), dtype = int ),
201+ volume_shape = (2 , 3 , 4 ),
191202 )
192203 with pytest .raises (ValueError ):
193204 # incorrect name
@@ -207,7 +218,11 @@ def test_brain_models():
207218 )
208219 with pytest .raises (ValueError ):
209220 # no voxels or vertices
210- axes .BrainModelAxis ('thalamus_left' , affine = np .eye (4 ), volume_shape = (2 , 3 , 4 ))
221+ axes .BrainModelAxis (
222+ 'thalamus_left' ,
223+ affine = np .eye (4 ),
224+ volume_shape = (2 , 3 , 4 ),
225+ )
211226 with pytest .raises (ValueError ):
212227 # incorrect voxel shape
213228 axes .BrainModelAxis (
@@ -218,7 +233,9 @@ def test_brain_models():
218233 )
219234
220235 bm_vertex = axes .BrainModelAxis (
221- 'cortex_left' , vertex = np .ones (5 , dtype = int ), nvertices = {'cortex_left' : 20 }
236+ 'cortex_left' ,
237+ vertex = np .ones (5 , dtype = int ),
238+ nvertices = {'cortex_left' : 20 },
222239 )
223240 assert np .array_equal (bm_vertex .name , ['CIFTI_STRUCTURE_CORTEX_LEFT' ] * 5 )
224241 assert np .array_equal (bm_vertex .vertex , np .full (5 , 1 ))
@@ -227,11 +244,15 @@ def test_brain_models():
227244 axes .BrainModelAxis ('cortex_left' , vertex = np .ones (5 , dtype = int ))
228245 with pytest .raises (ValueError ):
229246 axes .BrainModelAxis (
230- 'cortex_left' , vertex = np .ones (5 , dtype = int ), nvertices = {'cortex_right' : 20 }
247+ 'cortex_left' ,
248+ vertex = np .ones (5 , dtype = int ),
249+ nvertices = {'cortex_right' : 20 },
231250 )
232251 with pytest .raises (ValueError ):
233252 axes .BrainModelAxis (
234- 'cortex_left' , vertex = - np .ones (5 , dtype = int ), nvertices = {'cortex_left' : 20 }
253+ 'cortex_left' ,
254+ vertex = - np .ones (5 , dtype = int ),
255+ nvertices = {'cortex_left' : 20 },
235256 )
236257
237258 # test from_mask errors
@@ -244,7 +265,10 @@ def test_brain_models():
244265
245266 # tests error in adding together or combining as ParcelsAxis
246267 bm_vox = axes .BrainModelAxis (
247- 'thalamus_left' , voxel = np .ones ((5 , 3 ), dtype = int ), affine = np .eye (4 ), volume_shape = (2 , 3 , 4 )
268+ 'thalamus_left' ,
269+ voxel = np .ones ((5 , 3 ), dtype = int ),
270+ affine = np .eye (4 ),
271+ volume_shape = (2 , 3 , 4 ),
248272 )
249273 bm_vox + bm_vox
250274 assert (bm_vertex + bm_vox )[: bm_vertex .size ] == bm_vertex
@@ -289,7 +313,10 @@ def test_brain_models():
289313
290314 # test equalities
291315 bm_vox = axes .BrainModelAxis (
292- 'thalamus_left' , voxel = np .ones ((5 , 3 ), dtype = int ), affine = np .eye (4 ), volume_shape = (2 , 3 , 4 )
316+ 'thalamus_left' ,
317+ voxel = np .ones ((5 , 3 ), dtype = int ),
318+ affine = np .eye (4 ),
319+ volume_shape = (2 , 3 , 4 ),
293320 )
294321 bm_other = deepcopy (bm_vox )
295322 assert bm_vox == bm_other
0 commit comments