From 19ee56dfc62f3dd4025cb8f01484408d36a9c54d Mon Sep 17 00:00:00 2001
From: Stephan Hilb <stephan@ecshi.net>
Date: Wed, 18 Aug 2021 11:47:45 +0200
Subject: [PATCH] use seeded rng for reproducability

---
 scripts/run_experiments.jl | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/scripts/run_experiments.jl b/scripts/run_experiments.jl
index e78258c..1b31e0b 100644
--- a/scripts/run_experiments.jl
+++ b/scripts/run_experiments.jl
@@ -210,7 +210,9 @@ function experiment_convergence_test(ctx)
 
     #noise_σ = 0.1
 
-    #f = clamp.(fo .+ noise_σ * randn(Float64, size(fo)), 0., 1.)
+    #seed = 42
+    #rng = MersenneTwister(seed)
+    #f = clamp.(fo .+ noise_σ * randn(rng, Float64, size(fo)), 0., 1.)
     #saveimg(joinpath(ctx.outdir, "input_noisy.png"), f)
 
     #prob = DenoiseProblem(f; λ, β)
@@ -386,7 +388,9 @@ function experiment_convergence_denoising(ctx)
 
     noise_σ = 0.1
 
-    f = clamp.(fo .+ noise_σ * randn(Float64, size(fo)), 0., 1.)
+    seed = 42
+    rng = MersenneTwister(seed)
+    f = clamp.(fo .+ noise_σ * randn(rng, Float64, size(fo)), 0., 1.)
     saveimg(joinpath(ctx.outdir, "input_noisy.png"), f)
 
     prob = DenoiseProblem(f; λ, β)
@@ -411,7 +415,10 @@ function experiment_convergence_inpainting(ctx)
     M = (2,2)
     overlap = (5,5)
 
-    f_mask = rand(Float64, size(fo)) .> 0.5
+
+    seed = 42
+    rng = MersenneTwister(seed)
+    f_mask = rand(rng, Float64, size(fo)) .> 0.5
 
     prob = InpaintProblem(fo, f_mask; λ, β)
     saveimg(joinpath(ctx.outdir, "input_mask.png"), f_mask)
-- 
GitLab