4949 plot_calibrated_coeffs(
5050 batch_name,
5151 UKI_n_iterations, UKI_n_ensembles, UKI_all_params,
52+ UKI_mean_each_iter,
5253 )
5354
5455Plots evolution of calibrated coefficients over the UKI iterations. Plot is saved and returned.
5556"""
5657function plot_calibrated_coeffs (
5758 batch_name,
5859 UKI_n_iterations, UKI_n_ensembles, UKI_all_params,
60+ UKI_mean_each_iter,
5961)
60- UKI_x_axis = []
62+
63+ # Every ensemble member at every iteration
6164 UKI_m = []
6265 UKI_c = []
63-
66+ UKI_x_axis_ensembles = []
6467 for iter in 1 : UKI_n_iterations
6568 for ensemble_n in 1 : UKI_n_ensembles
66- append! (UKI_x_axis , iter)
69+ append! (UKI_x_axis_ensembles , iter)
6770 append! (UKI_m, UKI_all_params[iter][1 , ensemble_n])
6871 append! (UKI_c, UKI_all_params[iter][2 , ensemble_n])
6972 end
7073 end
7174
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 #" )
7487 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 # " )
7689
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+ )
77106 MK. scatter! (
78107 m_coeff_ax,
79- UKI_x_axis ,
108+ UKI_x_axis_ensembles ,
80109 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 ,
83120 )
84121 MK. scatter! (
85122 c_coeff_ax,
86- UKI_x_axis ,
123+ UKI_x_axis_ensembles ,
87124 UKI_c,
88- label = " UKI" ,
89- color = (:fuchsia , 0.5 ),
125+ label = " UKI Ensemble " ,
126+ color = (:deepskyblue , 0.5 ),
90127 )
91128
92129 # MK.axislegend(m_coeff_ax, framevisible = false, labelsize = 18, position = :rt)
@@ -186,17 +223,17 @@ function plot_compare_ICNC(
186223 UKI_parcel[9 , :] ./ Nₜ,
187224 label = " UKI Calibrated" ,
188225 linewidth = 2.5 ,
189- color = :fuchsia ,
226+ color = :blue ,
190227 )
191228 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 ))
193230 MK. lines! (
194231 ax_compare,
195232 t_profile,
196233 frozen_frac,
197234 label = " Raw AIDA" ,
198235 linewidth = 2 ,
199- color = :blue ,
236+ color = :black ,
200237 linestyle = :dash ,
201238 )
202239 MK. lines! (
@@ -205,7 +242,7 @@ function plot_compare_ICNC(
205242 frozen_frac_moving_mean,
206243 label = " AIDA Moving Avg" ,
207244 linewidth = 2.5 ,
208- color = :blue ,
245+ color = :black ,
209246 )
210247
211248 MK. axislegend (ax_compare, framevisible = false , labelsize = 20 , position = :rb )
@@ -355,51 +392,52 @@ function plot_ICNC_overview(overview_data)
355392
356393 ax = MK. Axis (position[i], ylabel = " Frozen Fraction [-]" , xlabel = " time [s]" , title = " $exp_name " )
357394
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+
358399 MK. lines! (
359400 ax,
360401 UKI_parcel. t,
361402 UKI_parcel[9 , :] ./ Nₜ,
362403 label = " UKI Calibrated" ,
363- linewidth = 2.5 ,
364- color = :fuchsia ,
404+ linewidth = 3 ,
405+ color = :blue ,
365406 )
366407 MK. lines! (
367408 ax,
368409 P3_parcel. t,
369410 P3_parcel[9 , :] ./ Nₜ,
370411 label = " CM.jl Parcel (P3)" ,
371- linewidth = 2.5 ,
372- color = :green ,
412+ linewidth = 3 ,
413+ color = :red ,
373414 )
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))
376417 MK. lines! (
377418 ax,
378419 t_profile,
379420 frozen_frac,
380421 label = " Raw AIDA" ,
381422 linewidth = 2 ,
382- color = :blue ,
423+ color = :black ,
383424 linestyle = :dash ,
384425 )
385426 MK. lines! (
386427 ax,
387428 t_profile,
388429 frozen_frac_moving_mean,
389430 label = " AIDA Moving Avg" ,
390- linewidth = 2.5 ,
391- color = :blue ,
431+ linewidth = 3 ,
432+ color = :black ,
392433 )
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 )
396434 end
397435
398436 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 )
403441 MK. axislegend (legend_axis, framevisible = false , labelsize = 18 , position = :rb )
404442
405443 MK. hidespines! (legend_axis)
@@ -418,14 +456,14 @@ Plots the difference in loss functions over each iteration of
418456function plot_loss_func (batch_name, UKI_n_iterations, UKI_error)
419457
420458 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" )
422460 MK. lines! (
423461 ax_loss,
424462 collect (1 : (UKI_n_iterations - 1 )),
425463 UKI_error,
426464 label = " UKI" ,
427465 linewidth = 2.5 ,
428- color = :fuchsia ,
466+ color = :red ,
429467 )
430468 # MK.axislegend(ax_loss, framevisible = false, labelsize = 18, position = :rc)
431469 MK. save (" $batch_name " * " _loss_fig.svg" , loss_fig)
0 commit comments