Skip to content

Commit

Permalink
fix types for numpy int float deprecation
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Chan committed Feb 19, 2024
1 parent 4bb92c9 commit b4753f1
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion horton/io/test/test_iodata.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def test_typecheck():
assert not hasattr(m, 'numbers')
m = IOData(numbers=np.array([2, 3]), coordinates=np.array([[1, 2, 3], [2, 3, 1]]))
m = IOData(numbers=np.array([2.0, 3.0]), pseudo_numbers=np.array([1, 1]), coordinates=np.array([[1, 2, 3], [2, 3, 1]]))
assert np.issubdtype(m.numbers.dtype, np.int)
assert np.issubdtype(m.numbers.dtype, np.int64)
assert np.issubdtype(m.pseudo_numbers.dtype, np.floating)
assert hasattr(m, 'numbers')
del m.numbers
Expand Down
2 changes: 1 addition & 1 deletion horton/meanfield/orbitals.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ def swap_orbitals(self, swaps):
The attributes ``energies`` and ``occupations`` are also reordered.
"""
if not (swaps.shape[1] == 2 and swaps.ndim == 2 and np.issubdtype(swaps.dtype, np.int)):
if not (swaps.shape[1] == 2 and swaps.ndim == 2 and np.issubdtype(swaps.dtype, np.int64)):
raise TypeError('The argument swaps has the wrong shape/type.')
for iswap in range(len(swaps)):
index0, index1 = swaps[iswap]
Expand Down
2 changes: 1 addition & 1 deletion horton/test/test_moments.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def test_get_ncart_cumul():
def test_get_cartesian_powers():
lmax = 4
cartesian_powers = get_cartesian_powers(lmax)
assert np.issubdtype(cartesian_powers.dtype, np.int)
assert np.issubdtype(cartesian_powers.dtype, np.int64)
assert cartesian_powers.shape == (get_ncart_cumul(lmax), 3)
assert (cartesian_powers[0] == [0, 0, 0]).all()
assert (cartesian_powers[1] == [1, 0, 0]).all()
Expand Down
2 changes: 1 addition & 1 deletion horton/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def typecheck_geo(coordinates=None, numbers=None, pseudo_numbers=None,
if need_coordinates:
raise TypeError('Coordinates can not be None.')
else:
if coordinates.shape != (natom, 3) or not np.issubdtype(coordinates.dtype, np.float):
if coordinates.shape != (natom, 3) or not np.issubdtype(coordinates.dtype, np.float64):
raise TypeError('The argument centers must be a float array with shape (natom,3).')

# Typecheck numbers
Expand Down

0 comments on commit b4753f1

Please sign in to comment.