diff --git a/pes_to_spec/test/offline_analysis.py b/pes_to_spec/test/offline_analysis.py
index d1191bfae3643e3af4ca8cf0821f0a8d4c95c380..b14f394959d69ba402144e559186254680430110 100755
--- a/pes_to_spec/test/offline_analysis.py
+++ b/pes_to_spec/test/offline_analysis.py
@@ -70,9 +70,9 @@ 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"])
+    unc = np.sqrt(unc_stat**2 + unc_pca**2)
     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)")