From 15a1f59be622a94042429ac82e4a61f9deda1f4b Mon Sep 17 00:00:00 2001 From: Edoardo Vergerio Date: Sun, 31 May 2026 10:51:01 +0200 Subject: [PATCH] fixed plots between epochs --- metapeg_v2.py | 10 ++++++---- metapeg_v2_unc.py | 9 +++++---- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/metapeg_v2.py b/metapeg_v2.py index e0c23b0..a6de29c 100644 --- a/metapeg_v2.py +++ b/metapeg_v2.py @@ -745,15 +745,17 @@ if __name__ == "__main__": plt.figure() plt.subplot(1,2,1) - plt.plot(objfunc_history[:,0], label="f1 - 1.50 um") - plt.plot(objfunc_history[:,1], label="f2 - 1.55 um") - plt.plot(objfunc_history[:,2], label="f3 - 1.60 um") + line1,line2,line3, = plt.plot(objfunc_history) + plt.xlabel("Iteration") + plt.ylabel("Value") + plt.legend([line1, line2, line3], ["Obj. func. - 1.50 um", "Obj. func. - 1.55 um", "Obj. func. - 1.60 um"]) plt.subplot(1,2,2) plt.plot(epivar_history, label="Epigraph") plt.xlabel("Iteration") plt.ylabel("Value") plt.legend() - plt.savefig("results/optimization_history.pdf") + plt.savefig(f"results/optimization_history_beta{sigmoid_bias}.pdf") + plt.close() saveResults = True if saveResults: diff --git a/metapeg_v2_unc.py b/metapeg_v2_unc.py index 037cacc..bc36cc0 100644 --- a/metapeg_v2_unc.py +++ b/metapeg_v2_unc.py @@ -749,15 +749,16 @@ if __name__ == "__main__": plt.figure() plt.subplot(1,2,1) - plt.plot(objfunc_history[:,0], label="f1 - 1.50 um") - plt.plot(objfunc_history[:,1], label="f2 - 1.55 um") - plt.plot(objfunc_history[:,2], label="f3 - 1.60 um") + line1,line2,line3, = plt.plot(objfunc_history) + plt.xlabel("Iteration") + plt.ylabel("Value") + plt.legend([line1, line2, line3], ["Obj. func. - 1.50 um", "Obj. func. - 1.55 um", "Obj. func. - 1.60 um"]) plt.subplot(1,2,2) plt.plot(epivar_history, label="Epigraph") plt.xlabel("Iteration") plt.ylabel("Value") plt.legend() - plt.savefig("results/optimization_history.pdf") + plt.savefig(f"results/optimization_history_beta{sigmoid_bias}.pdf") plt.close() saveResults = True