GithubHelp home page GithubHelp logo

Comments (4)

mkitti avatar mkitti commented on June 14, 2024

You're right, extrapolate is missing a second argument.

It should be

interp_linear = extrapolate(scale(interpolate(A, BSpline(Linear())), xs), Throw())

from interpolations.jl.

yuvalwas avatar yuvalwas commented on June 14, 2024

Notice that the linked PR only addresses the first of the two errors.

from interpolations.jl.

mkitti avatar mkitti commented on June 14, 2024

That line seems to work for me. What error do you encounter?

julia> itp = interpolate(A, BSpline(Linear()))
21-element interpolate(::Vector{Float64}, BSpline(Linear())) with element type Float64:
 0.0
 0.1823215567939546
 0.3364722366212129
 0.47000362924573563
 0.5877866649021191
 0.6931471805599453
 0.7884573603642703
 0.8754687373538999
 0.9555114450274363
 1.0296194171811581
 1.0986122886681098
 1.1631508098056809
 1.2237754316221157
 1.2809338454620642
 1.33500106673234
 1.3862943611198906
 1.4350845252893227
 1.4816045409242156
 1.5260563034950492
 1.5686159179138452
 1.6094379124341003

Did you not do using Interpolations before hand?

from interpolations.jl.

yuvalwas avatar yuvalwas commented on June 14, 2024

For me, running

using Interpolations
xs = 1:0.2:5
A = log.(xs)
itp = interpolate(A, BSpline(Linear()))

returns

21-element interpolate(::Vector{Float64}, BSpline(Linear())) with element type Float64:
Error showing value of type Interpolations.BSplineInterpolation{Float64, 1, Vector{Float64}, BSpline{Linear{Throw{OnGrid}}}, Tuple{Base.OneTo{Int64}}}:
ERROR: BoundsError: attempt to access Tuple{} at index [1]
Stacktrace:
  [1] getindex(t::Tuple, i::Int64)
    @ Base .\tuple.jl:31
  [2] _checklubounds(tf::Bool, ls::Tuple{}, us::Tuple{}, xs::Tuple{Int64})
    @ Interpolations C:\Users\yuvalw.WISMAIN\.julia\packages\Interpolations\nDwIa\src\Interpolations.jl:420
  [3] _checklubounds(tf::Bool, ls::Tuple{Int64}, us::Tuple{Int64}, xs::Tuple{Int64, Int64})
    @ Interpolations C:\Users\yuvalw.WISMAIN\.julia\packages\Interpolations\nDwIa\src\Interpolations.jl:420
  [4] checklubounds(ls::Tuple{Int64}, us::Tuple{Int64}, xs::Tuple{Int64, Int64})
    @ Interpolations C:\Users\yuvalw.WISMAIN\.julia\packages\Interpolations\nDwIa\src\Interpolations.jl:419
  [5] _checkbounds(::Interpolations.NeedsCheck, itp::Interpolations.BSplineInterpolation{Float64, 1, Vector{Float64}, BSpline{Linear{Throw{OnGrid}}}, Tuple{Base.OneTo{Int64}}}, x::Tuple{Int64, Int64})
    @ Interpolations C:\Users\yuvalw.WISMAIN\.julia\packages\Interpolations\nDwIa\src\Interpolations.jl:417
  [6] checkbounds
    @ Interpolations C:\Users\yuvalw.WISMAIN\.julia\packages\Interpolations\nDwIa\src\Interpolations.jl:407 [inlined]
  [7] isassigned(::Interpolations.BSplineInterpolation{Float64, 1, Vector{Float64}, BSpline{Linear{Throw{OnGrid}}}, Tuple{Base.OneTo{Int64}}}, ::Int64, ::Int64)
    @ Base .\multidimensional.jl:1569
  [8] alignment(io::IOContext{Base.TTY}, X::AbstractVecOrMat, rows::Vector{Int64}, cols::Vector{Int64}, cols_if_complete::Int64, cols_otherwise::Int64, sep::Int64, ncols::Int64)
    @ Base .\arrayshow.jl:68
  [9] _print_matrix(io::IOContext{Base.TTY}, X::AbstractVecOrMat, pre::String, sep::String, post::String, hdots::String, vdots::String, ddots::String, hmod::Int64, vmod::Int64, rowsA::UnitRange{Int64}, colsA::UnitRange{Int64})   
    @ Base .\arrayshow.jl:207
 [10] print_matrix(io::IOContext{…}, X::Interpolations.BSplineInterpolation{…}, pre::String, sep::String, post::String, hdots::String, vdots::String, ddots::String, hmod::Int64, vmod::Int64)
    @ Base .\arrayshow.jl:171
 [11] print_matrix(io::IO, X::AbstractVecOrMat, pre::AbstractString, sep::AbstractString, post::AbstractString, hdots::AbstractString, vdots::AbstractString, ddots::AbstractString, hmod::Integer, vmod::Integer)
    @ Base .\arrayshow.jl:171 [inlined]
 [12] print_array
    @ .\arrayshow.jl:358 [inlined]
 [13] show(io::IOContext{Base.TTY}, ::MIME{Symbol("text/plain")}, X::Interpolations.BSplineInterpolation{Float64, 1, Vector{Float64}, BSpline{Linear{Throw{OnGrid}}}, Tuple{Base.OneTo{Int64}}})
    @ Base .\arrayshow.jl:399
 [14] (::REPL.var"#55#56"{REPL.REPLDisplay{REPL.LineEditREPL}, MIME{Symbol("text/plain")}, Base.RefValue{Any}})(io::Any)
    @ REPL C:\Users\yuvalw.WISMAIN\AppData\Local\Programs\Julia-1.10.0\share\julia\stdlib\v1.10\REPL\src\REPL.jl:273
 [15] with_repl_linfo(f::Any, repl::REPL.LineEditREPL)
    @ REPL C:\Users\yuvalw.WISMAIN\AppData\Local\Programs\Julia-1.10.0\share\julia\stdlib\v1.10\REPL\src\REPL.jl:569
 [16] display(d::REPL.REPLDisplay, mime::MIME{Symbol("text/plain")}, x::Any)
    @ REPL C:\Users\yuvalw.WISMAIN\AppData\Local\Programs\Julia-1.10.0\share\julia\stdlib\v1.10\REPL\src\REPL.jl:259
 [17] display(d::REPL.REPLDisplay, x::Any)
    @ REPL C:\Users\yuvalw.WISMAIN\AppData\Local\Programs\Julia-1.10.0\share\julia\stdlib\v1.10\REPL\src\REPL.jl:278
 [18] display(x::Any)
    @ Base.Multimedia .\multimedia.jl:340
 [19] #invokelatest#2
    @ .\essentials.jl:887 [inlined]
 [20] invokelatest
    @ .\essentials.jl:884 [inlined]
 [21] print_response(errio::IO, response::Any, show_value::Bool, have_color::Bool, specialdisplay::Union{Nothing, AbstractDisplay})
    @ REPL C:\Users\yuvalw.WISMAIN\AppData\Local\Programs\Julia-1.10.0\share\julia\stdlib\v1.10\REPL\src\REPL.jl:315
 [22] (::REPL.var"#57#58"{REPL.LineEditREPL, Pair{Any, Bool}, Bool, Bool})(io::Any)
    @ REPL C:\Users\yuvalw.WISMAIN\AppData\Local\Programs\Julia-1.10.0\share\julia\stdlib\v1.10\REPL\src\REPL.jl:284
 [23] with_repl_linfo(f::Any, repl::REPL.LineEditREPL)
    @ REPL C:\Users\yuvalw.WISMAIN\AppData\Local\Programs\Julia-1.10.0\share\julia\stdlib\v1.10\REPL\src\REPL.jl:569
 [24] print_response(repl::REPL.AbstractREPL, response::Any, show_value::Bool, have_color::Bool)
    @ REPL C:\Users\yuvalw.WISMAIN\AppData\Local\Programs\Julia-1.10.0\share\julia\stdlib\v1.10\REPL\src\REPL.jl:282
 [25] (::REPL.var"#do_respond#80"{Bool, Bool, REPL.var"#93#103"{REPL.LineEditREPL, REPL.REPLHistoryProvider}, REPL.LineEditREPL, REPL.LineEdit.Prompt})(s::REPL.LineEdit.MIState, buf::Any, ok::Bool)
    @ REPL C:\Users\yuvalw.WISMAIN\AppData\Local\Programs\Julia-1.10.0\share\julia\stdlib\v1.10\REPL\src\REPL.jl:911
 [26] (::VSCodeServer.var"#101#104"{REPL.var"#do_respond#80"{Bool, Bool, REPL.var"#93#103"{REPL.LineEditREPL, REPL.REPLHistoryProvider}, REPL.LineEditREPL, REPL.LineEdit.Prompt}})(mi::REPL.LineEdit.MIState, buf::IOBuffer, ok::Bool)
    @ VSCodeServer c:\Users\yuvalw.WISMAIN\.vscode\extensions\julialang.language-julia-1.66.2\scripts\packages\VSCodeServer\src\repl.jl:122
 [27] #invokelatest#2
    @ Base .\essentials.jl:887 [inlined]
 [28] invokelatest
    @ Base .\essentials.jl:884 [inlined]
 [29] run_interface(terminal::REPL.Terminals.TextTerminal, m::REPL.LineEdit.ModalInterface, s::REPL.LineEdit.MIState)
    @ REPL.LineEdit C:\Users\yuvalw.WISMAIN\AppData\Local\Programs\Julia-1.10.0\share\julia\stdlib\v1.10\REPL\src\LineEdit.jl:2656
 [30] run_frontend(repl::REPL.LineEditREPL, backend::REPL.REPLBackendRef)
    @ REPL C:\Users\yuvalw.WISMAIN\AppData\Local\Programs\Julia-1.10.0\share\julia\stdlib\v1.10\REPL\src\REPL.jl:1312
 [31] (::REPL.var"#62#68"{REPL.LineEditREPL, REPL.REPLBackendRef})()
    @ REPL C:\Users\yuvalw.WISMAIN\AppData\Local\Programs\Julia-1.10.0\share\julia\stdlib\v1.10\REPL\src\REPL.jl:386
Some type information was truncated. Use `show(err)` to see complete types.

I'm running Interpolations v0.14.7 on Julia 1.10.0. I now see that this is not the newest version of Interpolations, but apparently I can't upgrade due to some compatibility constraint. Also I see now that running

itp = interpolate(A, BSpline(Linear()));

runs just fine, so indeed the problem is only with the displaying

from interpolations.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.