pythtb.Mesh.gen_hyper_cube#

static Mesh.gen_hyper_cube(*n_points, start=0.0, stop=1.0, endpoint=False, flat=True)[source]#

Generate a hypercube of points in the specified dimensions.

A hypercube is a generalization of a cube to arbitrary dimensions. Each dimension is orthogonal to the others, and the points are evenly spaced along each dimension. This function generates a grid of points in a hypercube defined by the number of points along each dimension, as well as the start and stop values for each dimension. The points are from start to stop along each dimension, with the option to include or exclude the endpoint.

Parameters:
*n_points: int

Number of points along each dimension.

start: float, list[float], optional

Start value for the mesh grid. May also be a list of start values for each dimension. A single value is broadcasted to all dimensions. Defaults to 0.0.

stop: float, list[float], optional

Stop value for the mesh grid. May also be a list of stop values for each dimension. A single value is broadcasted to all dimensions. Defaults to 1.0.

endpoint: bool, list[bool], optional

If True, includes stop values in the mesh. May also be a list of booleans for each dimension. A single value is broadcasted to all dimensions. Defaults to False.

flat: bool, optional

If True, returns flattened array of points (e.g. of shape (n1*n2*n3 , 3)). If False, returns reshaped array with axes along each dimension (e.g. of shape (n1, n2, n3, 3)). Defaults to True.

Returns:
mesh: np.ndarray

Array of coordinates defining the hypercube.