File tree Expand file tree Collapse file tree 2 files changed +6
-8
lines changed Expand file tree Collapse file tree 2 files changed +6
-8
lines changed Original file line number Diff line number Diff line change 84
84
85
85
from .volumeutils import (native_code , swapped_code , make_dt_codes ,
86
86
calculate_scale , allopen , shape_zoom_affine ,
87
- array_to_file , array_from_file , can_cast ,
88
- floating_point_types )
87
+ array_to_file , array_from_file , can_cast )
89
88
from .wrapstruct import WrapStruct
90
89
from .spatialimages import (HeaderDataError , HeaderTypeError ,
91
90
SpatialImage )
@@ -489,7 +488,7 @@ def data_from_fileobj(self, fileobj):
489
488
# in-place multiplication and addition on integer types leads to
490
489
# integer output types, and disastrous integer rounding.
491
490
# We'd like to do inplace if we can, to save memory
492
- is_flt = data .dtype .type in floating_point_types
491
+ is_flt = data .dtype .kind in 'fc'
493
492
if slope != 1.0 :
494
493
if is_flt :
495
494
data *= slope
Original file line number Diff line number Diff line change 31
31
default_compresslevel = 1
32
32
33
33
#: convenience variables for numpy types
34
- floating_point_types = (np .sctypes ['complex' ] +
35
- np .sctypes ['float' ])
36
- integer_types = (np .sctypes ['int' ] + np .sctypes ['uint' ])
37
- numeric_types = floating_point_types + integer_types
34
+ CFLOAT_TYPES = np .sctypes ['complex' ] + np .sctypes ['float' ]
35
+ IUINT_TYPES = np .sctypes ['int' ] + np .sctypes ['uint' ]
36
+ NUMERIC_TYPES = CFLOAT_TYPES + IUINT_TYPES
38
37
39
38
40
39
class Recoder (object ):
@@ -799,7 +798,7 @@ def finite_range(arr):
799
798
stride_order = np .argsort (arr .strides )[::- 1 ]
800
799
sarr = arr .transpose (stride_order )
801
800
typ = sarr .dtype .type
802
- if typ in integer_types :
801
+ if typ in IUINT_TYPES :
803
802
return np .min (sarr ), np .max (sarr )
804
803
if typ not in np .sctypes ['float' ]:
805
804
raise TypeError ('Can only handle floats and (u)ints' )
You can’t perform that action at this time.
0 commit comments