Skip to content

Commit

Permalink
Merge d869818 into d1a6f95
Browse files Browse the repository at this point in the history
  • Loading branch information
matthew-brett committed Feb 23, 2021
2 parents d1a6f95 + d869818 commit 349eaea
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion examples/interfaces/process_ds105.py
Expand Up @@ -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'),
Expand Down
2 changes: 1 addition & 1 deletion examples/interfaces/process_fiac.py
Expand Up @@ -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'),
Expand Down
3 changes: 2 additions & 1 deletion nipy/core/reference/coordinate_map.py
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion nipy/core/reference/coordinate_system.py
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion nipy/core/reference/tests/test_coordinate_map.py
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions nipy/core/reference/tests/test_coordinate_system.py
Expand Up @@ -56,15 +56,15 @@ 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
dtype = np.dtype([('field1', '<f8'), ('field2', '<i4')])
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)
Expand Down

0 comments on commit 349eaea

Please sign in to comment.