49
49
plot_calibrated_coeffs(
50
50
batch_name,
51
51
UKI_n_iterations, UKI_n_ensembles, UKI_all_params,
52
+ UKI_mean_each_iter,
52
53
)
53
54
54
55
Plots evolution of calibrated coefficients over the UKI iterations. Plot is saved and returned.
55
56
"""
56
57
function plot_calibrated_coeffs (
57
58
batch_name,
58
59
UKI_n_iterations, UKI_n_ensembles, UKI_all_params,
60
+ UKI_mean_each_iter,
59
61
)
60
- UKI_x_axis = []
62
+
63
+ # Every ensemble member at every iteration
61
64
UKI_m = []
62
65
UKI_c = []
63
-
66
+ UKI_x_axis_ensembles = []
64
67
for iter in 1 : UKI_n_iterations
65
68
for ensemble_n in 1 : UKI_n_ensembles
66
- append! (UKI_x_axis , iter)
69
+ append! (UKI_x_axis_ensembles , iter)
67
70
append! (UKI_m, UKI_all_params[iter][1 , ensemble_n])
68
71
append! (UKI_c, UKI_all_params[iter][2 , ensemble_n])
69
72
end
70
73
end
71
74
72
- calibrated_coeffs_fig = MK. Figure (size = (900 , 600 ), fontsize = 24 )
73
- m_coeff_ax = MK. Axis (calibrated_coeffs_fig[1 , 1 ], ylabel = " m coefficient [-]" , title = " $batch_name " )
75
+ # Mean of each iteration
76
+ UKI_m_mean = []
77
+ UKI_c_mean = []
78
+ UKI_x_axis_mean = []
79
+ for iter in 1 : UKI_n_iterations
80
+ append! (UKI_x_axis_mean, iter)
81
+ append! (UKI_m_mean, UKI_mean_each_iter[iter][1 ])
82
+ append! (UKI_c_mean, UKI_mean_each_iter[iter][2 ])
83
+ end
84
+
85
+ calibrated_coeffs_fig = MK. Figure (size = (900 , 450 ), fontsize = 24 )
86
+ m_coeff_ax = MK. Axis (calibrated_coeffs_fig[1 , 1 ], ylabel = " m coefficient [-]" , xlabel = " Iteration #" )
74
87
c_coeff_ax =
75
- MK. Axis (calibrated_coeffs_fig[1 , 2 ], ylabel = " c coefficient [-]" , xlabel = " iteration # " , title = " Ensemble Mean " )
88
+ MK. Axis (calibrated_coeffs_fig[1 , 2 ], ylabel = " c coefficient [-]" , xlabel = " Iteration # " )
76
89
90
+ MK. Label (
91
+ calibrated_coeffs_fig[0 , :],
92
+ " $batch_name : Calibrating Coefficients" ,
93
+ font = :bold ,
94
+ fontsize = 30 ,
95
+ halign = :center , # Horizontal alignment
96
+ valign = :top # Vertical alignment (relative to its grid cell)
97
+ )
98
+ MK. lines! (
99
+ m_coeff_ax,
100
+ UKI_x_axis_mean,
101
+ UKI_m_mean,
102
+ label = " UKI Mean" ,
103
+ color = :blue ,
104
+ linewidth = 3 ,
105
+ )
77
106
MK. scatter! (
78
107
m_coeff_ax,
79
- UKI_x_axis ,
108
+ UKI_x_axis_ensembles ,
80
109
UKI_m,
81
- label = " UKI" ,
82
- color = (:fuchsia , 0.5 ),
110
+ label = " UKI Ensemble" ,
111
+ color = (:deepskyblue , 0.5 ),
112
+ )
113
+ MK. lines! (
114
+ c_coeff_ax,
115
+ UKI_x_axis_mean,
116
+ UKI_c_mean,
117
+ label = " UKI Mean" ,
118
+ color = :blue ,
119
+ linewidth = 3 ,
83
120
)
84
121
MK. scatter! (
85
122
c_coeff_ax,
86
- UKI_x_axis ,
123
+ UKI_x_axis_ensembles ,
87
124
UKI_c,
88
- label = " UKI" ,
89
- color = (:fuchsia , 0.5 ),
125
+ label = " UKI Ensemble " ,
126
+ color = (:deepskyblue , 0.5 ),
90
127
)
91
128
92
129
# MK.axislegend(m_coeff_ax, framevisible = false, labelsize = 18, position = :rt)
@@ -186,17 +223,17 @@ function plot_compare_ICNC(
186
223
UKI_parcel[9 , :] ./ Nₜ,
187
224
label = " UKI Calibrated" ,
188
225
linewidth = 2.5 ,
189
- color = :fuchsia ,
226
+ color = :blue ,
190
227
)
191
228
error = frozen_frac_moving_mean .* 0.1
192
- MK. errorbars! (ax_compare, t_profile, frozen_frac_moving_mean, error, color = (:blue , 0.3 ))
229
+ MK. errorbars! (ax_compare, t_profile, frozen_frac_moving_mean, error, color = (:gray , 0.3 ))
193
230
MK. lines! (
194
231
ax_compare,
195
232
t_profile,
196
233
frozen_frac,
197
234
label = " Raw AIDA" ,
198
235
linewidth = 2 ,
199
- color = :blue ,
236
+ color = :black ,
200
237
linestyle = :dash ,
201
238
)
202
239
MK. lines! (
@@ -205,7 +242,7 @@ function plot_compare_ICNC(
205
242
frozen_frac_moving_mean,
206
243
label = " AIDA Moving Avg" ,
207
244
linewidth = 2.5 ,
208
- color = :blue ,
245
+ color = :black ,
209
246
)
210
247
211
248
MK. axislegend (ax_compare, framevisible = false , labelsize = 20 , position = :rb )
@@ -355,51 +392,52 @@ function plot_ICNC_overview(overview_data)
355
392
356
393
ax = MK. Axis (position[i], ylabel = " Frozen Fraction [-]" , xlabel = " time [s]" , title = " $exp_name " )
357
394
395
+ uncertainty_up = max_ignore_nan (frozen_frac_moving_mean) * (1 + uncertainty)
396
+ uncertainty_low = max_ignore_nan (frozen_frac_moving_mean) * (1 - uncertainty)
397
+ MK. hspan! (ax, uncertainty_low, uncertainty_up; color = :gray , alpha = 0.3 )
398
+
358
399
MK. lines! (
359
400
ax,
360
401
UKI_parcel. t,
361
402
UKI_parcel[9 , :] ./ Nₜ,
362
403
label = " UKI Calibrated" ,
363
- linewidth = 2.5 ,
364
- color = :fuchsia ,
404
+ linewidth = 3 ,
405
+ color = :blue ,
365
406
)
366
407
MK. lines! (
367
408
ax,
368
409
P3_parcel. t,
369
410
P3_parcel[9 , :] ./ Nₜ,
370
411
label = " CM.jl Parcel (P3)" ,
371
- linewidth = 2.5 ,
372
- color = :green ,
412
+ linewidth = 3 ,
413
+ color = :red ,
373
414
)
374
- error = frozen_frac_moving_mean .* 0.1
375
- MK. errorbars! (ax, t_profile, frozen_frac_moving_mean, error, color = (:blue , 0.3 ))
415
+ # error = frozen_frac_moving_mean .* 0.1
416
+ # MK.errorbars!(ax, t_profile, frozen_frac_moving_mean, error, color = (:gray , 0.3))
376
417
MK. lines! (
377
418
ax,
378
419
t_profile,
379
420
frozen_frac,
380
421
label = " Raw AIDA" ,
381
422
linewidth = 2 ,
382
- color = :blue ,
423
+ color = :black ,
383
424
linestyle = :dash ,
384
425
)
385
426
MK. lines! (
386
427
ax,
387
428
t_profile,
388
429
frozen_frac_moving_mean,
389
430
label = " AIDA Moving Avg" ,
390
- linewidth = 2.5 ,
391
- color = :blue ,
431
+ linewidth = 3 ,
432
+ color = :black ,
392
433
)
393
- uncertainty_up = max_ignore_nan (frozen_frac_moving_mean) * (1 + uncertainty)
394
- uncertainty_low = max_ignore_nan (frozen_frac_moving_mean) * (1 - uncertainty)
395
- MK. hspan! (ax, uncertainty_low, uncertainty_up; color = :green , alpha = 0.3 )
396
434
end
397
435
398
436
legend_axis = MK. Axis (overview_fig[3 , 3 ], title = " Legend" )
399
- MK. lines! (legend_axis, 1 , 1 , label = " CM.jl Parcel (UKI Calibrated) " , color = :fuchsia )
400
- MK. lines! (legend_axis, 1 , 1 , label = " CM.jl Parcel (P3) " , color = :green )
401
- MK. lines! (legend_axis, 1 , 1 , label = " Raw AIDA " , color = :blue , linestyle = :dash )
402
- MK. lines! (legend_axis, 1 , 1 , label = " AIDA Moving Avg " , color = :blue )
437
+ MK. lines! (legend_axis, 1 , 1 , label = " AIDA " , color = :black , linestyle = :dash )
438
+ MK. lines! (legend_axis, 1 , 1 , label = " AIDA Moving Avg " , color = :black )
439
+ MK. lines! (legend_axis, 1 , 1 , label = " CM.jl Parcel (UKI Calibrated) " , color = :blue )
440
+ MK. lines! (legend_axis, 1 , 1 , label = " CM.jl Parcel (P3) " , color = :red )
403
441
MK. axislegend (legend_axis, framevisible = false , labelsize = 18 , position = :rb )
404
442
405
443
MK. hidespines! (legend_axis)
@@ -418,14 +456,14 @@ Plots the difference in loss functions over each iteration of
418
456
function plot_loss_func (batch_name, UKI_n_iterations, UKI_error)
419
457
420
458
loss_fig = MK. Figure (size = (700 , 600 ), fontsize = 24 )
421
- ax_loss = MK. Axis (loss_fig[1 , 1 ], ylabel = " Error [-]" , xlabel = " Iteration [-]" , title = " $batch_name : Error" )
459
+ ax_loss = MK. Axis (loss_fig[1 , 1 ], ylabel = " Error [-]" , xlabel = " Iteration # [-]" , title = " $batch_name : Error" )
422
460
MK. lines! (
423
461
ax_loss,
424
462
collect (1 : (UKI_n_iterations - 1 )),
425
463
UKI_error,
426
464
label = " UKI" ,
427
465
linewidth = 2.5 ,
428
- color = :fuchsia ,
466
+ color = :red ,
429
467
)
430
468
# MK.axislegend(ax_loss, framevisible = false, labelsize = 18, position = :rc)
431
469
MK. save (" $batch_name " * " _loss_fig.svg" , loss_fig)
0 commit comments