Grid.moments(..., type_mom="cartesian") raises on a grid whose points have shape (N, 1):
import numpy as np
from grid.basegrid import Grid
pts = np.linspace(-1, 1, 5)[:, None]
grid = Grid(pts, np.full(5, 0.4))
grid.moments(2, np.array([[0.0]]), pts[:, 0] ** 2, "cartesian")
# AttributeError: module 'numpy' has no attribute 'int'.
The dim == 1 branch of generate_orders_horton_order returns np.arange(0, order + 1, dtype=np.int), and np.int was removed in NumPy 1.24. Even with a valid dtype, it returns every order from 0 to n, not the single row [n] that the 2D and 3D branches return, so the np.vstack in Grid.moments can't stack the rows.
I'd like to fix this by returning [[order]] for dim=1, with tests for both the function and a 1D Grid.moments call. I have a small patch ready.
Grid.moments(..., type_mom="cartesian")raises on a grid whose points have shape(N, 1):The
dim == 1branch ofgenerate_orders_horton_orderreturnsnp.arange(0, order + 1, dtype=np.int), andnp.intwas removed in NumPy 1.24. Even with a valid dtype, it returns every order from 0 to n, not the single row[n]that the 2D and 3D branches return, so thenp.vstackinGrid.momentscan't stack the rows.I'd like to fix this by returning
[[order]]fordim=1, with tests for both the function and a 1DGrid.momentscall. I have a small patch ready.