opatio.lattice.tableLattice module

class opatio.lattice.tableLattice.TableLattice(opat: OPAT)[source]

Bases: object

A class for performing interpolation over a lattice of data points using Delaunay triangulation.

This class is useful for interpolating data stored in an OPAT object, which contains index vectors and associated data cards. It builds a Delaunay triangulation of the index vectors and allows querying for interpolated data cards based on a given query vector.

Parameters:

opat (OPAT) – The OPAT object containing index vectors and associated data cards.

opat

The OPAT object passed during initialization.

Type:

OPAT

opatSize

The size of the OPAT object (dimensions of the data).

Type:

Tuple[int, int]

indexVectors

The list of index vectors from the OPAT object.

Type:

List[FloatVectorIndex]

triangulation

The Delaunay triangulation built from the index vectors.

Type:

scipy.spatial.Delaunay

Examples

>>> from opatio.base.opat import OPAT
>>> from opatio.lattice.tableLattice import TableLattice
>>> opat = OPAT(...)  # Initialize OPAT object
>>> lattice = TableLattice(opat)
>>> query_vector = FloatVectorIndex(...)  # Create a query vector
>>> result_card = lattice.get(query_vector)
>>> print(result_card)
get(query: FloatVectorIndex) DataCard[source]

Interpolate a data card based on a query vector using barycentric weights.

This method finds the simplex containing the query vector, calculates barycentric weights, and interpolates the associated data cards of the simplex vertices to produce a result data card.

Parameters:

query (FloatVectorIndex) – The index vector to query for interpolation.

Returns:

The interpolated data card.

Return type:

DataCard

Raises:
  • ValueError – If the query point is not contained in any simplex.

  • IndexError – If a vertex ID is out of bounds for the index vectors.

Examples

>>> query_vector = FloatVectorIndex(...)  # Create a query vector
>>> result_card = lattice.get(query_vector)
>>> print(result_card)