Interpolations

Fast, continuous interpolation of discrete datasets in Julia

https://github.com/juliamath/interpolations.jl

Science Score: 54.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    12 of 94 committers (12.8%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.8%) to scientific vocabulary

Keywords

grid interpolation julia splines

Keywords from Contributors

graphics flux optim the-human-brain sciml julialang unconstrained-optimization unconstrained-optimisation optimisation differential-equations
Last synced: 6 months ago · JSON representation ·

Repository

Fast, continuous interpolation of discrete datasets in Julia

Basic Info
Statistics
  • Stars: 558
  • Watchers: 38
  • Forks: 112
  • Open Issues: 110
  • Releases: 0
Topics
grid interpolation julia splines
Created over 11 years ago · Last pushed 6 months ago
Metadata Files
Readme Changelog License Citation

README.md

Interpolations.jl

version pkgeval Build Status deps Stable Latest

This package implements a variety of interpolation schemes for the Julia language. It has the goals of ease-of-use, broad algorithmic support, and exceptional performance.

Currently this package supports B-splines and also irregular grids. The API has been designed with intent to support more options. Initial support for Lanczos interpolation was recently added. Pull-requests are more than welcome! It should be noted that the API may continue to evolve over time.

At the bottom of this page, you can find a "performance shootout" among these methods (as well as SciPy's RegularGridInterpolator).

Installation

Interpolations.jl can be installed via the following invocation since it is a registered Julia package.

julia using Pkg Pkg.add("Interpolations")

Example Usage

Create a grid xs and an array A of values to be interpolated julia xs = 1:0.2:5 A = log.(xs) Create linear interpolation object without extrapolation julia interp_linear = linear_interpolation(xs, A) interp_linear(3) # exactly log(3) interp_linear(3.1) # approximately log(3.1) interp_linear(0.9) # outside grid: error Create linear interpolation object with extrapolation julia interp_linear_extrap = linear_interpolation(xs, A,extrapolation_bc=Line()) interp_linear_extrap(0.9) # outside grid: linear extrapolation

Other Examples

More examples, such as plotting and cubic interpolation, can be found at the convenience constructions documentation.

interpolation plot example

Other Interpolation Packages

Other interpolation packages for Julia include:

  • ApproXD.jl implements B-spline and linear interpolation in Julia.
  • BarycentricInterpolation.jl implements the Barycentric formula for polynomial interpolation on equispaced points and Chebyshev points of the first and second kind.
  • BasicInterpolators.jl provides a collection of common interpolation recipes for basic applications.
  • BSplineKit.jl offers tools for B-spline based Galerkin and collocation methods, including for interpolation and approximation.
  • Curves.jl supports log-interpolation via immutable Curve objects.
  • DataInterpolations.jl is a library for performing interpolations of one-dimensional data.
  • Dierckx.jl is a wrapper for the dierckx Fortran library, which also underlies scipy.interpolate.
  • DIVAnd.jl for N-dimensional smoothing interpolation.
  • FastChebInterp.jl does fast multidimensional Chebyshev interpolation on a hypercube using separable grid of interpolation points.
  • FEMBasis.jl contains interpolation routines for standard finite element function spaces.
  • FineShift.jl does fast sub-sample shifting of multidimensional arrays.
  • FourierTools.jl includes sinc interpolation for up and down sampling.
  • GeoStats.jl provides interpolation and simulation methods over complex 2D and 3D meshes.
  • GridInterpolations.jl performs multivariate interpolation on a rectilinear grid.
  • InterpolationKernels.jl provides a library of interpolation kernels.
  • KernelInterpolation.jl implements scattered data interpolations in arbitrary dimensions by radial basis functions with support for solving linear partial differential equations.
  • KissSmoothing.jl implements denoising and a Radial Basis Function estimation procedure.
  • LinearInterpolations.jl allows for interpolation using weighted averages allowing probability distributions, rotations, and other Lie groups to be interpolated.
  • LinearInterpolators.jl provides linear interpolation methods for Julia based on InterpolationKernels.jl, above.
  • LocalFunctionApproximation.jl provides local function approximators that interpolates a scalar-valued function across a vector space.
  • NaturalNeighbours.jl provides natural neighbour interpolation methods for scattered two-dimensional point sets, with support for derivative generation.
  • PCHIPInterpolation.jl for monotonic interpolation.
  • PiecewiseLinearApprox.jl performs piecewise linear interpolation over an arbitrary number of dimensions.
  • ScatteredInterpolation.jl interpolates scattered data in arbitrary dimensions.

Some of these packages support methods that Interpolations does not, so if you can't find what you need here, check one of them or submit a pull request here.

If you would like to list a registered package that is related to interpolation, please create a Github issue.

Performance shootout

In the perf directory, you can find a script that tests interpolation with several different packages. We consider interpolation in 1, 2, 3, and 4 dimensions, with orders 0 (Constant), 1 (Linear), and 2 (Quadratic). Methods include Interpolations BSpline (IBSpline) and Gridded (IGridded), methods from the Grid.jl package, methods from the Dierckx.jl package, methods from the GridInterpolations.jl package (GI), methods from the ApproXD.jl package, and methods from SciPy's RegularGridInterpolator accessed via PyCall (Py). All methods are tested using an Array with approximately 10^6 elements, and the interpolation task is simply to visit each grid point.

First, let's look at the two B-spline algorithms, IBspline and Grid. Here's a plot of the "construction time," the amount of time it takes to initialize an interpolation object (smaller is better):

construction

The construction time is negligible until you get to second order (quadratic); that's because quadratic is the lowest order requiring the solution of tridiagonal systems upon construction. The solvers used by Interpolations are much faster than the approach taken in Grid.

Now let's examine the interpolation performance. Here we'll measure "throughput", the number of interpolations performed per second (larger is better):

throughput

Once again, Interpolations wins on every test, by a factor that ranges from 7 to 13.

Now let's look at the "gridded" methods that allow irregular spacing along each axis. For some of these, we compare interpolation performance in both "vectorized" form itp[xvector, yvector] and in "scalar" form for y in yvector, x in xvector; val = itp[x,y]; end.

First, construction time (smaller is better):

construction

Missing dots indicate cases that were not tested, or not supported by the package. (For construction, differences between "vec" and "scalar" are just noise, since no interpolation is performed during construction.) The only package that takes appreciable construction time is Dierckx.

And here's "throughput" (larger is better). To ensure we can see the wide range of scales, here we use "square-root" scaling of the y-axis:

throughput

For 1d, the "Dierckx scalar" and "GI" tests were interrupted because they ran more than 20 seconds (far longer than any other test). Both performed much better in 2d, interestingly. You can see that Interpolations wins in every case, sometimes by a very large margin.

Development Status

This package is being maintained but not actively developed. Maintenance is focused on fixing bugs and issues with the current code base. New features are welcome via pull requests and will be reviewed and released in a timely fashion.

If you would like to become involved in maintenance or active development of the package please feel free to get in touch via a Github issue.

This package follows semantic version in that documented features should not break without changing the minor version.

See the news for details on how to update between breaking releases, indicated by changes in minor versions.

Contributing

Work is very much in progress, but help is always welcome. There is some developer documentation that may help you understand how things work internally.

Contributions in any form are appreciated, but the best pull requests come with tests!

Owner

  • Name: Julia Math
  • Login: JuliaMath
  • Kind: organization

Mathematics made easy in Julia

Citation (CITATION.cff)

# This CITATION.cff file was generated with cffinit.
# Visit https://bit.ly/cffinit to generate yours today!

cff-version: 1.2.0
title: Interpolations.jl
message: 'If you use this software, please cite it as below.'
type: software
authors:
  - family-names: Kittisopikul
    given-names: Mark
    orcid: 'https://orcid.org/0000-0002-9558-6248'
  - family-names: Holy
    given-names: Timothy E.
    orcid: 'https://orcid.org/0000-0002-2429-1071'
  - family-names: Aschan
    given-names: Tomas
identifiers:
  - type: doi
    value: 10.5281/zenodo.593143
    description: DOI for all versions of Interpolations.jl
repository-code: 'https://github.com/JuliaMath/Interpolations.jl'
url: 'https://juliamath.github.io/Interpolations.jl/stable/'
abstract: >-
  Fast, continuous interpolation of discrete datasets in
  Julia
keywords:
  - interpolation
  - julia
  - splines
license: MIT
version: 0.16.0
date-released: '2025-05-14'

GitHub Events

Total
  • Create event: 5
  • Commit comment event: 5
  • Release event: 3
  • Issues event: 19
  • Watch event: 30
  • Delete event: 10
  • Issue comment event: 87
  • Push event: 47
  • Pull request review comment event: 2
  • Pull request review event: 9
  • Pull request event: 36
  • Fork event: 6
Last Year
  • Create event: 5
  • Commit comment event: 5
  • Release event: 3
  • Issues event: 19
  • Watch event: 30
  • Delete event: 10
  • Issue comment event: 87
  • Push event: 47
  • Pull request review comment event: 2
  • Pull request review event: 9
  • Pull request event: 36
  • Fork event: 6

Committers

Last synced: 10 months ago

All Time
  • Total Commits: 664
  • Total Committers: 94
  • Avg Commits per committer: 7.064
  • Development Distribution Score (DDS): 0.777
Past Year
  • Commits: 10
  • Committers: 6
  • Avg Commits per committer: 1.667
  • Development Distribution Score (DDS): 0.7
Top Committers
Name Email Commits
Tim Holy t****y@g****m 148
Tomas Lycken t****n@g****m 130
Mark Kittisopikul m****i 64
Alexius Wadell a****l@g****m 32
Tomas Lycken t****n@j****m 23
N5N3 2****6@q****m 16
Miles Lucas m****s@h****u 15
Spencer Lyon s****2@g****m 13
Tomas Lycken t****n 13
Robin Deits r****s@g****m 12
github-actions[bot] 4****] 11
SomTambe t****m@g****m 11
Jae-Mo Lihm j****6@g****m 9
Jan Weidner j****6@g****m 9
Eirik Eylands Brandås 3****s 8
Paresh Mathur p****7@g****m 8
Carlo Baldassi c****i@g****m 7
dependabot[bot] 4****] 7
Christof Stocker s****f@g****m 6
Abhro R 5****o 6
ohmsweetohm1 5****1 5
Mateusz Baran m****9@g****m 5
getzze g****e@g****m 4
marius m****a@u****u 3
Yakir Luc Gagnon 1****r@g****m 3
MatFi g****t@e****e 3
Júlio Hoffimann j****n@g****m 3
Johnny Chen j****4@h****m 3
Chiyoung Ahn c****n@a****a 3
Benoit Pasquier b****c@g****m 3
and 64 more...

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 102
  • Total pull requests: 105
  • Average time to close issues: 11 months
  • Average time to close pull requests: about 1 month
  • Total issue authors: 84
  • Total pull request authors: 41
  • Average comments per issue: 4.33
  • Average comments per pull request: 3.02
  • Merged pull requests: 95
  • Bot issues: 0
  • Bot pull requests: 16
Past Year
  • Issues: 9
  • Pull requests: 35
  • Average time to close issues: 2 months
  • Average time to close pull requests: 26 days
  • Issue authors: 8
  • Pull request authors: 8
  • Average comments per issue: 1.67
  • Average comments per pull request: 2.71
  • Merged pull requests: 32
  • Bot issues: 0
  • Bot pull requests: 3
Top Authors
Issue Authors
  • mkitti (4)
  • tomasaschan (3)
  • Lincoln-Hannah (2)
  • pvillacorta (2)
  • jaemolihm (2)
  • andreasvarga (2)
  • eirikbrandsaas (2)
  • RainerHeintzmann (2)
  • wssyj (2)
  • ajwheeler (2)
  • fredrikpaues (2)
  • bclyons12 (2)
  • Sbozzolo (2)
  • DanielVandH (2)
  • briochemc (1)
Pull Request Authors
  • mkitti (26)
  • dependabot[bot] (13)
  • ajwheeler (12)
  • N5N3 (8)
  • github-actions[bot] (6)
  • NikoBiele (4)
  • contradict (2)
  • sathvikbhagavan (2)
  • oscardssmith (2)
  • abhro (2)
  • DanielVandH (2)
  • maltezfaria (2)
  • ranocha (2)
  • JoshuaLampert (2)
  • kirklong (2)
Top Labels
Issue Labels
bug (2) wishlist (2) enhancement (2) up for grabs (1) intro-issue (1) regression (1)
Pull Request Labels
dependencies (13) up for grabs (1) github_actions (1)

Packages

  • Total packages: 1
  • Total downloads:
    • julia 11,918 total
  • Total dependent packages: 302
  • Total dependent repositories: 110
  • Total versions: 46
juliahub.com: Interpolations

Fast, continuous interpolation of discrete datasets in Julia

  • Versions: 46
  • Dependent Packages: 302
  • Dependent Repositories: 110
  • Downloads: 11,918 Total
Rankings
Dependent packages count: 0.3%
Dependent repos count: 0.4%
Average: 0.7%
Forks count: 0.9%
Stargazers count: 1.4%
Last synced: 6 months ago