diff --git a/examples/interfaces/process_ds105.py b/examples/interfaces/process_ds105.py index fa6988450f..74e5f0c567 100755 --- a/examples/interfaces/process_ds105.py +++ b/examples/interfaces/process_ds105.py @@ -204,7 +204,7 @@ def coregister(self, in_prefix=''): return in_prefix def seg_norm(self, in_prefix=''): - def_tpms = np.zeros((3,1), dtype=np.object) + def_tpms = np.zeros((3,1), dtype=object) spm_path = spm_info.spm_path def_tpms[0] = pjoin(spm_path, 'tpm', 'grey.nii'), def_tpms[1] = pjoin(spm_path, 'tpm', 'white.nii'), diff --git a/examples/interfaces/process_fiac.py b/examples/interfaces/process_fiac.py index d6a646224c..95bef29db8 100755 --- a/examples/interfaces/process_fiac.py +++ b/examples/interfaces/process_fiac.py @@ -99,7 +99,7 @@ def coregister(data_def): def segnorm(data_def): - def_tpms = np.zeros((3,1), dtype=np.object) + def_tpms = np.zeros((3,1), dtype=object) spm_path = spm_info.spm_path def_tpms[0] = pjoin(spm_path, 'tpm', 'grey.nii'), def_tpms[1] = pjoin(spm_path, 'tpm', 'white.nii'), diff --git a/nipy/core/reference/coordinate_map.py b/nipy/core/reference/coordinate_map.py index 0a7fb8e110..a1f0c54649 100644 --- a/nipy/core/reference/coordinate_map.py +++ b/nipy/core/reference/coordinate_map.py @@ -649,7 +649,8 @@ def inverse(self, preserve_dtype=False): sym_inv = Matrix(self.affine).inv() m_inv = matrix2numpy(sym_inv).astype(aff_dt) else: # linalg inverse succeeded - if preserve_dtype and aff_dt != np.object: # can we cast back? + # Do we need a specific dtype? Can we cast to this dtype? + if preserve_dtype and aff_dt != np.object_: m_inv_orig = m_inv m_inv = m_inv.astype(aff_dt) if not np.allclose(m_inv_orig, m_inv): diff --git a/nipy/core/reference/coordinate_system.py b/nipy/core/reference/coordinate_system.py index 0dfb04c3a7..320d1dce56 100644 --- a/nipy/core/reference/coordinate_system.py +++ b/nipy/core/reference/coordinate_system.py @@ -117,7 +117,7 @@ def __init__(self, coord_names, name='', coord_dtype=np.float): raise ValueError('coord_names must have distinct names') # verify that the dtype is coord_dtype for sanity sctypes = (np.sctypes['int'] + np.sctypes['float'] + - np.sctypes['complex'] + np.sctypes['uint'] + [np.object]) + np.sctypes['complex'] + np.sctypes['uint'] + [object]) coord_dtype = np.dtype(coord_dtype) if coord_dtype not in sctypes: raise ValueError('Coordinate dtype should be one of %s' % sctypes) diff --git a/nipy/core/reference/tests/test_coordinate_map.py b/nipy/core/reference/tests/test_coordinate_map.py index 2742f35fb9..3456710134 100644 --- a/nipy/core/reference/tests/test_coordinate_map.py +++ b/nipy/core/reference/tests/test_coordinate_map.py @@ -30,7 +30,7 @@ # Dtypes for testing coordinate map creation / processing _SYMPY_SAFE_DTYPES = (np.sctypes['int'] + np.sctypes['uint'] + np.sctypes['float'] + np.sctypes['complex'] + - [np.object]) + [object]) # Sympy <= 1.1 does not handle numpy longcomplex correctly. See: # https://github.com/sympy/sympy/pull/12901 if np.longcomplex in _SYMPY_SAFE_DTYPES: # Not present for Windows diff --git a/nipy/core/reference/tests/test_coordinate_system.py b/nipy/core/reference/tests/test_coordinate_system.py index d64932f5b2..d4e8d449f4 100644 --- a/nipy/core/reference/tests/test_coordinate_system.py +++ b/nipy/core/reference/tests/test_coordinate_system.py @@ -56,7 +56,7 @@ def test_unique_coord_names(): def test_dtypes(): # invalid dtypes dtypes = np.sctypes['others'] - dtypes.remove(np.object) + dtypes.remove(object) for dt in dtypes: assert_raises(ValueError, CoordinateSystem, 'ijk', 'test', dt) # compound dtype @@ -64,7 +64,7 @@ def test_dtypes(): assert_raises(ValueError, CoordinateSystem, 'ijk', 'test', dtype) # valid dtypes dtypes = (np.sctypes['int'] + np.sctypes['float'] + np.sctypes['complex'] + - [np.object]) + [object]) for dt in dtypes: cs = CoordinateSystem('ij', coord_dtype=dt) assert_equal(cs.coord_dtype, dt)