-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
112 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
@recipe function f(gp::AbstractGP, x::AbstractArray) | ||
Base.depwarn( | ||
"`plot(gp::AbstractGP, x::AbstractArray)` is deprecated, " * | ||
"use `plot(x, gp)` instead.", | ||
:apply_recipe, | ||
) | ||
return x, gp | ||
end | ||
@recipe function f(gp::AbstractGP, xmin::Real, xmax::Real) | ||
Base.depwarn( | ||
"`plot(gp::AbstractGP, xmin::Real, xmax::Real)` is deprecated, use " * | ||
"`plot(range(xmin, xmax; length=1_000), gp)` instead.", | ||
:apply_recipe, | ||
) | ||
return range(xmin, xmax; length=1_000), gp | ||
end | ||
|
||
@recipe function f(z::AbstractVector, gp::AbstractGP, x::AbstractArray) | ||
Base.depwarn( | ||
"`plot(z::AbstractVector, gp::AbstractGP, x::AbstractArray)` is deprecated, " * | ||
"use `plot(z, gp(x))` instead.", | ||
:apply_recipe, | ||
) | ||
return z, gp(x) | ||
end | ||
@recipe function f(z::AbstractVector, gp::AbstractGP, xmin::Real, xmax::Real) | ||
Base.depwarn( | ||
"`plot(z::AbstractVector, gp::AbstractGP, xmin::Real, xmax::Real)` is deprecated, " * | ||
"use `plot(z, gp(range(xmin, xmax; length=1_000))` instead.", | ||
:apply_recipe, | ||
) | ||
return z, gp(range(xmin, xmax; length=1_000)) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
@testset "deprecations" begin | ||
x = rand(10) | ||
f = GP(SqExponentialKernel()) | ||
gp = f(x, 0.1) | ||
|
||
# with `AbstractVector` and `AbstractRange`: | ||
for x in (rand(10), 0:0.01:1) | ||
rec = @test_deprecated RecipesBase.apply_recipe(Dict{Symbol,Any}(), f, x) | ||
@test length(rec) == 1 && length(rec[1].args) == 2 # one series with two arguments | ||
@test rec[1].args[1] == x | ||
@test rec[1].args[2] == f | ||
@test isempty(rec[1].plotattributes) # no default attributes | ||
|
||
z = 1 .+ x | ||
rec = @test_deprecated RecipesBase.apply_recipe(Dict{Symbol,Any}(), z, f, x) | ||
@test length(rec) == 1 && length(rec[1].args) == 2 # one series with two arguments | ||
@test rec[1].args[1] == z | ||
@test rec[1].args[2] isa AbstractGPs.FiniteGP | ||
@test rec[1].args[2].x == x | ||
@test rec[1].args[2].f == f | ||
@test isempty(rec[1].plotattributes) # no default attributes | ||
end | ||
|
||
# with minimum and maximum: | ||
xmin = rand() | ||
xmax = 4 + rand() | ||
rec = @test_deprecated RecipesBase.apply_recipe(Dict{Symbol,Any}(), f, xmin, xmax) | ||
@test length(rec) == 1 && length(rec[1].args) == 2 # one series with two arguments | ||
@test rec[1].args[1] == range(xmin, xmax; length=1_000) | ||
@test rec[1].args[2] == f | ||
@test isempty(rec[1].plotattributes) # no default attributes | ||
|
||
z = range(0, 1; length=1_000) | ||
rec = @test_deprecated RecipesBase.apply_recipe(Dict{Symbol,Any}(), z, f, xmin, xmax) | ||
@test length(rec) == 1 && length(rec[1].args) == 2 # one series with two arguments | ||
@test rec[1].args[1] == z | ||
@test rec[1].args[2] isa AbstractGPs.FiniteGP | ||
@test rec[1].args[2].x == range(xmin, xmax; length=1_000) | ||
@test rec[1].args[2].f == f | ||
@test isempty(rec[1].plotattributes) # no default attributes | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31d0ecb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JuliaRegistrator register
31d0ecb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Registration pull request created: JuliaRegistries/General/33196
After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.
This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via: