@@ -63,7 +63,7 @@ def test_init():
6363 bio .seek (16 )
6464 bio .write (arr .tostring (order = 'F' ))
6565 hdr = FunkyHeader (shape )
66- ap = ArrayProxy (bio , hdr )
66+ ap = ArrayProxy . from_header (bio , hdr )
6767 assert_true (ap .file_like is bio )
6868 assert_equal (ap .shape , shape )
6969 # shape should be read only
@@ -79,7 +79,7 @@ def test_init():
7979 bio = BytesIO ()
8080 bio .seek (16 )
8181 bio .write (arr .tostring (order = 'C' ))
82- ap = CArrayProxy (bio , FunkyHeader ((2 , 3 , 4 )))
82+ ap = CArrayProxy . from_header (bio , FunkyHeader ((2 , 3 , 4 )))
8383 assert_array_equal (np .asarray (ap ), arr )
8484
8585
@@ -97,7 +97,7 @@ def test_nifti1_init():
9797 arr = np .arange (24 , dtype = np .int16 ).reshape (shape )
9898 write_raw_data (arr , hdr , bio )
9999 hdr .set_slope_inter (2 , 10 )
100- ap = ArrayProxy (bio , hdr )
100+ ap = ArrayProxy . from_header (bio , hdr )
101101 assert_true (ap .file_like == bio )
102102 assert_equal (ap .shape , shape )
103103 # Check there has been a copy of the header
@@ -110,7 +110,7 @@ def test_nifti1_init():
110110 f = open ('test.nii' , 'wb' )
111111 write_raw_data (arr , hdr , f )
112112 f .close ()
113- ap = ArrayProxy ('test.nii' , hdr )
113+ ap = ArrayProxy . from_header ('test.nii' , hdr )
114114 assert_true (ap .file_like == 'test.nii' )
115115 assert_equal (ap .shape , shape )
116116 assert_array_equal (np .asarray (ap ), arr * 2.0 + 10 )
@@ -130,15 +130,15 @@ def test_proxy_slicing():
130130 fobj = BytesIO ()
131131 fobj .write (b'\0 ' * offset )
132132 fobj .write (arr .tostring (order = order ))
133- prox = klass (fobj , hdr )
133+ prox = klass . from_header (fobj , hdr )
134134 for sliceobj in slicer_samples (shape ):
135135 assert_array_equal (arr [sliceobj ], prox [sliceobj ])
136136 # Check slicing works with scaling
137137 hdr .set_slope_inter (2.0 , 1.0 )
138138 fobj = BytesIO ()
139139 fobj .write (b'\0 ' * offset )
140140 fobj .write (arr .tostring (order = 'F' ))
141- prox = ArrayProxy (fobj , hdr )
141+ prox = ArrayProxy . from_header (fobj , hdr )
142142 sliceobj = (None , slice (None ), 1 , - 1 )
143143 assert_array_equal (arr [sliceobj ] * 2.0 + 1.0 , prox [sliceobj ])
144144
@@ -147,7 +147,7 @@ def test_is_proxy():
147147 # Test is_proxy function
148148 hdr = FunkyHeader ((2 , 3 , 4 ))
149149 bio = BytesIO ()
150- prox = ArrayProxy (bio , hdr )
150+ prox = ArrayProxy . from_header (bio , hdr )
151151 assert_true (is_proxy (prox ))
152152 assert_false (is_proxy (bio ))
153153 assert_false (is_proxy (hdr ))
@@ -163,7 +163,7 @@ def test_reshape_dataobj():
163163 shape = (1 , 2 , 3 , 4 )
164164 hdr = FunkyHeader (shape )
165165 bio = BytesIO ()
166- prox = ArrayProxy (bio , hdr )
166+ prox = ArrayProxy . from_header (bio , hdr )
167167 arr = np .arange (np .prod (shape ), dtype = prox .dtype ).reshape (shape )
168168 bio .write (b'\x00 ' * prox .offset + arr .tostring (order = 'F' ))
169169 assert_array_equal (prox , arr )
@@ -198,7 +198,7 @@ def get_slope_inter(self):
198198 arr = np .arange (24 , dtype = np .int32 ).reshape (shape , order = 'F' )
199199 bio .write (b'\x00 ' * hdr .get_data_offset ())
200200 bio .write (arr .tostring (order = 'F' ))
201- prox = ArrayProxy (bio , hdr )
201+ prox = ArrayProxy . from_header (bio , hdr )
202202 assert_array_almost_equal (np .array (prox ), arr * 2.1 + 3.14 )
203203 # Check unscaled read works
204204 assert_array_almost_equal (prox .get_unscaled (), arr )
0 commit comments