4545numDA = [2 , 1 , 1 , 1 , 2 , 1 ]
4646
4747DATA_FILE1_darr1 = np .array (
48- [[- 16.07201 , - 66.187515 , 21.266994 ],
49- [- 16.705893 , - 66.054337 , 21.232786 ],
50- [- 17.614349 , - 65.401642 , 21.071466 ]])
51- DATA_FILE1_darr2 = np .array ( [0 ,1 , 2 ] )
52-
53- DATA_FILE2_darr1 = np .array ([[ 0.43635699 ],
54- [ 0.270017 ],
55- [ 0.133239 ],
56- [ 0.35054299 ],
57- [ 0.26538199 ],
58- [ 0.32122701 ],
59- [ 0.23495001 ],
60- [ 0.26671499 ],
61- [ 0.306851 ],
62- [ 0.36302799 ]], dtype = np .float32 )
48+ [[- 16.07201 , - 66.187515 , 21.266994 ],
49+ [- 16.705893 , - 66.054337 , 21.232786 ],
50+ [- 17.614349 , - 65.401642 , 21.071466 ]])
51+ DATA_FILE1_darr2 = np .array ([0 , 1 , 2 ] )
52+
53+ DATA_FILE2_darr1 = np .array ([[0.43635699 ],
54+ [ 0.270017 ],
55+ [ 0.133239 ],
56+ [ 0.35054299 ],
57+ [ 0.26538199 ],
58+ [ 0.32122701 ],
59+ [ 0.23495001 ],
60+ [ 0.26671499 ],
61+ [ 0.306851 ],
62+ [ 0.36302799 ]], dtype = np .float32 )
6363
6464DATA_FILE3_darr1 = np .array ([0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 1 , 0 , 0 , 0 , 0 ])
6565
6666DATA_FILE4_darr1 = np .array ([[- 0.57811606 ],
67- [- 0.53871965 ],
68- [- 0.44602534 ],
69- [- 0.56532663 ],
70- [- 0.51392376 ],
71- [- 0.43225467 ],
72- [- 0.54646534 ],
73- [- 0.48011276 ],
74- [- 0.45624232 ],
75- [- 0.31101292 ]], dtype = np .float32 )
76-
77- DATA_FILE5_darr1 = np .array ([[ 155.17539978 , 135.58103943 , 98.30715179 ],
78- [ 140.33973694 , 190.0491333 , 73.24776459 ],
79- [ 157.3598938 , 196.97969055 , 83.65809631 ],
80- [ 171.46174622 , 137.43661499 , 78.4709549 ],
81- [ 148.54592896 , 97.06752777 , 65.96373749 ],
82- [ 123.45701599 , 111.46841431 , 66.3571167 ],
83- [ 135.30892944 , 202.28720093 , 36.38148499 ],
84- [ 178.28155518 , 162.59469604 , 37.75128937 ],
85- [ 178.11087036 , 115.28820038 , 57.17986679 ],
86- [ 142.81582642 , 82.82115173 , 31.02205276 ]], dtype = np .float32 )
87-
88- DATA_FILE5_darr2 = np .array ([[ 6402 , 17923 , 25602 ],
89- [14085 , 25602 , 17923 ],
90- [25602 , 14085 , 4483 ],
91- [17923 , 1602 , 14085 ],
92- [ 4483 , 25603 , 25602 ],
93- [25604 , 25602 , 25603 ],
94- [25602 , 25604 , 6402 ],
95- [25603 , 3525 , 25604 ],
96- [ 1123 , 17922 , 12168 ],
97- [25604 , 12168 , 17922 ]], dtype = np .int32 )
67+ [- 0.53871965 ],
68+ [- 0.44602534 ],
69+ [- 0.56532663 ],
70+ [- 0.51392376 ],
71+ [- 0.43225467 ],
72+ [- 0.54646534 ],
73+ [- 0.48011276 ],
74+ [- 0.45624232 ],
75+ [- 0.31101292 ]], dtype = np .float32 )
76+
77+ DATA_FILE5_darr1 = np .array ([[155.17539978 , 135.58103943 , 98.30715179 ],
78+ [ 140.33973694 , 190.0491333 , 73.24776459 ],
79+ [ 157.3598938 , 196.97969055 , 83.65809631 ],
80+ [ 171.46174622 , 137.43661499 , 78.4709549 ],
81+ [ 148.54592896 , 97.06752777 , 65.96373749 ],
82+ [ 123.45701599 , 111.46841431 , 66.3571167 ],
83+ [ 135.30892944 , 202.28720093 , 36.38148499 ],
84+ [ 178.28155518 , 162.59469604 , 37.75128937 ],
85+ [ 178.11087036 , 115.28820038 , 57.17986679 ],
86+ [ 142.81582642 , 82.82115173 , 31.02205276 ]], dtype = np .float32 )
87+
88+ DATA_FILE5_darr2 = np .array ([[6402 , 17923 , 25602 ],
89+ [14085 , 25602 , 17923 ],
90+ [25602 , 14085 , 4483 ],
91+ [17923 , 1602 , 14085 ],
92+ [ 4483 , 25603 , 25602 ],
93+ [25604 , 25602 , 25603 ],
94+ [25602 , 25604 , 6402 ],
95+ [25603 , 3525 , 25604 ],
96+ [ 1123 , 17922 , 12168 ],
97+ [25604 , 12168 , 17922 ]], dtype = np .int32 )
9898
9999DATA_FILE6_darr1 = np .array ([9182740 , 9182740 , 9182740 ], dtype = np .float32 )
100100
@@ -107,15 +107,15 @@ def test_read_ordering():
107107 assert_equal (img2 .darrays [0 ].data .shape , (143479 , 1 ))
108108 # Read image for which we know output shape
109109 img = load (DATA_FILE1 )
110- assert_equal (img .darrays [0 ].data .shape , (3 ,3 ))
110+ assert_equal (img .darrays [0 ].data .shape , (3 , 3 ))
111111
112112
113113def test_load_metadata ():
114114 for i , dat in enumerate (datafiles ):
115115 img = load (dat )
116116 me = img .meta
117117 assert_equal (numDA [i ], img .numDA )
118- assert_equal (img .version ,'1.0' )
118+ assert_equal (img .version , '1.0' )
119119
120120
121121def test_metadata_deprecations ():
@@ -142,13 +142,15 @@ def test_load_dataarray1():
142142 for img in (img1 , bimg ):
143143 assert_array_almost_equal (img .darrays [0 ].data , DATA_FILE1_darr1 )
144144 assert_array_almost_equal (img .darrays [1 ].data , DATA_FILE1_darr2 )
145- me = img .darrays [0 ].meta .metadata
145+ me = img .darrays [0 ].meta .metadata
146146 assert_true ('AnatomicalStructurePrimary' in me )
147147 assert_true ('AnatomicalStructureSecondary' in me )
148148 assert_equal (me ['AnatomicalStructurePrimary' ], 'CortexLeft' )
149- assert_array_almost_equal (img .darrays [0 ].coordsys .xform , np .eye (4 ,4 ))
150- assert_equal (xform_codes .niistring [img .darrays [0 ].coordsys .dataspace ],'NIFTI_XFORM_TALAIRACH' )
151- assert_equal (xform_codes .niistring [img .darrays [0 ].coordsys .xformspace ],'NIFTI_XFORM_TALAIRACH' )
149+ assert_array_almost_equal (img .darrays [0 ].coordsys .xform , np .eye (4 , 4 ))
150+ assert_equal (xform_codes .niistring [img .darrays [
151+ 0 ].coordsys .dataspace ], 'NIFTI_XFORM_TALAIRACH' )
152+ assert_equal (xform_codes .niistring [img .darrays [
153+ 0 ].coordsys .xformspace ], 'NIFTI_XFORM_TALAIRACH' )
152154
153155
154156def test_load_dataarray2 ():
@@ -223,19 +225,19 @@ def test_readwritedata():
223225 with InTemporaryDirectory ():
224226 save (img , 'test.gii' )
225227 img2 = load ('test.gii' )
226- assert_equal (img .numDA ,img2 .numDA )
228+ assert_equal (img .numDA , img2 .numDA )
227229 assert_array_almost_equal (img .darrays [0 ].data ,
228230 img2 .darrays [0 ].data )
229231
230232
231233def test_write_newmetadata ():
232234 img = gi .GiftiImage ()
233- attr = gi .GiftiNVPairs (name = 'mykey' , value = 'val1' )
235+ attr = gi .GiftiNVPairs (name = 'mykey' , value = 'val1' )
234236 newmeta = gi .GiftiMetaData (attr )
235237 img .meta = newmeta
236238 myme = img .meta .metadata
237239 assert_true ('mykey' in myme )
238- newmeta = gi .GiftiMetaData .from_dict ( {'mykey1' : 'val2' } )
240+ newmeta = gi .GiftiMetaData .from_dict ({'mykey1' : 'val2' })
239241 img .meta = newmeta
240242 myme = img .meta .metadata
241243 assert_true ('mykey1' in myme )
0 commit comments