From 7379e23b7a14e1c051980dcf69c55f694bea3257 Mon Sep 17 00:00:00 2001 From: Mahmoud Bentriou <mahmoud.bentriou@centralesupelec.fr> Date: Sun, 15 May 2022 03:01:43 +0200 Subject: [PATCH] Using Plots instead of PyPlot in tests --- test/simulation/sim_er.jl | 8 +++----- test/simulation/sim_er_row_buffer_bounded.jl | 8 +++----- test/simulation/sim_sir.jl | 8 +++----- test/simulation/sim_sir_bounded.jl | 8 +++----- test/simulation/sim_sir_col_buffer_bounded.jl | 8 +++----- test/simulation/sim_sir_row_buffer_bounded.jl | 8 +++----- 6 files changed, 18 insertions(+), 30 deletions(-) diff --git a/test/simulation/sim_er.jl b/test/simulation/sim_er.jl index 09f7698..002b32a 100644 --- a/test/simulation/sim_er.jl +++ b/test/simulation/sim_er.jl @@ -1,14 +1,12 @@ using MarkovProcesses -using PyPlot +using Plots load_model("ER") σ = simulate(ER) -plt.figure() -plt.step(times(σ), σ[:P], "ro--", marker="x", where="post", linewidth=1.0) -plt.savefig(get_module_path() * "/test/simulation/res_pics/sim_er.png", dpi=480) -plt.close() +plot(times(σ), σ[:P], linetype=:steppost, linewidth=1.0) +savefig(get_module_path() * "/test/simulation/res_pics/sim_er.png", dpi=480) return true diff --git a/test/simulation/sim_er_row_buffer_bounded.jl b/test/simulation/sim_er_row_buffer_bounded.jl index b4c3e02..77c490c 100644 --- a/test/simulation/sim_er_row_buffer_bounded.jl +++ b/test/simulation/sim_er_row_buffer_bounded.jl @@ -1,16 +1,14 @@ using MarkovProcesses include(get_module_path() * "/src/_tests_simulate.jl") -using PyPlot +using Plots load_model("_bench_perf_test/ER_row_buffer") ER_row_buffer.time_bound = 10.0 σ = _simulate_row_buffer(ER_row_buffer) -plt.figure() -plt.step(times(σ), _get_values_row(σ,:P), "ro--", marker="x", where="post", linewidth=1.0) -plt.savefig(get_module_path() * "/test/simulation/res_pics/sim_er_row_buffer_bounded.svg") -plt.close() +plot(times(σ), _get_values_row(σ,:P), linetype=:steppost, linewidth=1.0) +savefig(get_module_path() * "/test/simulation/res_pics/sim_er_row_buffer_bounded.svg") return true diff --git a/test/simulation/sim_sir.jl b/test/simulation/sim_sir.jl index c0e8da5..86187dc 100644 --- a/test/simulation/sim_sir.jl +++ b/test/simulation/sim_sir.jl @@ -1,14 +1,12 @@ using MarkovProcesses -using PyPlot +using Plots load_model("SIR") σ = simulate(SIR) -plt.figure() -plt.step(times(σ), σ[:I], "ro--", marker="x", where="post", linewidth=1.0) -plt.savefig(get_module_path() * "/test/simulation/res_pics/sim_sir.svg") -plt.close() +plot(times(σ), σ[:I], linetype=:steppost, linewidth=1.0) +savefig(get_module_path() * "/test/simulation/res_pics/sim_sir.svg") return true diff --git a/test/simulation/sim_sir_bounded.jl b/test/simulation/sim_sir_bounded.jl index 1e9ab1f..861177c 100644 --- a/test/simulation/sim_sir_bounded.jl +++ b/test/simulation/sim_sir_bounded.jl @@ -1,15 +1,13 @@ using MarkovProcesses -using PyPlot +using Plots load_model("SIR") SIR.time_bound = 100.0 σ = simulate(SIR) -plt.figure() -plt.step(times(σ), σ[:I], "ro--", marker="x", where="post", linewidth=1.0) -plt.savefig(get_module_path() * "/test/simulation/res_pics/sim_sir_bounded.svg") -plt.close() +plot(times(σ), σ[:I], linetype=:steppost, linewidth=1.0) +savefig(get_module_path() * "/test/simulation/res_pics/sim_sir_bounded.svg") return true diff --git a/test/simulation/sim_sir_col_buffer_bounded.jl b/test/simulation/sim_sir_col_buffer_bounded.jl index d3f6887..5b2ccc8 100644 --- a/test/simulation/sim_sir_col_buffer_bounded.jl +++ b/test/simulation/sim_sir_col_buffer_bounded.jl @@ -1,16 +1,14 @@ using MarkovProcesses include(get_module_path() * "/src/_tests_simulate.jl") -using PyPlot +using Plots load_model("_bench_perf_test/SIR_col_buffer") SIR_col_buffer.time_bound = 100.0 σ = _simulate_col_buffer(SIR_col_buffer) -plt.figure() -plt.step(times(σ), _get_values_col(σ,:I), "ro--", marker="x", where="post", linewidth=1.0) -plt.savefig(get_module_path() * "/test/simulation/res_pics/sim_sir_col_buffer_bounded.svg") -plt.close() +plot(times(σ), _get_values_row(σ,:I), linetype=:steppost, linewidth=1.0) +savefig(get_module_path() * "/test/simulation/res_pics/sim_sir_col_buffer_bounded.svg") return true diff --git a/test/simulation/sim_sir_row_buffer_bounded.jl b/test/simulation/sim_sir_row_buffer_bounded.jl index 329aea5..201d4f6 100644 --- a/test/simulation/sim_sir_row_buffer_bounded.jl +++ b/test/simulation/sim_sir_row_buffer_bounded.jl @@ -1,16 +1,14 @@ using MarkovProcesses include(get_module_path() * "/src/_tests_simulate.jl") -using PyPlot +using Plots load_model("_bench_perf_test/SIR_row_buffer") SIR_row_buffer.time_bound = 100.0 σ = _simulate_row_buffer(SIR_row_buffer) -plt.figure() -plt.step(times(σ), _get_values_row(σ,:I), "ro--", marker="x", where="post", linewidth=1.0) -plt.savefig(get_module_path() * "/test/simulation/res_pics/sim_sir_row_buffer_bounded.svg") -plt.close() +plot(times(σ), _get_values_row(σ,:I), linetype=:steppost, linewidth=1.0) +savefig(get_module_path() * "/test/simulation/res_pics/sim_sir_row_buffer_bounded.svg") return true -- GitLab