You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If evaluated outside the grid range (e.g. at 42), it seems to automatically extrapolate
sitp[42.0]
3.7425272463577794
However, that doesn't work for a vector
sitp[[42.0,3.5]]
BoundsError: attempt to access 20-element scale(interpolate(::Array{Float64,1}, BSpline(Linear()), OnGrid()), (1.0:2.0:39.0,)) with element type Float64 at index [[42.0,3.5]]
in throw_boundserror(::Interpolations.ScaledInterpolation{Float64,1,Interpolations.BSplineInterpolation{Float64,1,Array{Float64,1},Interpolations.BSpline{Interpolations.Linear},Interpolations.OnGrid,0},Interpolations.BSpline{Interpolations.Linear},Interpolations.OnGrid,Tuple{FloatRange{Float64}}}, ::Tuple{Array{Float64,1}}) at abstractarray.jl:363
in checkbounds at abstractarray.jl:292 [inlined]
in _getindex at multidimensional.jl:272 [inlined]
in getindex(::Interpolations.ScaledInterpolation{Float64,1,Interpolations.BSplineInterpolation{Float64,1,Array{Float64,1},Interpolations.BSpline{Interpolations.Linear},Interpolations.OnGrid,0},Interpolations.BSpline{Interpolations.Linear},Interpolations.OnGrid,Tuple{FloatRange{Float64}}}, ::Array{Float64,1}) at abstractarray.jl:760
in include_string(::String, ::String) at loading.jl:441
in include_string(::String, ::String) at sys.dylib:?
in eval(::Module, ::Any) at boot.jl:234
in eval(::Module, ::Any) at sys.dylib:?
in (::Atom.##65#68)() at eval.jl:102
in withpath(::Atom.##65#68, ::Void) at utils.jl:30
in withpath(::Function, ::Void) at eval.jl:38
in macro expansion at eval.jl:101 [inlined]
in (::Atom.##64#67{Dict{String,Any}})() at task.jl:60
What works is to set the extrapolation explicitely
This seems a bit inconsistent. Would it make sense to also automatically extrapolate when the input is a vector of points? Possibly related is issue #129.
I suspect all AbstractInterpolation types should turn on bounds checking. (I think Interpolations was written before @blakejohnson added the wonderful @boundscheck mechanism.)
Noticed this today too, when writing up a workaround for #192. It seems it's not only for extrapolation it fails; even when evaluating inside the scaled bounds it can fail. For example, this throws the same error:
The following example is taken from the readme
This can also be called in one go by passing a vector to be evaluated
If evaluated outside the grid range (e.g. at 42), it seems to automatically extrapolate
However, that doesn't work for a vector
What works is to set the extrapolation explicitely
This seems a bit inconsistent. Would it make sense to also automatically extrapolate when the input is a vector of points? Possibly related is issue #129.
General information
The text was updated successfully, but these errors were encountered: