magnet.generate.voronoi_tess#
- magnet.generate.voronoi_tess(output_path: str, bounds: tuple[int, int] = (50, 1000))#
Generate a Voronoi mesh.
Generates a Voronoi mesh in the unit square. The number of seed points and their positions are selected randomly.
- Parameters:
output_path (str) – File path where the mesh will be saved.
bounds (tuple[int, int], optional) – Bounds of the uniform distribution from which the number of seeds is sampled (default is (50, 1000)).
- Returns:
adjacency (sparse.csr_matrix of np.uint8) – Adjacency matrix describing the mesh.
centroids (np.ndarray of float) – Centroid coordinates of each cell of the mesh.
areas (np.ndarray of float) – Areas of the cells.
Notes
The mesh is not the entire unit square but is roughly contained in it, since it is obtained by removing any cell whose centroid lies outside the unit square.