pynetdesign.modelling.utils.reshape_grid#

pynetdesign.modelling.utils.reshape_grid(grid_array, nx, ny, nz)[source]#

Reshape a flat grid array into a multidimensional array based on the provided grid vectors.

Parameters:
grid_arraynumpy.ndarray

The flat grid array to reshape. The first dimension should match the total number of grid points.

nxnumpy.int

Number of grid points along the x axis.

nynumpy.int

Number of grid points along the y axis.

nznumpy.int

Number of grid points along the z axis.

Returns:
reshaped_arraynumpy.ndarray

The reshaped array with shape (nx, ny, nz, …), where “…” corresponds to the remaining dimensions of the input array.

Raises:
ValueError

If the number of grid points does not match the product of nx, ny, and nz.