enable numpy 2.0 and recent scipy

This commit is contained in:
Jan Petykiewicz 2024-07-29 02:25:16 -07:00
parent 739e96df3d
commit 36431cd0e4
4 changed files with 7 additions and 7 deletions

View File

@ -155,7 +155,7 @@ def generate_kmn(
All are given in the xyz basis (e.g. `|k|[0,0,0] = norm(G_matrix @ k0)`). All are given in the xyz basis (e.g. `|k|[0,0,0] = norm(G_matrix @ k0)`).
""" """
k0 = numpy.array(k0) k0 = numpy.array(k0)
G_matrix = numpy.array(G_matrix, copy=False) G_matrix = numpy.asarray(G_matrix)
Gi_grids = numpy.array(numpy.meshgrid(*(fftfreq(n, 1 / n) for n in shape[:3]), indexing='ij')) Gi_grids = numpy.array(numpy.meshgrid(*(fftfreq(n, 1 / n) for n in shape[:3]), indexing='ij'))
Gi = numpy.moveaxis(Gi_grids, 0, -1) Gi = numpy.moveaxis(Gi_grids, 0, -1)
@ -538,7 +538,7 @@ def eigsolve(
`(eigenvalues, eigenvectors)` where `eigenvalues[i]` corresponds to the `(eigenvalues, eigenvectors)` where `eigenvalues[i]` corresponds to the
vector `eigenvectors[i, :]` vector `eigenvectors[i, :]`
""" """
k0 = numpy.array(k0, copy=False) k0 = numpy.asarray(k0)
h_size = 2 * epsilon[0].size h_size = 2 * epsilon[0].size
@ -566,7 +566,7 @@ def eigsolve(
if y0 is None: if y0 is None:
Z = rng.random(y_shape) + 1j * rng.random(y_shape) Z = rng.random(y_shape) + 1j * rng.random(y_shape)
else: else:
Z = numpy.array(y0, copy=False).T Z = numpy.asarray(y0).T
while True: while True:
Z *= num_modes / norm(Z) Z *= num_modes / norm(Z)

View File

@ -145,7 +145,7 @@ def sim(
omega=omega, omega=omega,
dxes=dxes, dxes=dxes,
epsilon=eps_vec, epsilon=eps_vec,
matrix_solver_opts={'atol': 1e-15, 'tol': 1e-11}, matrix_solver_opts={'atol': 1e-15, 'rtol': 1e-11},
) )
e = unvec(e_vec, shape[1:]) e = unvec(e_vec, shape[1:])

View File

@ -162,7 +162,7 @@ def sim(
omega=omega, omega=omega,
dxes=dxes, dxes=dxes,
epsilon=eps_vec, epsilon=eps_vec,
matrix_solver_opts={'atol': 1e-15, 'tol': 1e-11}, matrix_solver_opts={'atol': 1e-15, 'rtol': 1e-11},
) )
e = unvec(e_vec, shape[1:]) e = unvec(e_vec, shape[1:])

View File

@ -39,8 +39,8 @@ include = [
] ]
dynamic = ["version"] dynamic = ["version"]
dependencies = [ dependencies = [
"numpy~=1.26", "numpy>=1.26",
"scipy", "scipy~=1.14",
] ]