paralleldomain.utilities.mask

lookup_values(mask, x, y, interpolate=False)

Executes bilinear interpolation on a 2D plane.

Parameters
  • mask (numpy.ndarray) – Array of shape (M x N [x L]). Note: If 3 dimensions are provided, bilinear interpolation is performed on each 2D plane in the first two dimensions.

  • x (Union[numpy.ndarray, List]) – List of indices to interpolate on along the x-axis (columns). Indices < 0 and > (M-1, N-1) will be clipped to 0 or (M-1, N-1), respectively.

  • y (Union[numpy.ndarray, List]) – List of indices to interpolate on along the y-axis (rows). Indices < 0 and > (M-1, N-1) will be clipped to 0 or (M-1, N-1), respectively.

  • interpolate (bool) –

Returns

Returns interpolated values for input (x,y) as array with shape (len(x) [x L]).

Return type

ndarray