pyinterp.univariate

Contents

pyinterp.univariate#

pyinterp.univariate(grid: GridHolder, x: NDArray1DNumeric, method: Univariate) NDArray1DFloat32 | NDArray1DFloat64[source]#
pyinterp.univariate(grid: GridHolder, x: NDArray1DNumeric, method: Literal['akima', 'akima_periodic', 'bicubic', 'bilinear', 'c_spline', 'c_spline_not_a_knot', 'c_spline_periodic', 'linear', 'polynomial', 'steffen'] = 'linear', *, bounds_error: bool = False, num_threads: int = 0, half_window_size: int | None = None, boundary_mode: Literal['shrink', 'undef'] | None = None) NDArray1DFloat32 | NDArray1DFloat64

Univariate interpolation.

Parameters:
  • grid (GridHolder) – The 1D grid to interpolate from

  • x (NDArray1DNumeric) – X coordinates at which to interpolate

  • method (windowed.Univariate | WindowedMethods) – Interpolation method (config object or string)

  • bounds_error (bool) – If True, raise error for out-of-bounds coordinates

  • num_threads (int) – Number of threads to use (0 = auto)

  • half_window_size (int | None) – Half window size for the interpolation

  • boundary_mode (BoundaryMode | None) – Boundary handling mode

Returns:

Interpolated values

Return type:

NDArray1DFloat32 | NDArray1DFloat64

Examples

Simple usage:

>>> result = univariate(grid, x, "linear")
>>> result = univariate(grid, x, "c_spline", window_size=10)

Advanced usage with config objects:

>>> from pyinterp.core.config import windowed
>>> config = windowed.Univariate.c_spline().with_half_window_size(10)
>>> result = univariate(grid, x, config)