Skip to main content

Interpolation and function approximation with JAX

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

interpax-0.3.1.tar.gz (55.9 kB view hashes)

Uploaded Source

Built Distribution

interpax-0.3.1-py3-none-any.whl (26.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page