use a stable RNG in fakedata
This commit is contained in:
parent
a39582c06e
commit
fe7d957be3
@ -31,6 +31,7 @@ SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
|
||||
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
|
||||
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
|
||||
UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
|
||||
StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3"
|
||||
|
||||
[compat]
|
||||
Contour = "0.5"
|
||||
@ -65,7 +66,6 @@ OffsetArrays = "6fe1bfb0-de20-5000-8ca7-80f57d26f881"
|
||||
PGFPlotsX = "8314cec4-20b6-5062-9cdb-752b83310925"
|
||||
PlotlyJS = "f0f68f2c-4968-5e81-91da-67840de0976a"
|
||||
RDatasets = "ce6b1742-4840-55fa-b093-852dadbb1d8b"
|
||||
StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3"
|
||||
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
|
||||
StatsPlots = "f3b207a7-027a-5e70-b257-86293d7955fd"
|
||||
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
|
||||
@ -74,4 +74,4 @@ UnicodePlots = "b8865327-cd53-5732-bb35-84acbb429228"
|
||||
VisualRegressionTests = "34922c18-7c2a-561c-bac1-01e79b2c4c92"
|
||||
|
||||
[targets]
|
||||
test = ["Distributions", "FileIO", "Gtk", "ImageMagick", "Images", "LibGit2", "OffsetArrays", "PGFPlotsX", "PlotlyJS", "HDF5", "RDatasets", "StableRNGs", "StaticArrays", "StatsPlots", "Test", "TestImages", "UnicodePlots", "VisualRegressionTests"]
|
||||
test = ["Distributions", "FileIO", "Gtk", "ImageMagick", "Images", "LibGit2", "OffsetArrays", "PGFPlotsX", "PlotlyJS", "HDF5", "RDatasets", "StaticArrays", "StatsPlots", "Test", "TestImages", "UnicodePlots", "VisualRegressionTests"]
|
||||
|
||||
@ -11,6 +11,7 @@ using Reexport
|
||||
import GeometryBasics
|
||||
using Dates, Printf, Statistics, Base64, LinearAlgebra, Random
|
||||
using SparseArrays
|
||||
using StableRNGs
|
||||
|
||||
using FFMPEG
|
||||
|
||||
@ -118,7 +119,6 @@ export
|
||||
scalefontsizes,
|
||||
resetfontsizes
|
||||
|
||||
|
||||
# ---------------------------------------------------------
|
||||
|
||||
import NaNMath # define functions that ignores NaNs. To overcome the destructive effects of https://github.com/JuliaLang/julia/pull/12563
|
||||
@ -250,6 +250,7 @@ end
|
||||
# ---------------------------------------------------------
|
||||
|
||||
const CURRENT_BACKEND = CurrentBackend(:none)
|
||||
const PLOTS_SEED = 1234
|
||||
|
||||
include("precompile_includer.jl")
|
||||
|
||||
|
||||
@ -128,8 +128,7 @@ const _examples = PlotExample[
|
||||
:(
|
||||
begin
|
||||
import FileIO
|
||||
path =
|
||||
download("http://juliaplots.org/PlotReferenceImages.jl/Plots/pyplot/0.7.0/ref1.png")
|
||||
path = download("http://juliaplots.org/PlotReferenceImages.jl/Plots/pyplot/0.7.0/ref1.png")
|
||||
img = FileIO.load(path)
|
||||
plot(img)
|
||||
end
|
||||
|
||||
@ -303,10 +303,10 @@ function convert_to_polar(theta, r, r_extrema = ignorenan_extrema(r))
|
||||
x, y
|
||||
end
|
||||
|
||||
function fakedata(sz...)
|
||||
function fakedata(sz...; rng=StableRNG(PLOTS_SEED))
|
||||
y = zeros(sz...)
|
||||
for r in 2:size(y,1)
|
||||
y[r,:] = 0.95 * vec(y[r-1,:]) + randn(size(y,2))
|
||||
y[r,:] = 0.95 * vec(y[r-1,:]) + randn(rng, size(y,2))
|
||||
end
|
||||
y
|
||||
end
|
||||
|
||||
@ -13,7 +13,7 @@ function replace_rand!(ex::Expr)
|
||||
end
|
||||
function fix_rand!(ex)
|
||||
replace_rand!(ex)
|
||||
pushfirst!(ex.args[1].args, :(rng = StableRNG(1234)))
|
||||
pushfirst!(ex.args[1].args, :(rng = StableRNG(PLOTS_SEED)))
|
||||
end
|
||||
|
||||
function image_comparison_tests(
|
||||
|
||||
@ -1,9 +1,8 @@
|
||||
using Plots: guidefont, series_annotations
|
||||
using Plots: guidefont, series_annotations, PLOTS_SEED
|
||||
import ImageMagick
|
||||
using VisualRegressionTests
|
||||
using Plots
|
||||
using Random
|
||||
using StableRNGs
|
||||
using Test
|
||||
using TestImages
|
||||
using FileIO
|
||||
@ -12,7 +11,7 @@ using LibGit2
|
||||
import GeometryBasics
|
||||
using Dates
|
||||
using RecipesBase
|
||||
|
||||
using StableRNGs
|
||||
|
||||
@testset "Plotly standalone" begin
|
||||
@test_nowarn Plots._init_ijulia_plotting()
|
||||
@ -68,7 +67,7 @@ end
|
||||
|
||||
include("imgcomp.jl")
|
||||
# don't actually show the plots
|
||||
Random.seed!(1234)
|
||||
Random.seed!(PLOTS_SEED)
|
||||
default(show=false, reuse=true)
|
||||
is_ci() = get(ENV, "CI", "false") == "true"
|
||||
const PLOTS_IMG_TOL = parse(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user