Table

class pathsim.blocks.table.LUT(points=None, values=None)[source]

Bases: Function

N-dimensional lookup table with linear interpolation functionality.

This class implements a multi-dimensional lookup table that uses scipy’s LinearNDInterpolator [#scipy]_ for piecewise linear interpolation in N-dimensional space. The interpolation is based on Delaunay triangulation of the input points, providing smooth linear interpolation between data points. For points outside the convex hull of the input data, the interpolator returns NaN values.

The LUT acts as a Function block.

References

Parameters:
  • points (array_like of shape (n, ndim)) – 2-D array of data point coordinates where n is the number of points and ndim is the dimensionality of the space. Each row represents a single data point in ndim-dimensional space.

  • values (array_like of shape (n,) or (n, m)) – N-D array of data values at the corresponding points. If 1-D, represents scalar values at each point. If 2-D, each column represents a different output dimension (m output values per input point).

points

Stored array of input point coordinates.

Type:

ndarray

values

Stored array of output values at each point.

Type:

ndarray

inter

The scipy linear interpolator object used for interpolation.

Type:

scipy.interpolate.LinearNDInterpolator

class pathsim.blocks.table.LUT1D(points=None, values=None, fill_value='extrapolate')[source]

Bases: Function

One-dimensional lookup table with linear interpolation functionality.

This class implements a 1-dimensional lookup table that uses scipy’s interp1d [#scipy]_ for piecewise linear interpolation along a single axis. The interpolation provides linear interpolation between adjacent data points and supports extrapolation beyond the input data range using the ‘extrapolate’ fill mode.

The LUT1D acts as a Function block.

References

Parameters:
  • points (array_like of shape (n,)) – 1-D array of monotonically increasing data point coordinates where n is the number of points. These represent the independent variable values at which the dependent values are known.

  • values (array_like of shape (n,) or (n, m)) – 1-D or 2-D array of data values at the corresponding points. If 1-D, represents scalar values at each point. If 2-D with shape (n, m), each column represents a different output dimension, allowing the lookup table to return m-dimensional vectors.

  • fill_value (float or str, optional) – The value to use for points outside the interpolation range. If “extrapolate”, the interpolator will use linear extrapolation. Default is “extrapolate”. See https://docs.scipy.org/doc/scipy-1.16.1/reference/generated/scipy.interpolate.interp1d.html for more details

points

Flattened array of input point coordinates, stored as 1-D array.

Type:

ndarray

values

Stored array of output values at each point, preserving original shape.

Type:

ndarray

inter

The scipy 1D interpolator object used for linear interpolation with extrapolation enabled beyond the data range.

Type:

scipy.interpolate.interp1d