Embedding Grid

Grid embeddings are utility classes to ease the manipulation of point coordinates in the d-dimensional integer grid. An embedding has a shape (height and width in 2 dimensions).

For a given dimension \(N\in\{1,2,3,4,5\}\), there is a specific grid embedding class called EmbeddingGridNd. All the specific grid embedding classes implement the same interface.

class EmbeddingGrid2d
__init__(self: higra.higram.EmbeddingGrid2d, shape: numpy.ndarray[numpy.int64]) → None

Create a new grid embedding. Shape must be a 1d array with striclty positive values.

contains(*args, **kwargs)

Overloaded function.

  1. contains(self: higra.higram.EmbeddingGrid2d, coordinates: List[int]) -> bool

Takes a list or tuple representing the coordinates of a point and returns true if the point is contained in the embedding.

  1. contains(self: higra.higram.EmbeddingGrid2d, points: numpy.ndarray[numpy.int8]) -> numpy.ndarray[bool]

Takes a n1 x n2 x … nk array, with nk = self.dimension(), and returns a boolean array of dimension n1 x n2 x … n(k-1) indicating if each point is contained in the embedding.

  1. contains(self: higra.higram.EmbeddingGrid2d, points: numpy.ndarray[numpy.int16]) -> numpy.ndarray[bool]

  2. contains(self: higra.higram.EmbeddingGrid2d, points: numpy.ndarray[numpy.int32]) -> numpy.ndarray[bool]

  3. contains(self: higra.higram.EmbeddingGrid2d, points: numpy.ndarray[numpy.int64]) -> numpy.ndarray[bool]

dimension(self: higra.higram.EmbeddingGrid2d) → int

Get the dimension of the embedding (aka self.shape().size()).

grid2lin(*args, **kwargs)

Overloaded function.

  1. grid2lin(self: higra.higram.EmbeddingGrid2d, coordinates: List[int]) -> int

Compute the linear coordinate of a point given its nd coordinates.

  1. grid2lin(self: higra.higram.EmbeddingGrid2d, points: numpy.ndarray[numpy.int8]) -> numpy.ndarray[numpy.uint64]

Takes a n1 x n2 x … nk array, with nk = self.dimension(), and returns a uint64 array of dimension n1 x n2 x … n(k-1) giving the linear coordinate of each point.

  1. grid2lin(self: higra.higram.EmbeddingGrid2d, points: numpy.ndarray[numpy.int16]) -> numpy.ndarray[numpy.uint64]

  2. grid2lin(self: higra.higram.EmbeddingGrid2d, points: numpy.ndarray[numpy.int32]) -> numpy.ndarray[numpy.uint64]

  3. grid2lin(self: higra.higram.EmbeddingGrid2d, points: numpy.ndarray[numpy.int64]) -> numpy.ndarray[numpy.uint64]

lin2grid(*args, **kwargs)

Overloaded function.

  1. lin2grid(self: higra.higram.EmbeddingGrid2d, index: int) -> numpy.ndarray[numpy.int64]

Compute the nd coordinates of a point given its linear coordinate.

  1. lin2grid(self: higra.higram.EmbeddingGrid2d, points: numpy.ndarray[numpy.int8]) -> numpy.ndarray[numpy.int64]

Takes a n1 x n2 x … nk array, and returns an array of dimension n1 x n2 x … nk x self.dimension() where each value, seen as the linear coordinates of a point, has been replaced by the corresponding nd coordinates.

  1. lin2grid(self: higra.higram.EmbeddingGrid2d, points: numpy.ndarray[numpy.int16]) -> numpy.ndarray[numpy.int64]

  2. lin2grid(self: higra.higram.EmbeddingGrid2d, points: numpy.ndarray[numpy.int32]) -> numpy.ndarray[numpy.int64]

  3. lin2grid(self: higra.higram.EmbeddingGrid2d, points: numpy.ndarray[numpy.int64]) -> numpy.ndarray[numpy.int64]

shape(self: higra.higram.EmbeddingGrid2d) → numpy.ndarray[numpy.int64]

Get the shape/dimensions of the grid embedding

size(self: higra.higram.EmbeddingGrid2d) → int

Get the total number of points contained in the embedding.