@@ -94,8 +94,8 @@ prior_N0 = constrained_gaussian(param_names[1], 400, 300, 0.4 * N0_true, Inf)
9494prior_θ = constrained_gaussian(param_names[2 ], 1.0 , 5.0 , 1e-1 , Inf )
9595prior_k = constrained_gaussian(param_names[3 ], 0.2 , 1.0 , 1e-4 , Inf )
9696priors = combine_distributions([prior_N0, prior_θ, prior_k])
97- # Plot the priors
98- p = plot(priors, constrained = false )
97+ # Plots. Plot the priors
98+ p = Plots . plot(priors, constrained = false )
9999savefig(p, output_directory * " cloudy_priors.png" )
100100
101101# ##
@@ -160,7 +160,7 @@ dummy = ones(n_params)
160160dist_type = ParticleDistributions. GammaPrimitiveParticleDistribution(dummy... )
161161model_settings = DynamicalModel. ModelSettings(kernel, dist_type, moments, tspan)
162162# EKI iterations
163- n_iter = N_iter
163+ n_iter = [ N_iter]
164164for n in 1 : N_iter
165165 # Return transformed parameters in physical/constrained space
166166 ϕ_n = get_ϕ_final(priors, ekiobj)
@@ -169,12 +169,12 @@ for n in 1:N_iter
169169 G_ens = hcat(G_n... ) # reformat
170170 terminate = EnsembleKalmanProcesses. update_ensemble!(ekiobj, G_ens)
171171 if ! isnothing(terminate)
172- n_iter = n - 1
172+ n_iter[ 1 ] = n - 1
173173 break
174174 end
175175
176176end
177-
177+ n_iter = n_iter[ 1 ]
178178
179179# EKI results: Has the ensemble collapsed toward the truth?
180180θ_true = transform_constrained_to_unconstrained(priors, ϕ_true)
@@ -211,8 +211,14 @@ u_init = get_u_prior(ekiobj)
211211anim_eki_unconst_cloudy = @animate for i in 1 : (n_iter - 1 )
212212 u_i = get_u(ekiobj, i)
213213
214- p1 = plot(u_i[1 , :], u_i[2 , :], seriestype = :scatter, xlims = extrema(u_init[1 , :]), ylims = extrema(u_init[2 , :]))
215- plot!(
214+ p1 = Plots. plot(
215+ u_i[1 , :],
216+ u_i[2 , :],
217+ seriestype = :scatter,
218+ xlims = extrema(u_init[1 , :]),
219+ ylims = extrema(u_init[2 , :]),
220+ )
221+ Plots. plot!(
216222 p1,
217223 [θ_true[1 ]],
218224 xaxis = " u1" ,
@@ -224,10 +230,16 @@ anim_eki_unconst_cloudy = @animate for i in 1:(n_iter - 1)
224230 margin = 5 mm,
225231 title = " EKI iteration = " * string(i),
226232 )
227- plot!(p1, [θ_true[2 ]], seriestype = " hline" , linestyle = :dash, linecolor = :red, label = " optimum" )
228-
229- p2 = plot(u_i[2 , :], u_i[3 , :], seriestype = :scatter, xlims = extrema(u_init[2 , :]), ylims = extrema(u_init[3 , :]))
230- plot!(
233+ Plots. plot!(p1, [θ_true[2 ]], seriestype = " hline" , linestyle = :dash, linecolor = :red, label = " optimum" )
234+
235+ p2 = Plots. plot(
236+ u_i[2 , :],
237+ u_i[3 , :],
238+ seriestype = :scatter,
239+ xlims = extrema(u_init[2 , :]),
240+ ylims = extrema(u_init[3 , :]),
241+ )
242+ Plots. plot!(
231243 p2,
232244 [θ_true[2 ]],
233245 xaxis = " u2" ,
@@ -240,10 +252,16 @@ anim_eki_unconst_cloudy = @animate for i in 1:(n_iter - 1)
240252 title = " EKI iteration = " * string(i),
241253 )
242254
243- plot!(p2, [θ_true[3 ]], seriestype = " hline" , linestyle = :dash, linecolor = :red, label = " optimum" )
255+ Plots . plot!(p2, [θ_true[3 ]], seriestype = " hline" , linestyle = :dash, linecolor = :red, label = " optimum" )
244256
245- p3 = plot(u_i[3 , :], u_i[1 , :], seriestype = :scatter, xlims = extrema(u_init[3 , :]), ylims = extrema(u_init[1 , :]))
246- plot!(
257+ p3 = Plots. plot(
258+ u_i[3 , :],
259+ u_i[1 , :],
260+ seriestype = :scatter,
261+ xlims = extrema(u_init[3 , :]),
262+ ylims = extrema(u_init[1 , :]),
263+ )
264+ Plots. plot!(
247265 p3,
248266 [θ_true[3 ]],
249267 xaxis = " u3" ,
@@ -256,9 +274,9 @@ anim_eki_unconst_cloudy = @animate for i in 1:(n_iter - 1)
256274 title = " EKI iteration = " * string(i),
257275 )
258276
259- plot!(p3, [θ_true[1 ]], seriestype = " hline" , linestyle = :dash, linecolor = :red, label = " optimum" )
277+ Plots . plot!(p3, [θ_true[1 ]], seriestype = " hline" , linestyle = :dash, linecolor = :red, label = " optimum" )
260278
261- p = plot(p1, p2, p3, layout = (1 , 3 ))
279+ p = Plots . plot(p1, p2, p3, layout = (1 , 3 ))
262280end
263281
264282gif(anim_eki_unconst_cloudy, joinpath(output_directory, " cloudy_eki_unconstr.gif" ), fps = 1 ) # hide
@@ -268,8 +286,14 @@ gif(anim_eki_unconst_cloudy, joinpath(output_directory, "cloudy_eki_unconstr.gif
268286anim_eki_cloudy = @animate for i in 1 : (n_iter - 1 )
269287 ϕ_i = get_ϕ(priors, ekiobj, i)
270288
271- p1 = plot(ϕ_i[1 , :], ϕ_i[2 , :], seriestype = :scatter, xlims = extrema(ϕ_init[1 , :]), ylims = extrema(ϕ_init[2 , :]))
272- plot!(
289+ p1 = Plots. plot(
290+ ϕ_i[1 , :],
291+ ϕ_i[2 , :],
292+ seriestype = :scatter,
293+ xlims = extrema(ϕ_init[1 , :]),
294+ ylims = extrema(ϕ_init[2 , :]),
295+ )
296+ Plots. plot!(
273297 p1,
274298 [ϕ_true[1 ]],
275299 xaxis = " ϕ1" ,
@@ -282,11 +306,17 @@ anim_eki_cloudy = @animate for i in 1:(n_iter - 1)
282306 title = " EKI iteration = " * string(i),
283307 )
284308
285- plot!(p1, [ϕ_true[2 ]], seriestype = " hline" , linestyle = :dash, linecolor = :red, label = " optimum" )
309+ Plots . plot!(p1, [ϕ_true[2 ]], seriestype = " hline" , linestyle = :dash, linecolor = :red, label = " optimum" )
286310
287- p2 = plot(ϕ_i[2 , :], ϕ_i[3 , :], seriestype = :scatter, xlims = extrema(ϕ_init[2 , :]), ylims = extrema(ϕ_init[3 , :]))
311+ p2 = Plots. plot(
312+ ϕ_i[2 , :],
313+ ϕ_i[3 , :],
314+ seriestype = :scatter,
315+ xlims = extrema(ϕ_init[2 , :]),
316+ ylims = extrema(ϕ_init[3 , :]),
317+ )
288318
289- plot!(
319+ Plots . plot!(
290320 p2,
291321 [ϕ_true[2 ]],
292322 xaxis = " ϕ2" ,
@@ -299,10 +329,16 @@ anim_eki_cloudy = @animate for i in 1:(n_iter - 1)
299329 title = " EKI iteration = " * string(i),
300330 )
301331
302- plot!(p2, [ϕ_true[3 ]], seriestype = " hline" , linestyle = :dash, linecolor = :red, label = " optimum" )
332+ Plots . plot!(p2, [ϕ_true[3 ]], seriestype = " hline" , linestyle = :dash, linecolor = :red, label = " optimum" )
303333
304- p3 = plot(ϕ_i[3 , :], ϕ_i[1 , :], seriestype = :scatter, xlims = extrema(ϕ_init[3 , :]), ylims = extrema(ϕ_init[1 , :]))
305- plot!(
334+ p3 = Plots. plot(
335+ ϕ_i[3 , :],
336+ ϕ_i[1 , :],
337+ seriestype = :scatter,
338+ xlims = extrema(ϕ_init[3 , :]),
339+ ylims = extrema(ϕ_init[1 , :]),
340+ )
341+ Plots. plot!(
306342 p3,
307343 [ϕ_true[3 ]],
308344 xaxis = " ϕ3" ,
@@ -314,9 +350,9 @@ anim_eki_cloudy = @animate for i in 1:(n_iter - 1)
314350 label = false ,
315351 title = " EKI iteration = " * string(i),
316352 )
317- plot!(p3, [ϕ_true[1 ]], seriestype = " hline" , linestyle = :dash, linecolor = :red, label = " optimum" )
353+ Plots . plot!(p3, [ϕ_true[1 ]], seriestype = " hline" , linestyle = :dash, linecolor = :red, label = " optimum" )
318354
319- p = plot(p1, p2, p3, layout = (1 , 3 ))
355+ p = Plots . plot(p1, p2, p3, layout = (1 , 3 ))
320356
321357end
322358
0 commit comments