Code: Fix error in welch (MethodError, MtSpec)
Issue #12
resolved
I am not totally sure if this is meant to be a correct invocation of welch
or not, but I get an error when trying to use it.
julia> w = Multitaper.welch(x, 100)
ERROR: MethodError: no method matching MtSpec(::StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}}, ::Array{Float64,1}, ::Nothing, ::MtParams, ::Nothing)
Closest candidates are:
MtSpec(::Union{UnitRange{Int64}, Array{Float64,1}, StepRangeLen{Float64,R,S} where S where R}, :Array{Float64,1}, ::Union{Nothing, Array{Float64,1}}, ::MtParams, ::C, ::Union{Nothing, Array{Float64,1}}, ::J, ::P) where {C, J, P} at /Users/nowacki/.julia/dev/Multitaper/src/StructsTypes.jl:52
Stacktrace:
[1] welch(::Array{Float64,1}, ::Int64, ::Float64, ::Symbol; outp::Symbol, NW::Float64, K::Int64, dt::Float64, ctr::Bool, pad::Float64, dpVec::Nothing, egval::Nothing, guts::Bool, a_weight::Bool, Ftest::Bool, jk::Bool, Tsq::Nothing, alph::Float64) at /Users/nowacki/.julia/dev/Multitaper/src/Univariate.jl:372
[2] welch(::Array{Float64,1}, ::Int64, ::Float64, ::Symbol) at /Users/nowacki/.julia/dev/Multitaper/src/Univariate.jl:328 (repeats 2 times)
[3] top-level scope at REPL[21]:1
Please fix the error and add a test for it, or clarify the API and throw a more helpful error if the invocation is wrong.
Comments (3)
-
repo owner -
reporter I’m happy that this is resolved.
-
repo owner - changed status to resolved
- Log in to comment
There was an error in the Welch code, which [this commit](https://bitbucket.org/clhaley/multitaper.jl/commits/99519aa191d1789beedc8e41c50a6e7d2b871163) addresses. The code above will throw an error if the length of the time series is greater than or equal to the number of segments, but if, say, a Welch estimate on a 100-point time series with 3 segments with 50% overlap is desired, one can compute this using: