Skip to content

Latest commit

 

History

History
79 lines (52 loc) · 2.25 KB

README.rst

File metadata and controls

79 lines (52 loc) · 2.25 KB

interpax

License DOI GitHub issues Pypi

Documentation UnitTests Coverage

interpax is a library for interpolation and function approximation using JAX.

Includes methods for nearest neighbor, linear, and several cubic interpolation schemes in 1d, 2d, and 3d, as well as Fourier interpolation for periodic functions in 1d and 2d.

Coming soon: - Spline interpolation for rectilinear grids in N-dimensions - RBF interpolation for unstructured data in N-dimensions - Smoothing splines for noisy data

Installation

interpax is installable with pip:

pip install interpax

Usage

import jax.numpy as jnp
import numpy as np
from interpax import interp1d

xp = jnp.linspace(0, 2 * np.pi, 100)
xq = jnp.linspace(0, 2 * np.pi, 10000)
f = lambda x: jnp.sin(x)
fp = f(xp)

fq = interp1d(xq, xp, fp, method="cubic")
np.testing.assert_allclose(fq, f(xq), rtol=1e-6, atol=1e-5)

For full details of various options see the API documentation