36
36
data_path = pjoin (nib_data , 'nitest-freesurfer' , DATA_SDIR )
37
37
have_freesurfer = isdir (data_path )
38
38
39
- < << << << HEAD
40
- freesurfer_test = pytest .mark .skipif (not have_freesurfer , reason = 'cannot find freesurfer {0} directory' .format (DATA_SDIR ))
41
- == == == =
42
39
freesurfer_test = pytest .mark .skipif (not have_freesurfer ,
43
40
reason = 'cannot find freesurfer {0} directory' .format (DATA_SDIR ))
44
- > >> >> >> 2 fb977b1605f5a4c4394f3b1b694e0a5e8f66de5
45
41
46
42
def _hash_file_content (fname ):
47
43
hasher = hashlib .md5 ()
@@ -64,17 +60,10 @@ def test_geometry():
64
60
surf_path , read_metadata = True , read_stamp = True )
65
61
66
62
assert 0 == faces .min ()
67
- < << << << HEAD
68
- assert coords .shape [0 ] == (faces .max () + 1 )
69
- assert 9 == len (volume_info )
70
- # assert np.array_equal([2, 0, 20],volume_info['head'])
71
- np .testing .assert_array_equal ([2 , 0 , 20 ],volume_info ['head' ])
72
- == == == =
73
63
assert coords .shape [0 ] == faces .max () + 1
74
64
assert 9 == len (volume_info )
75
65
assert np .array_equal ([2 , 0 , 20 ], volume_info ['head' ])
76
- >> >> >> > 2 fb977b1605f5a4c4394f3b1b694e0a5e8f66de5
77
- assert create_stamp == ['created by greve on Thu Jun 8 19:17:51 2006' ] # this creates assertion error - should we just remove it?
66
+ assert create_stamp == 'created by greve on Thu Jun 8 19:17:51 2006'
78
67
79
68
# Test equivalence of freesurfer- and nibabel-generated triangular files
80
69
# with respect to read_geometry()
@@ -91,12 +80,8 @@ def test_geometry():
91
80
for key in ('xras' , 'yras' , 'zras' , 'cras' ):
92
81
assert_allclose (volume_info2 [key ], volume_info [key ],
93
82
rtol = 1e-7 , atol = 1e-30 )
94
- < << << << HEAD
95
- #assert.array_equal(volume_info2['cras'], volume_info['cras'])
96
- np .testing .assert_array_equal (volume_info2 ['cras' ], volume_info ['cras' ])
97
- == == == =
83
+
98
84
assert np .array_equal (volume_info2 ['cras' ], volume_info ['cras' ])
99
- >> >> >> > 2 fb977b1605f5a4c4394f3b1b694e0a5e8f66de5
100
85
with open (surf_path , 'rb' ) as fobj :
101
86
np .fromfile (fobj , ">u1" , 3 )
102
87
read_create_stamp = fobj .readline ().decode ().rstrip ('\n ' )
@@ -106,28 +91,31 @@ def test_geometry():
106
91
with clear_and_catch_warnings () as w :
107
92
warnings .filterwarnings ('always' , category = DeprecationWarning )
108
93
read_geometry (surf_path , read_metadata = True )
109
- assert (any ('volume information contained' in str (ww .message )
94
+
95
+ assert (
96
+ any ('volume information contained' in str (ww .message )
110
97
for ww in w ))
111
- assert (any ('extension code' in str (ww .message ) for ww in w ))
98
+ assert (
99
+ any ('extension code' in str (ww .message ) for ww in w ))
112
100
volume_info ['head' ] = [1 , 2 ]
113
101
with clear_and_catch_warnings () as w :
114
102
write_geometry (surf_path , coords , faces , create_stamp , volume_info )
115
- assert (any ('Unknown extension' in str (ww .message ) for ww in w ))
103
+ assert (
104
+ any ('Unknown extension' in str (ww .message ) for ww in w ))
116
105
volume_info ['a' ] = 0
117
106
with pytest .raises (ValueError ):
118
107
write_geometry (surf_path , coords , faces , create_stamp , volume_info )
119
-
120
108
121
109
assert create_stamp == read_create_stamp
122
110
123
- np .testing . assert_array_equal (coords , coords2 )
124
- np .testing . assert_array_equal (faces , faces2 )
111
+ assert np .array_equal (coords , coords2 )
112
+ assert np .array_equal (faces , faces2 )
125
113
126
114
# Validate byte ordering
127
115
coords_swapped = coords .byteswap ().newbyteorder ()
128
116
faces_swapped = faces .byteswap ().newbyteorder ()
129
- np .testing . assert_array_equal (coords_swapped , coords )
130
- np .testing . assert_array_equal (faces_swapped , faces )
117
+ assert np .array_equal (coords_swapped , coords )
118
+ assert np .array_equal (faces_swapped , faces )
131
119
132
120
133
121
@freesurfer_test
@@ -171,11 +159,8 @@ def test_write_morph_data():
171
159
for shape in okay_shapes :
172
160
write_morph_data ('test.curv' , values .reshape (shape ))
173
161
# Check ordering is preserved, regardless of shape
174
- < << << << HEAD
175
- assert np .array_equal (read_morph_data ('test.curv' ) ,values )
176
- == == == =
177
162
assert np .array_equal (read_morph_data ('test.curv' ), values )
178
- >> >> >> > 2 fb977b1605f5a4c4394f3b1b694e0a5e8f66de5
163
+
179
164
with pytest .raises (ValueError ):
180
165
write_morph_data ('test.curv' , np .zeros (shape ), big_num )
181
166
# Windows 32-bit overflows Python int
@@ -185,10 +170,6 @@ def test_write_morph_data():
185
170
for shape in bad_shapes :
186
171
with pytest .raises (ValueError ):
187
172
write_morph_data ('test.curv' , values .reshape (shape ))
188
- < << << << HEAD
189
-
190
- == == == =
191
- >> >> >> > 2 fb977b1605f5a4c4394f3b1b694e0a5e8f66de5
192
173
193
174
@freesurfer_test
194
175
def test_annot ():
@@ -225,10 +206,10 @@ def test_annot():
225
206
if labels_orig is not None :
226
207
labels_orig_2 , _ , _ = read_annot (annot_path , orig_ids = True )
227
208
228
- np .testing . assert_array_equal (labels , labels2 )
209
+ assert np .array_equal (labels , labels2 )
229
210
if labels_orig is not None :
230
- np .testing . assert_array_equal (labels_orig , labels_orig_2 )
231
- np .testing . assert_array_equal (ctab , ctab2 )
211
+ assert np .array_equal (labels_orig , labels_orig_2 )
212
+ assert np .array_equal (ctab , ctab2 )
232
213
assert names == names2
233
214
234
215
@@ -393,6 +374,6 @@ def test_write_annot_maxstruct():
393
374
# Validate the file can be read
394
375
rt_labels , rt_ctab , rt_names = read_annot (annot_path )
395
376
# Check round-trip
396
- assert_array_equal (labels , rt_labels )
397
- assert_array_equal (rgba , rt_ctab [:, :4 ])
377
+ assert np . array_equal (labels , rt_labels )
378
+ assert np . array_equal (rgba , rt_ctab [:, :4 ])
398
379
assert names == [n .decode ('ascii' ) for n in rt_names ]
0 commit comments