Gridded here is the *interpolation scheme*, as opposed to (implicitly uniform) BSpline interpolation; it’s simply the way Interpolations.jl lets you specify which algorithm you want to use. Compare the following incantations:
itp = interpolate(A, BSpline(Linear()), OnGrid()) # linear b-spline interpolation; x is implicitly 1:length(A) itp = interpolate((x,), A, Gridded(Linear())) # linear, "gridded" interpolation; x can be irregular itp = interpolate(A, BSpline(Cubic(Flat())), OnCell()) # cubic b-spline with free boundary condition That is; you give the data to be interpolated (A and, where applicable, x) as well as one or more arguments specifying the algortihm you want to use (for details on OnGrid/OnCell, see the readme). Gridded is what just we’ve called the family of algorithms that support irregular grids. This is all documented in the readme, but documentation is not just about putting the information in writing - it’s also about putting it in the correct place, where it seems obvious to look for it. If you have suggestions on how this information can be made easier to find and digest, please file an issue or PR. All feedback is most welcome! :) // T On Sunday, February 28, 2016 at 7:37:42 PM UTC+1, Uwe Fechner wrote: Hello, > > thanks for your explanations. > > Nevertheless I like the syntax of the package Dierckx much more. > The expression Gridded(Linear()) is very confusing for me. What is gridded, > in this example? > > Furthermore the Readme file of Interpolations is missing the information, > how > to use it for the given problem. > > Best regards: > > Uwe > > On Saturday, February 27, 2016 at 4:57:07 PM UTC+1, Matt Bauman wrote: >> >> Interpolations is very similar, but it currently only supports linear and >> nearest-neighbor schemes for gridded interpolations: >> >> using Interpolations >> >> itp = interpolate((P_NOM,), ETA, Gridded(Linear())) # You pass the >> x-values as a tuple, since this generalizes to multi-dimensional coordinates >> println(itp[3.5]) >> >> x = linspace(1.5, 14.9, 1024) >> y = itp[x] >> >> plot(x,y) >> >> >> >> On Saturday, February 27, 2016 at 10:10:28 AM UTC-5, Uwe Fechner wrote: >>> >>> Thanks. The following code works: >>> >>> using Dierckx >>> >>> P_NOM = [1.5, 2.2, 3.7, 5.6, 7.5, 11.2, 14.9] >>> ETA = [93., 94., 94., 95., 95., 95.5, 95.5] >>> calc_eta = Spline1D(P_NOM, ETA, k=1) >>> >>> println(calc_eta(3.5)) >>> >>> Nevertheless I would be interested how to do that with >>> Interpolations.jl. Sometimes you don't have Fortran available. >>> >>> Best regards: >>> >>> Uwe >>> >>> On Saturday, February 27, 2016 at 3:58:11 PM UTC+1, Yichao Yu wrote: >>>> >>>> >>>> >>>> On Sat, Feb 27, 2016 at 9:40 AM, Uwe Fechner <[email protected]> >>>> wrote: >>>> >>>>> Hello, >>>>> >>>>> I don't think, that this works on a non-uniform grid. The array xg is >>>>> evenly spaced, and it >>>>> is NOT passed to the function InterpGrid. >>>>> >>>>> >>>> I've recently tried Dierckx which support non-uniform interpolation. I >>>> only need very basic functions so I don't know if it has all the >>>> flexibility you need but it's probably worth a look if you haven't. >>>> >>>> >>>>> Uwe >>>>> >>>>> >>>>> On Saturday, February 27, 2016 at 3:33:06 PM UTC+1, Cedric St-Jean >>>>> wrote: >>>>>> >>>>>> Hi Uwe, >>>>>> >>>>>> Have you tried Grid.jl? I haven't tried it, but this example looks >>>>>> like it might work with a non-uniform grid. >>>>>> >>>>>> # Let's define a quadratic function in one dimension, and evaluate it on >>>>>> an evenly-spaced grid of 5 points: >>>>>> c = 2.3 # center >>>>>> a = 8.1 # quadratic coefficient >>>>>> o = 1.6 # vertical offset >>>>>> qfunc = x -> a*(x-c).^2 + o >>>>>> xg = Float64[1:5] >>>>>> y = qfunc(xg) >>>>>> yi = InterpGrid(y, BCnil, InterpQuadratic) >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> On Saturday, February 27, 2016 at 9:21:53 AM UTC-5, Uwe Fechner wrote: >>>>>>> >>>>>>> Hello, >>>>>>> >>>>>>> I am trying to port the following function from python to julia: >>>>>>> >>>>>>> # -*- coding: utf-8 -*- >>>>>>> from scipy.interpolate import InterpolatedUnivariateSpline >>>>>>> import numpy as np >>>>>>> from pylab import plot >>>>>>> >>>>>>> P_NOM = [1.5, 2.2, 3.7, 5.6, 7.5, 11.2, 14.9] >>>>>>> ETA = [93., 94., 94., 95., 95., 95.5, 95.5] >>>>>>> >>>>>>> calc_eta = InterpolatedUnivariateSpline(P_NOM, ETA, k=1) >>>>>>> >>>>>>> # plotting code, only for testing >>>>>>> if __name__ == "__main__": >>>>>>> X = np.linspace(1.5, 14.9, 1024, endpoint=True) >>>>>>> ETA = [] >>>>>>> for alpha in X: >>>>>>> eta = calc_eta(alpha) >>>>>>> ETA.append(eta) >>>>>>> plot(X, ETA) >>>>>>> >>>>>>> The resulting plot is shown at the end of this posting. >>>>>>> >>>>>>> How can I port this to Julia? >>>>>>> >>>>>>> I am trying to use the package "Interpolations.jl", but I do not see >>>>>>> any >>>>>>> example, that shows the interpolation on a non-uniform grid. >>>>>>> >>>>>>> For now I need only linear interpolation, but I want to use B-Splines >>>>>>> later. >>>>>>> >>>>>>> Any hint appreciated! >>>>>>> >>>>>>> Uwe Fechner >>>>>>> >>>>>>> >>>>>>> >>>>>>> <https://lh3.googleusercontent.com/-8OofwCQWohg/VtGwKR-1BOI/AAAAAAAAAQI/UTLksCCMIPo/s1600/LinearInterpolation.png> >>>>>>> >>>>>> >>>>
