Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MovingWindow raises a BoundsError #264

Closed
femtotrader opened this issue Jul 12, 2023 · 2 comments
Closed

MovingWindow raises a BoundsError #264

femtotrader opened this issue Jul 12, 2023 · 2 comments

Comments

@femtotrader
Copy link

julia> using OnlineStats

julia> mw = MovingWindow(Int, 3)
MovingWindow: n=0 | value=Error showing value of type MovingWindow{Int64}:
ERROR: BoundsError: attempt to access 0-element Vector{Int64} at index [[1, 2, 3]]
Stacktrace:
  [1] throw_boundserror(A::Vector{Int64}, I::Tuple{Vector{Int64}})
    @ Base .\abstractarray.jl:744
  [2] checkbounds
    @ .\abstractarray.jl:709 [inlined]
  [3] _getindex
    @ .\multidimensional.jl:860 [inlined]
  [4] getindex
    @ .\abstractarray.jl:1294 [inlined]
  [5] permute!(v::Vector{Int64}, p::Vector{Int64})
    @ Base .\combinatorics.jl:187
  [6] value(o::MovingWindow{Int64})
    @ OnlineStats C:\Users\femto\.julia\packages\OnlineStats\U6Stp\src\stats\stats.jl:386
  [7] show(io::IOContext{Base.TTY}, o::MovingWindow{Int64})
    @ OnlineStatsBase C:\Users\femto\.julia\packages\OnlineStatsBase\q7tWg\src\OnlineStatsBase.jl:79
  [8] show(io::IOContext{Base.TTY}, #unused#::MIME{Symbol("text/plain")}, x::MovingWindow{Int64})
    @ Base.Multimedia .\multimedia.jl:47
  [9] (::REPL.var"#55#56"{REPL.REPLDisplay{REPL.LineEditREPL}, MIME{Symbol("text/plain")}, Base.RefValue{Any}})(io::Any)
    @ REPL C:\Users\femto\.julia\juliaup\julia-1.9.1+0.x64.w64.mingw32\share\julia\stdlib\v1.9\REPL\src\REPL.jl:276
 [10] with_repl_linfo(f::Any, repl::REPL.LineEditREPL)
    @ REPL C:\Users\femto\.julia\juliaup\julia-1.9.1+0.x64.w64.mingw32\share\julia\stdlib\v1.9\REPL\src\REPL.jl:557
 [11] display(d::REPL.REPLDisplay, mime::MIME{Symbol("text/plain")}, x::Any)
    @ REPL C:\Users\femto\.julia\juliaup\julia-1.9.1+0.x64.w64.mingw32\share\julia\stdlib\v1.9\REPL\src\REPL.jl:262
 [12] display
    @ C:\Users\femto\.julia\juliaup\julia-1.9.1+0.x64.w64.mingw32\share\julia\stdlib\v1.9\REPL\src\REPL.jl:281 [inlined]
 [13] display(x::Any)
    @ Base.Multimedia .\multimedia.jl:340
 [14] #invokelatest#2
    @ .\essentials.jl:816 [inlined]
 [15] invokelatest
    @ .\essentials.jl:813 [inlined]
 [16] print_response(errio::IO, response::Any, show_value::Bool, have_color::Bool, specialdisplay::Union{Nothing, AbstractDisplay})
    @ REPL C:\Users\femto\.julia\juliaup\julia-1.9.1+0.x64.w64.mingw32\share\julia\stdlib\v1.9\REPL\src\REPL.jl:305
 [17] (::REPL.var"#57#58"{REPL.LineEditREPL, Pair{Any, Bool}, Bool, Bool})(io::Any)
    @ REPL C:\Users\femto\.julia\juliaup\julia-1.9.1+0.x64.w64.mingw32\share\julia\stdlib\v1.9\REPL\src\REPL.jl:287
 [18] with_repl_linfo(f::Any, repl::REPL.LineEditREPL)
    @ REPL C:\Users\femto\.julia\juliaup\julia-1.9.1+0.x64.w64.mingw32\share\julia\stdlib\v1.9\REPL\src\REPL.jl:557
 [19] print_response(repl::REPL.AbstractREPL, response::Any, show_value::Bool, have_color::Bool)
    @ REPL C:\Users\femto\.julia\juliaup\julia-1.9.1+0.x64.w64.mingw32\share\julia\stdlib\v1.9\REPL\src\REPL.jl:285
 [20] (::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\femto\.julia\juliaup\julia-1.9.1+0.x64.w64.mingw32\share\julia\stdlib\v1.9\REPL\src\REPL.jl:899
 [21] #invokelatest#2
    @ .\essentials.jl:816 [inlined]
 [22] invokelatest
    @ .\essentials.jl:813 [inlined]
 [23] run_interface(terminal::REPL.Terminals.TextTerminal, m::REPL.LineEdit.ModalInterface, s::REPL.LineEdit.MIState)
    @ REPL.LineEdit C:\Users\femto\.julia\juliaup\julia-1.9.1+0.x64.w64.mingw32\share\julia\stdlib\v1.9\REPL\src\LineEdit.jl:2647
 [24] run_frontend(repl::REPL.LineEditREPL, backend::REPL.REPLBackendRef)
    @ REPL C:\Users\femto\.julia\juliaup\julia-1.9.1+0.x64.w64.mingw32\share\julia\stdlib\v1.9\REPL\src\REPL.jl:1300
 [25] (::REPL.var"#62#68"{REPL.LineEditREPL, REPL.REPLBackendRef})()
    @ REPL .\task.jl:514
@joshday
Copy link
Owner

joshday commented Jul 12, 2023

Ah, the error is in the show method if the buffer isn't full (in this case, it hasn't been fit! with 3 observations yet). Fixed on master. Release out soon.

@joshday joshday closed this as completed Jul 12, 2023
@femtotrader
Copy link
Author

Thanks for prompt answer !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants