@@ -792,7 +792,7 @@ def test_working_type():
792
792
# need this because of the very confusing np.int32 != np.intp (on 32 bit).
793
793
def wt (* args , ** kwargs ):
794
794
return np .dtype (working_type (* args , ** kwargs )).str
795
- d1 = np .atleast_1d
795
+ d1 = np .atleast_1d
796
796
for in_type in NUMERIC_TYPES :
797
797
in_ts = np .dtype (in_type ).str
798
798
assert wt (in_type ) == in_ts
@@ -812,7 +812,7 @@ def wt(*args, **kwargs):
812
812
out_val = in_val - d1 (i_val )
813
813
assert wt (in_type , 1 , i_val ) == out_val .dtype .str
814
814
# Combine scaling and intercept
815
- out_val = (in_val - d1 (i_val )) / d1 (sl_val )
815
+ out_val = (in_val - d1 (i_val )) / d1 (sl_val )
816
816
assert wt (in_type , sl_val , i_val ) == out_val .dtype .str
817
817
# Confirm that type codes and dtypes work as well
818
818
f32s = np .dtype (np .float32 ).str
@@ -849,7 +849,7 @@ def test_best_write_scale_ftype():
849
849
assert best_write_scale_ftype (arr , np .float32 (2 ), 0 ) == better_float_of (dtt , np .float32 )
850
850
assert best_write_scale_ftype (arr , 1 , np .float32 (1 )) == better_float_of (dtt , np .float32 )
851
851
# Overflowing ints with scaling results in upcast
852
- best_vals = ((np .float32 , np .float64 ),)
852
+ best_vals = ((np .float32 , np .float64 ),)
853
853
if np .longdouble in OK_FLOATS :
854
854
best_vals += ((np .float64 , np .longdouble ),)
855
855
for lower_t , higher_t in best_vals :
@@ -869,14 +869,14 @@ def test_best_write_scale_ftype():
869
869
assert best_write_scale_ftype (arr , 1 , - big_delta / 2.01 ) == lower_t
870
870
assert best_write_scale_ftype (arr , 1 , - big_delta / 2.0 ) == higher_t
871
871
# With infs already in input, default type returns
872
- arr [0 ]= np .inf
872
+ arr [0 ] = np .inf
873
873
assert best_write_scale_ftype (arr , lower_t (0.5 ), 0 ) == lower_t
874
- arr [0 ]= - np .inf
874
+ arr [0 ] = - np .inf
875
875
assert best_write_scale_ftype (arr , lower_t (0.5 ), 0 ) == lower_t
876
876
877
877
878
878
def test_can_cast ():
879
- tests = ((np .float32 , np .float32 , True , True , True ),
879
+ tests = ((np .float32 , np .float32 , True , True , True ),
880
880
(np .float64 , np .float32 , True , True , True ),
881
881
(np .complex128 , np .float32 , False , False , False ),
882
882
(np .float32 , np .complex128 , True , True , True ),
@@ -1060,8 +1060,8 @@ def test_allopen_compresslevel():
1060
1060
with open (__file__ , 'rb' ) as fobj :
1061
1061
my_self = fobj .read ()
1062
1062
# Prepare loop
1063
- fname = 'test.gz'
1064
- sizes = {}
1063
+ fname = 'test.gz'
1064
+ sizes = {}
1065
1065
# Stash module global
1066
1066
from .. import volumeutils as vu
1067
1067
original_compress_level = vu .default_compresslevel
@@ -1085,8 +1085,8 @@ def test_allopen_compresslevel():
1085
1085
1086
1086
1087
1087
def test_shape_zoom_affine ():
1088
- shape = (3 , 5 , 7 )
1089
- zooms = (3 , 2 , 1 )
1088
+ shape = (3 , 5 , 7 )
1089
+ zooms = (3 , 2 , 1 )
1090
1090
res = shape_zoom_affine (shape , zooms )
1091
1091
exp = np .array ([[- 3. , 0. , 0. , 3. ],
1092
1092
[0. , 2. , 0. , - 4. ],
@@ -1121,7 +1121,7 @@ def test_dtypes():
1121
1121
# In [10]: dtype('<f4') == dtype('<f4').newbyteorder('<')
1122
1122
# Out[10]: True
1123
1123
# where '<' is the native byte order
1124
- dt_defs = ((16 , 'float32' , np .float32 ),)
1124
+ dt_defs = ((16 , 'float32' , np .float32 ),)
1125
1125
dtr = make_dt_codes (dt_defs )
1126
1126
# check we have the fields we were expecting
1127
1127
assert dtr .value_set () == set ((16 ,))
@@ -1136,23 +1136,23 @@ def test_dtypes():
1136
1136
# But this one used to fail
1137
1137
assert dtr [np .dtype ('f4' ).newbyteorder (native_code )] == 16
1138
1138
# Check we can pass in niistring as well
1139
- dt_defs = ((16 , 'float32' , np .float32 , 'ASTRING' ),)
1139
+ dt_defs = ((16 , 'float32' , np .float32 , 'ASTRING' ),)
1140
1140
dtr = make_dt_codes (dt_defs )
1141
1141
assert dtr [np .dtype ('f4' ).newbyteorder ('S' )] == 16
1142
1142
assert dtr .value_set () == set ((16 ,))
1143
1143
assert dtr .fields == ('code' , 'label' , 'type' , 'niistring' , 'dtype' ,
1144
1144
'sw_dtype' )
1145
1145
assert dtr .niistring [16 ] == 'ASTRING'
1146
1146
# And that unequal elements raises error
1147
- dt_defs = ((16 , 'float32' , np .float32 , 'ASTRING' ),
1147
+ dt_defs = ((16 , 'float32' , np .float32 , 'ASTRING' ),
1148
1148
(16 , 'float32' , np .float32 ))
1149
1149
with pytest .raises (ValueError ):
1150
1150
make_dt_codes (dt_defs )
1151
1151
# And that 2 or 5 elements raises error
1152
- dt_defs = ((16 , 'float32' ),)
1152
+ dt_defs = ((16 , 'float32' ),)
1153
1153
with pytest .raises (ValueError ):
1154
1154
make_dt_codes (dt_defs )
1155
- dt_defs = ((16 , 'float32' , np .float32 , 'ASTRING' , 'ANOTHERSTRING' ),)
1155
+ dt_defs = ((16 , 'float32' , np .float32 , 'ASTRING' , 'ANOTHERSTRING' ),)
1156
1156
with pytest .raises (ValueError ):
1157
1157
make_dt_codes (dt_defs )
1158
1158
@@ -1185,7 +1185,7 @@ def assert_rt(data,
1185
1185
order = order )
1186
1186
expected = to_write .copy ()
1187
1187
if have_nans and not nan_fill is None :
1188
- expected [nan_positions ]= nan_fill * slope + inter
1188
+ expected [nan_positions ] = nan_fill * slope + inter
1189
1189
assert_array_equal (arr * slope + inter , expected )
1190
1190
assert_array_equal (to_write , backup )
1191
1191
@@ -1214,7 +1214,7 @@ def assert_rt(data,
1214
1214
nan_fill = nan_fill )
1215
1215
# Check defense against in-place modification with nans present
1216
1216
if not nan_fill is None :
1217
- data [1 ]= np .nan
1217
+ data [1 ] = np .nan
1218
1218
assert_rt (data , shape , np .int16 ,
1219
1219
in_cast = in_cast ,
1220
1220
pre_clips = pre_clips ,
@@ -1226,7 +1226,7 @@ def assert_rt(data,
1226
1226
1227
1227
def test_array_from_file_overflow ():
1228
1228
# Test for int overflow in size calculation in array_from_file
1229
- shape = (1500 ,) * 6
1229
+ shape = (1500 ,) * 6
1230
1230
1231
1231
class NoStringIO : # Null file-like for forcing error
1232
1232
@@ -1263,7 +1263,7 @@ def run(self):
1263
1263
with warnings .catch_warnings ():
1264
1264
go .set ()
1265
1265
while not stop .is_set ():
1266
- warnings .filters [:]= []
1266
+ warnings .filters [:] = []
1267
1267
time .sleep (0 )
1268
1268
1269
1269
class CheckScaling (threading .Thread ):
0 commit comments