|
33 | 33 | #: default compression level when writing gz and bz2 files
|
34 | 34 | default_compresslevel = 1
|
35 | 35 |
|
36 |
| -#: convenience variables for numpy types |
37 |
| -FLOAT_TYPES = np.sctypes['float'] |
38 |
| -CFLOAT_TYPES = np.sctypes['complex'] + FLOAT_TYPES |
39 |
| -IUINT_TYPES = np.sctypes['int'] + np.sctypes['uint'] |
40 |
| -NUMERIC_TYPES = CFLOAT_TYPES + IUINT_TYPES |
41 |
| - |
42 | 36 |
|
43 | 37 | class Recoder(object):
|
44 | 38 | ''' class to return canonical code(s) from code or aliases
|
@@ -618,7 +612,7 @@ def array_to_file(data, fileobj, out_dtype=None, offset=0,
|
618 | 612 | dt_mnmx = _dt_min_max(in_dtype, mn, mx)
|
619 | 613 | # Check what working type we need to cover range
|
620 | 614 | w_type = working_type(in_dtype, slope, inter)
|
621 |
| - assert w_type in FLOAT_TYPES |
| 615 | + assert w_type in np.sctypes['float'] |
622 | 616 | w_type = best_write_scale_ftype(np.array(dt_mnmx, dtype=in_dtype),
|
623 | 617 | slope, inter, w_type)
|
624 | 618 | slope = slope.astype(w_type)
|
@@ -1237,10 +1231,10 @@ def finite_range(arr):
|
1237 | 1231 | # Resort array to slowest->fastest memory change indices
|
1238 | 1232 | stride_order = np.argsort(arr.strides)[::-1]
|
1239 | 1233 | sarr = arr.transpose(stride_order)
|
1240 |
| - typ = sarr.dtype.type |
1241 |
| - if typ in IUINT_TYPES: |
| 1234 | + kind = sarr.dtype.kind |
| 1235 | + if kind in 'iu': |
1242 | 1236 | return np.min(sarr), np.max(sarr)
|
1243 |
| - if typ not in np.sctypes['float']: |
| 1237 | + if kind != 'f': |
1244 | 1238 | raise TypeError('Can only handle floats and (u)ints')
|
1245 | 1239 | # Deal with 1D arrays in loop below
|
1246 | 1240 | sarr = np.atleast_2d(sarr)
|
|
0 commit comments