From 302aee34d6340789be4cda9f209e9e58cafae926 Mon Sep 17 00:00:00 2001 From: alexanderott Date: Wed, 22 Jul 2020 18:06:12 +0200 Subject: [PATCH] add Function to plot histograms of error values --- helperFunctions.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/helperFunctions.py b/helperFunctions.py index ba6c884..c5a3fe2 100644 --- a/helperFunctions.py +++ b/helperFunctions.py @@ -5,6 +5,25 @@ from scipy.optimize import curve_fit import functions as fu from numba import jit import matplotlib.pyplot as plt +import time + + +def plot_errors(list_errors): + names = ["error_bf", "error_vs", "error_sc", "error_f_inf", + "error_f_inf_slope", "error_f_zero", "error_f_zero_s", "f_zero_curve"] + data = np.array(list_errors) + + fig, axes = plt.subplots(2, 4, figsize=(10, 8)) + + for i in range(8): + col = i % 4 + row = int(i/4.0) + + axes[row, col].hist(data[:, i]) + axes[row, col].set_title(names[i]) + + plt.savefig("figures/error_distributions/error_distribution_{}.png".format(time.strftime("%H:%M:%S"))) + plt.close() def fit_clipped_line(x, y):