Closed JLTastet closed 5 years ago
Interpolations 0.9.0 was a breaking release, and it breaks KernelDensity when trying to evaluate the KDE outside the bounds of the interpolator.
Manifest.toml.zip
(v1.0) pkg> generate Test Generating project Test: Test/Project.toml Test/src/Test.jl shell> cd Test /tmp/Test (v1.0) pkg> activate . (Test) pkg> add KernelDensity Updating registry at `~/.julia/registries/General` Updating git-repo `https://github.com/JuliaRegistries/General.git` Resolving package versions... Updating `Project.toml` [5ab0869b] + KernelDensity v0.5.0 Updating `Manifest.toml` [621f4979] + AbstractFFTs v0.3.2 [7d9fca2a] + Arpack v0.2.3 [13072b0f] + AxisAlgorithms v0.3.0 [9e28174c] + BinDeps v0.8.10 [b99e7846] + BinaryProvider v0.5.0 [49dc2e85] + Calculus v0.4.1 [bbf7d656] + CommonSubexpressions v0.2.0 [34da2185] + Compat v1.2.0 [8f4d0f93] + Conda v1.0.2 [864edb3b] + DataStructures v0.14.0 [01453d9d] + DiffEqDiffTools v0.6.0 [163ba53b] + DiffResults v0.0.3 [b552c78f] + DiffRules v0.0.7 [31c24e10] + Distributions v0.16.4 [7a1cc6ca] + FFTW v0.2.4 [f6369f11] + ForwardDiff v0.9.0 [a98d9a8b] + Interpolations v0.9.1 [682c06a0] + JSON v0.19.0 [5ab0869b] + KernelDensity v0.5.0 [d3d80556] + LineSearches v7.0.0 [e1d29d7a] + Missings v0.3.1 [d41bc354] + NLSolversBase v7.1.0 [77ba4419] + NaNMath v0.3.2 [6fe1bfb0] + OffsetArrays v0.8.1 [429524aa] + Optim v0.17.1 [bac558e1] + OrderedCollections v1.0.2 [90014a1f] + PDMats v0.9.5 [d96e819e] + Parameters v0.10.1 [85a6dd25] + PositiveFactorizations v0.2.1 [1fd47b50] + QuadGK v2.0.2 [c84ed2f1] + Ratios v0.3.0 [189a3867] + Reexport v0.2.0 [79098fc4] + Rmath v0.5.0 [a2af1166] + SortingAlgorithms v0.3.1 [276daf66] + SpecialFunctions v0.7.1 [90137ffa] + StaticArrays v0.8.3 [2913bbd2] + StatsBase v0.25.0 [4c63d2b9] + StatsFuns v0.7.0 [30578b45] + URIParser v0.4.0 [81def892] + VersionParsing v1.1.3 [efce3f68] + WoodburyMatrices v0.4.1 [2a0f44e3] + Base64 [ade2ca70] + Dates [8bb1440f] + DelimitedFiles [8ba89e20] + Distributed [b77e0a4c] + InteractiveUtils [76f85450] + LibGit2 [8f399da3] + Libdl [37e2e46d] + LinearAlgebra [56ddb016] + Logging [d6f4376e] + Markdown [a63ad114] + Mmap [44cfe95a] + Pkg [de0858da] + Printf [3fa0cd96] + REPL [9a3f8284] + Random [ea8e919c] + SHA [9e88b42a] + Serialization [1a1011a3] + SharedArrays [6462fe0b] + Sockets [2f01184e] + SparseArrays [10745b16] + Statistics [4607b0f0] + SuiteSparse [8dfed614] + Test [cf7118a7] + UUIDs [4ec0a83e] + Unicode julia> using Random, KernelDensity julia> Random.seed!(1337); julia> x = rand(1000); julia> K = kde(x) UnivariateKDE{StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}}}(-0.26038988009831726:0.0007430635406498104:1.2606611876118445, [7.04455e-5, 7.05408e-5, 7.07904e-5, 7.11946e-5, 7.17542e-5, 7.247e-5, 7.33433e-5, 7.43754e-5, 7.55682e-5, 7.69234e-5 … 7.80742e-5, 7.65918e-5, 7.5274e-5, 7.41185e-5, 7.31234e-5, 7.22871e-5, 7.1608e-5, 7.10851e-5, 7.07174e-5, 7.05043e-5]) julia> pdf(K, -1.0) ┌ Warning: interpolate(A, BSpline(Quadratic(Line())), Interpolations.OnGrid()) is deprecated, use interpolate(A, BSpline(Quadratic(Line(Interpolations.OnGrid())))) │ caller = Type at interp.jl:11 [inlined] └ @ Core ~/.julia/packages/KernelDensity/JfNeR/src/interp.jl:11 ┌ Warning: `getindex(itp::AbstractInterpolation{T, N}, i::Vararg{Number, N}) where {T, N}` is deprecated, use `itp(i...)` instead. │ caller = pdf at interp.jl:25 [inlined] └ @ Core ~/.julia/packages/KernelDensity/JfNeR/src/interp.jl:25 ERROR: BoundsError: attempt to access 2048-element interpolate(OffsetArray(::Array{Float64,1}, 0:2049), BSpline(Quadratic(Line(Interpolations.OnGrid())))) with element type Float64 at index [-994.3524556660287] Stacktrace: [1] throw_boundserror(::Interpolations.BSplineInterpolation{Float64,1,OffsetArrays.OffsetArray{Float64,1,Array{Float64,1}},Interpolations.BSpline{Interpolations.Quadratic{Interpolations.Line{Interpolations.OnGrid}}},Tuple{Base.OneTo{Int64}}}, ::Tuple{Float64}) at ./abstractarray.jl:484 [2] BSplineInterpolation at /home/jl/.julia/packages/Interpolations/Pwkql/src/b-splines/indexing.jl:6 [inlined] [3] (::Interpolations.ScaledInterpolation{Float64,1,Interpolations.BSplineInterpolation{Float64,1,OffsetArrays.OffsetArray{Float64,1,Array{Float64,1}},Interpolations.BSpline{Interpolations.Quadratic{Interpolations.Line{Interpolations.OnGrid}}},Tuple{Base.OneTo{Int64}}},Interpolations.BSpline{Interpolations.Quadratic{Interpolations.Line{Interpolations.OnGrid}}},Tuple{StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}}}})(::Float64) at /home/jl/.julia/packages/Interpolations/Pwkql/src/scaling/scaling.jl:63 [4] getindex(::Interpolations.ScaledInterpolation{Float64,1,Interpolations.BSplineInterpolation{Float64,1,OffsetArrays.OffsetArray{Float64,1,Array{Float64,1}},Interpolations.BSpline{Interpolations.Quadratic{Interpolations.Line{Interpolations.OnGrid}}},Tuple{Base.OneTo{Int64}}},Interpolations.BSpline{Interpolations.Quadratic{Interpolations.Line{Interpolations.OnGrid}}},Tuple{StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}}}}, ::Float64) at ./deprecated.jl:55 [5] pdf at /home/jl/.julia/packages/KernelDensity/JfNeR/src/interp.jl:25 [inlined] [6] pdf(::UnivariateKDE{StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}}}, ::Float64) at /home/jl/.julia/packages/KernelDensity/JfNeR/src/interp.jl:29 [7] top-level scope at none:0
I will send a PR soon. I just need to add a few tests before.
Interpolations 0.9.0 was a breaking release, and it breaks KernelDensity when trying to evaluate the KDE outside the bounds of the interpolator.
Steps to reproduce:
Manifest.toml.zip