Skip to content
Snippets Groups Projects
Unverified Commit b29ea645 authored by Dmitry Kalinkin's avatar Dmitry Kalinkin Committed by GitHub
Browse files

benchmarks/*: use xaxis.labellocation, yaxis.labellocation (#57)

parent 308a5f29
Branches
No related tags found
No related merge requests found
...@@ -42,6 +42,8 @@ def setup_presentation_style(): ...@@ -42,6 +42,8 @@ def setup_presentation_style():
'legend.loc': 'upper right', 'legend.loc': 'upper right',
'xtick.labelsize': 8, 'xtick.labelsize': 8,
'ytick.labelsize': 8, 'ytick.labelsize': 8,
'xaxis.labellocation': 'right',
'yaxis.labellocation': 'top',
'pgf.rcfonts': False, 'pgf.rcfonts': False,
}) })
...@@ -232,8 +234,8 @@ for collection_name in ["EcalEndcapNHits", "EcalEndcapPHits"]: ...@@ -232,8 +234,8 @@ for collection_name in ["EcalEndcapNHits", "EcalEndcapPHits"]:
) )
plt.colorbar().set_label("energy, GeV", loc="top") plt.colorbar().set_label("energy, GeV", loc="top")
plt.title(f"{label}, event_id={event_id}\n{collection_name}") plt.title(f"{label}, event_id={event_id}\n{collection_name}")
plt.xlabel("hit x, mm", loc="right") plt.xlabel("hit x, mm")
plt.ylabel("hit y, mm", loc="top") plt.ylabel("hit y, mm")
plt.savefig(output_dir / f"{collection_name}_event_display_{dataset_ix}.png", bbox_inches="tight") plt.savefig(output_dir / f"{collection_name}_event_display_{dataset_ix}.png", bbox_inches="tight")
plt.show() plt.show()
plt.clf() plt.clf()
...@@ -286,9 +288,9 @@ for collection_name in ["EcalEndcapNHits", "EcalEndcapPHits"]: ...@@ -286,9 +288,9 @@ for collection_name in ["EcalEndcapNHits", "EcalEndcapPHits"]:
plt.title(f"{collection_name}") plt.title(f"{collection_name}")
plt.legend() plt.legend()
plt.xlabel("r, mm", loc="right") plt.xlabel("r, mm")
dr = (r_axis.edges[1] - r_axis.edges[0]) dr = (r_axis.edges[1] - r_axis.edges[0])
plt.ylabel(f"Number of towers per {dr} mm slice in $r$", loc="top") plt.ylabel(f"Number of towers per {dr} mm slice in $r$")
plt.savefig(output_dir / f"{collection_name}_num_towers.png", bbox_inches="tight") plt.savefig(output_dir / f"{collection_name}_num_towers.png", bbox_inches="tight")
plt.show() plt.show()
plt.clf() plt.clf()
...@@ -326,8 +328,8 @@ for collection_name in ["EcalEndcapNHits", "EcalEndcapPHits"]: ...@@ -326,8 +328,8 @@ for collection_name in ["EcalEndcapNHits", "EcalEndcapPHits"]:
plt.title(f"for $E_{{dep.}} >$ {edep_min * 1000} MeV\n{collection_name}") plt.title(f"for $E_{{dep.}} >$ {edep_min * 1000} MeV\n{collection_name}")
plt.legend() plt.legend()
plt.xlabel("r, mm", loc="right") plt.xlabel("r, mm")
plt.ylabel("rate per tower, Hz", loc="top") plt.ylabel("rate per tower, Hz")
plt.yscale("log") plt.yscale("log")
plt.savefig(output_dir / f"{collection_name}_hit_rate_vs_r_edep_min_{edep_min:.3f}.png", bbox_inches="tight") plt.savefig(output_dir / f"{collection_name}_hit_rate_vs_r_edep_min_{edep_min:.3f}.png", bbox_inches="tight")
plt.show() plt.show()
...@@ -357,8 +359,8 @@ for collection_name in ["EcalEndcapNHits", "EcalEndcapPHits"]: ...@@ -357,8 +359,8 @@ for collection_name in ["EcalEndcapNHits", "EcalEndcapPHits"]:
plt.title(rf"for events with $E_{{\mathrm{{dep. tot.}}}}$ $>$ {totedep_min} GeV" + f"\n{collection_name}") plt.title(rf"for events with $E_{{\mathrm{{dep. tot.}}}}$ $>$ {totedep_min} GeV" + f"\n{collection_name}")
plt.legend() plt.legend()
plt.xlabel("$z$ of the first interaction vertex, mm", loc="right") plt.xlabel("$z$ of the first interaction vertex, mm")
plt.ylabel("rate, Hz", loc="top") plt.ylabel("rate, Hz")
plt.yscale("log") plt.yscale("log")
plt.savefig(output_dir / f"{collection_name}_hit_rate_vs_z_totedep_min_{totedep_min:.1f}.png", bbox_inches="tight") plt.savefig(output_dir / f"{collection_name}_hit_rate_vs_z_totedep_min_{totedep_min:.1f}.png", bbox_inches="tight")
plt.show() plt.show()
...@@ -438,7 +440,7 @@ for edep_min in [0]: # GeV ...@@ -438,7 +440,7 @@ for edep_min in [0]: # GeV
plt.sca(ax_cur) plt.sca(ax_cur)
plt.legend() plt.legend()
plt.title(f"for $E_{{dep.}} >$ {edep_min * 1000} MeV") plt.title(f"for $E_{{dep.}} >$ {edep_min * 1000} MeV")
plt.ylabel("rate, Hz", loc="top") plt.ylabel("rate, Hz")
plt.yscale("log") plt.yscale("log")
plt.xticks(rotation=90, ha='right') plt.xticks(rotation=90, ha='right')
fig_cur.savefig(f"rates_edep_min_{edep_min}_{dataset_ix}.png", bbox_inches="tight") fig_cur.savefig(f"rates_edep_min_{edep_min}_{dataset_ix}.png", bbox_inches="tight")
...@@ -448,7 +450,7 @@ for edep_min in [0]: # GeV ...@@ -448,7 +450,7 @@ for edep_min in [0]: # GeV
plt.sca(ax_cmb) plt.sca(ax_cmb)
plt.legend() plt.legend()
plt.title(f"for $E_{{dep.}} >$ {edep_min * 1000} MeV") plt.title(f"for $E_{{dep.}} >$ {edep_min * 1000} MeV")
plt.ylabel("rate per tower, Hz", loc="top") plt.ylabel("rate per tower, Hz")
plt.yscale("log") plt.yscale("log")
plt.xticks(rotation=90, ha='right') plt.xticks(rotation=90, ha='right')
fig_cmb.savefig(f"rates_edep_min_{edep_min}.png", bbox_inches="tight") fig_cmb.savefig(f"rates_edep_min_{edep_min}.png", bbox_inches="tight")
......
...@@ -43,6 +43,8 @@ def setup_presentation_style(): ...@@ -43,6 +43,8 @@ def setup_presentation_style():
'legend.fontsize': 7, 'legend.fontsize': 7,
'xtick.labelsize': 8, 'xtick.labelsize': 8,
'ytick.labelsize': 8, 'ytick.labelsize': 8,
'xaxis.labellocation': 'right',
'yaxis.labellocation': 'top',
'pgf.rcfonts': False, 'pgf.rcfonts': False,
}) })
...@@ -149,8 +151,8 @@ for ix, energy in enumerate(energies): ...@@ -149,8 +151,8 @@ for ix, energy in enumerate(energies):
plt.hist(pi_pred, weights=np.full_like(pi_pred, 1.0 / ak.num(pi_pred, axis=0)), bins=np.linspace(0., 1.01, 101), label=rf"$\pi^-$ {clf_label}", histtype="step") plt.hist(pi_pred, weights=np.full_like(pi_pred, 1.0 / ak.num(pi_pred, axis=0)), bins=np.linspace(0., 1.01, 101), label=rf"$\pi^-$ {clf_label}", histtype="step")
plt.title(f"{energy}") plt.title(f"{energy}")
plt.legend() plt.legend()
plt.xlabel("Classifier output", loc="right") plt.xlabel("Classifier output")
plt.ylabel("Event yield", loc="top") plt.ylabel("Event yield")
if do_log: if do_log:
plt.yscale("log") plt.yscale("log")
...@@ -170,8 +172,8 @@ for ix, energy in enumerate(energies): ...@@ -170,8 +172,8 @@ for ix, energy in enumerate(energies):
plt.yscale("log") plt.yscale("log")
plt.title(f"{energy}") plt.title(f"{energy}")
plt.legend(loc="lower left") plt.legend(loc="lower left")
plt.xlabel("Electron efficiency, %", loc="right") plt.xlabel("Electron efficiency, %")
plt.ylabel("Pion rejection factor", loc="top") plt.ylabel("Pion rejection factor")
fig.savefig(output_dir / f"pred.pdf", bbox_inches="tight") fig.savefig(output_dir / f"pred.pdf", bbox_inches="tight")
plt.close(fig) plt.close(fig)
...@@ -191,8 +193,8 @@ for clf_label, roc in rocs.items(): ...@@ -191,8 +193,8 @@ for clf_label, roc in rocs.items():
plt.yscale("log") plt.yscale("log")
plt.title(INPUT_PATH_FORMAT) plt.title(INPUT_PATH_FORMAT)
plt.legend() plt.legend()
plt.xlabel("Energy, GeV", loc="right") plt.xlabel("Energy, GeV")
plt.ylabel("Pion rejection at 95%", loc="top") plt.ylabel("Pion rejection at 95%")
plt.savefig(output_dir / f"pion_rej.pdf", bbox_inches="tight") plt.savefig(output_dir / f"pion_rej.pdf", bbox_inches="tight")
plt.show() plt.show()
#+end_src #+end_src
...@@ -39,6 +39,8 @@ def setup_presentation_style(): ...@@ -39,6 +39,8 @@ def setup_presentation_style():
'legend.fontsize': 7, 'legend.fontsize': 7,
'xtick.labelsize': 8, 'xtick.labelsize': 8,
'ytick.labelsize': 8, 'ytick.labelsize': 8,
'xaxis.labellocation': 'right',
'yaxis.labellocation': 'top',
'pgf.rcfonts': False, 'pgf.rcfonts': False,
}) })
...@@ -153,8 +155,8 @@ for energy in ["500MeV", "5GeV", "20GeV"]: ...@@ -153,8 +155,8 @@ for energy in ["500MeV", "5GeV", "20GeV"]:
std = np.sqrt(profile.variances()) std = np.sqrt(profile.variances())
cond = profile.values() > std cond = profile.values() > std
plt.errorbar(profile.axes[0].centers[cond], profile.values()[cond], yerr=std[cond], marker=".", markersize=2, color="black", ls="none", lw=0.6, capsize=1.) plt.errorbar(profile.axes[0].centers[cond], profile.values()[cond], yerr=std[cond], marker=".", markersize=2, color="black", ls="none", lw=0.6, capsize=1.)
plt.xlabel(r"$\eta_{thrown}$", loc="right") plt.xlabel(r"$\eta_{thrown}$")
plt.ylabel(r"$\sum E_{\mathrm{dep.}} / p_{\mathrm{thrown}}$", loc="top") plt.ylabel(r"$\sum E_{\mathrm{dep.}} / p_{\mathrm{thrown}}$")
plt.title(f"{energy} {particle} in {calo_name}") plt.title(f"{energy} {particle} in {calo_name}")
plt.minorticks_on() plt.minorticks_on()
plt.savefig(output_dir / f"ecal_gap_{particle}_{energy}_{calo_name}.png", bbox_inches="tight") plt.savefig(output_dir / f"ecal_gap_{particle}_{energy}_{calo_name}.png", bbox_inches="tight")
...@@ -211,8 +213,8 @@ for energy in ["500MeV", "5GeV", "20GeV"]: ...@@ -211,8 +213,8 @@ for energy in ["500MeV", "5GeV", "20GeV"]:
std = np.sqrt(profile.variances()) std = np.sqrt(profile.variances())
cond = profile.values() > std cond = profile.values() > std
plt.errorbar(profile.axes[0].centers[cond], profile.values()[cond], yerr=std[cond], marker=".", markersize=2, color="black", ls="none", lw=0.6, capsize=1.) plt.errorbar(profile.axes[0].centers[cond], profile.values()[cond], yerr=std[cond], marker=".", markersize=2, color="black", ls="none", lw=0.6, capsize=1.)
plt.xlabel(r"$\eta_{thrown}$", loc="right") plt.xlabel(r"$\eta_{thrown}$")
plt.ylabel(r"$\sum E_{\mathrm{dep.}} / p_{\mathrm{thrown}}$", loc="top") plt.ylabel(r"$\sum E_{\mathrm{dep.}} / p_{\mathrm{thrown}}$")
plt.title(f"{energy} {particle}\n" + "+".join(calos)) plt.title(f"{energy} {particle}\n" + "+".join(calos))
plt.minorticks_on() plt.minorticks_on()
plt.savefig(output_dir / f"ecal_gap_{particle}_{energy}_sum_all.png", bbox_inches="tight") plt.savefig(output_dir / f"ecal_gap_{particle}_{energy}_sum_all.png", bbox_inches="tight")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment