From 379e13a75f364d7242fe2c578f8da3c2c772eec2 Mon Sep 17 00:00:00 2001 From: giacomomagni Date: Fri, 17 May 2024 11:18:42 +0200 Subject: [PATCH] some cleaning --- extras/lh_bench_23/plot_bench.py | 49 --------------------------- extras/lh_bench_23/plot_bench_msht.py | 8 ++--- extras/lh_bench_23/plot_trn_exa.py | 23 ++++--------- 3 files changed, 10 insertions(+), 70 deletions(-) delete mode 100644 extras/lh_bench_23/plot_bench.py diff --git a/extras/lh_bench_23/plot_bench.py b/extras/lh_bench_23/plot_bench.py deleted file mode 100644 index d0e69c5bb..000000000 --- a/extras/lh_bench_23/plot_bench.py +++ /dev/null @@ -1,49 +0,0 @@ -from cfg import here, table_dir, xgrid -from utils import ( - compute_n3lo_avg_err, - compute_n3lo_nnlo_diff, - load_n3lo_tables, - load_nnlo_table, - plot_diff_to_nnlo, - plot_pdfs, -) - -USE_LINX = True -REL_DIFF = True -SCHEME = "VFNS" -SV = "central" - -plot_dir = here / "plots" -n3lo_table_dir = table_dir # / SCHEME - - -# load tables -eko_dfs = load_n3lo_tables(n3lo_table_dir, SCHEME, SV, approx="EKO") -fhmruvv_dfs = load_n3lo_tables(n3lo_table_dir, SCHEME, SV, approx="FHMRUVV") -nnlo_central = load_nnlo_table(table_dir, SCHEME, SV) - -# compute avg and std -eko_res = compute_n3lo_avg_err(eko_dfs) -fhmruvv_res = compute_n3lo_avg_err(fhmruvv_dfs) -# eko_4mom_res = = compute_n3lo_avg_err(eko_dfs_4mom) - -n3lo_dfs = [ - (eko_res, "aN3LO EKO"), - (fhmruvv_res, "aN3LO FHMRUVV"), - # (eko_4mom_res, "aN3LO EKO 4 mom"), -] - -# PDFs plots -plot_pdfs(xgrid, n3lo_dfs, nnlo_central, SCHEME, USE_LINX, plot_dir) - -# relative diff plots -eko_diff = compute_n3lo_nnlo_diff(eko_res, nnlo_central, REL_DIFF) -fhmruvv_diff = compute_n3lo_nnlo_diff(fhmruvv_res, nnlo_central, REL_DIFF) -n3lo_dfs = [ - (eko_diff, "aN3LO EKO"), - (fhmruvv_diff, "aN3LO FHMRUVV"), - # (eko_4mom_res, "aN3LO EKO 4 mom"), -] - -# relative, absolute diff plots -plot_diff_to_nnlo(xgrid, n3lo_dfs, SCHEME, USE_LINX, plot_dir, REL_DIFF) diff --git a/extras/lh_bench_23/plot_bench_msht.py b/extras/lh_bench_23/plot_bench_msht.py index fc39e2711..f99c4c613 100644 --- a/extras/lh_bench_23/plot_bench_msht.py +++ b/extras/lh_bench_23/plot_bench_msht.py @@ -10,7 +10,7 @@ ) USE_LINX = False -REL_DIFF = False +REL_DIFF = True SCHEME = "VFNS" SV = "central" @@ -39,14 +39,14 @@ # compute average of FHMRUVV fhmruvv_res = [] for a, b in zip(fhmruvv_msht_res, fhmruvv_eko_res): - fhmruvv_res.append((a + b )/ 2) + fhmruvv_res.append((a + b) / 2) # PDFs plots n3lo_dfs = [ - (eko_res, "EKO"), (fhmruvv_res, "FHMRUVV"), (msht_prior_res, "MSHT (prior)"), (msht_post_res, "MSHT (posterior)"), + (eko_res, "NNPDF"), ] plot_pdfs(xgrid, n3lo_dfs, nnlo_central, SCHEME, USE_LINX, plot_dir) @@ -57,9 +57,9 @@ msht_post_diff = compute_n3lo_nnlo_diff(msht_post_res, nnlo_central, REL_DIFF) n3lo_dfs = [ - (eko_diff, "EKO"), (fhmruvv_diff, "FHMRUVV"), (msht_prior_diff, "MSHT (prior)"), (msht_post_diff, "MSHT (posterior)"), + (eko_diff, "NNPDF"), ] plot_diff_to_nnlo(xgrid, n3lo_dfs, SCHEME, USE_LINX, plot_dir, REL_DIFF) diff --git a/extras/lh_bench_23/plot_trn_exa.py b/extras/lh_bench_23/plot_trn_exa.py index 819c0ebff..7558cedab 100644 --- a/extras/lh_bench_23/plot_trn_exa.py +++ b/extras/lh_bench_23/plot_trn_exa.py @@ -24,27 +24,16 @@ def load_table(method): def plot_diff(xgrid, dfs_trn, dfs_exa): - ncols = 3 - nrows = 1 - fig, axs = plt.subplots(nrows, ncols, figsize=(ncols * 5, nrows * 3.5)) - cut_smallx = 0 cut_largex = -1 xgrid = xgrid[cut_smallx:cut_largex] plot_dir.mkdir(exist_ok=True) - fig.suptitle( - r"\% difference Exact vs Truncated" + r", $\mu_{\rm f}^2 = 10^4 \ \mbox{GeV}^2$" - ) - # loop on PDFs - for i, ax in enumerate( - axs.reshape( - ncols * nrows, - ) - ): - j = np.where(dfs_trn[1].columns == COLUMNS_TO_KEEP[i])[0][0] + for column in COLUMNS_TO_KEEP: + _, ax = plt.subplots(1, 1, figsize=(1 * 5, 1 * 3.5)) + j = np.where(dfs_trn[1].columns == column)[0][0] # loop on ptos for pto, pto_label in PTOS.items(): @@ -64,9 +53,9 @@ def plot_diff(xgrid, dfs_trn, dfs_exa): ax.set_ylabel(f'${lha_labels("FFNS")[j]}$') ax.set_xlim(xgrid.min() - xgrid.min() / 3, 1) - plt.legend() - plt.tight_layout() - plt.savefig(f"{plot_dir}/diff_trn_exa.pdf") + plt.legend() + plt.tight_layout() + plt.savefig(f"{plot_dir}/diff_trn_exa_{column}.pdf") if __name__ == "__main__":