Skip to content
Snippets Groups Projects
Commit 787238bc authored by Danilo Ferreira de Lima's avatar Danilo Ferreira de Lima
Browse files

Smoothing the spectrum in test

parent 59e00499
No related branches found
No related tags found
No related merge requests found
......@@ -70,18 +70,20 @@ def plot_result(filename: str, spec_pred: Dict[str, np.ndarray], spec_smooth: np
ax = fig.add_subplot(gs[0, 0])
unc_stat = np.mean(spec_pred["unc"])
unc_pca = np.mean(spec_pred["pca"])
#ax.plot(spec_raw_pe, spec_smooth, c='b', lw=3, label="High-resolution measurement (smoothened)")
ax.plot(spec_raw_pe, spec_smooth, c='b', lw=3, label="High-resolution measurement (smoothened)")
ax.plot(spec_raw_pe, spec_pred["expected"], c='r', lw=3, label="High-resolution prediction")
unc = np.sqrt(spec_pred["unc"]**2 + spec_pred["pca"]**2)
ax.fill_between(spec_raw_pe, spec_pred["expected"] - unc, spec_pred["expected"] + unc, facecolor='red', alpha=0.6, label="68% unc.")
#ax.fill_between(spec_raw_pe, spec_pred["expected"] - spec_pred["unc"], spec_pred["expected"] + spec_pred["unc"], facecolor='red', alpha=0.6, label="68% unc. (stat.)")
#ax.fill_between(spec_raw_pe, spec_pred["expected"] - spec_pred["pca"], spec_pred["expected"] + spec_pred["pca"], facecolor='magenta', alpha=0.6, label="68% unc. (syst., PCA)")
if spec_raw_int is not None:
ax.plot(spec_raw_pe, spec_raw_int, c='b', lw=1, ls='--', label="High-resolution measurement")
#if spec_raw_int is not None:
# ax.plot(spec_raw_pe, spec_raw_int, c='b', lw=1, ls='--', label="High-resolution measurement")
ax.legend(frameon=False, borderaxespad=0)
Y = np.amax(spec_smooth)
ax.set(title=f"", #avg(stat unc) = {unc_stat}, avg(pca unc) = {unc_pca}",
xlabel="Photon energy [eV]",
ylabel="Intensity")
ylabel="Intensity",
ylim=(0, 1.3*Y))
fig.savefig(filename)
plt.close(fig)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment