commit b81ec4a689d4b0367155b17c6fc820da48ba4db3 parent b0685730bd32b7f335ae157dabbaa0e8bb1eaea8 Author: miksa <milutin@popovic.xyz> Date: Sat, 10 Apr 2021 14:07:18 +0200 minor corrections Diffstat:
18 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/sesh1/prog/standard-method/__pycache__/model.cpython-39.pyc b/sesh1/prog/standard-method/__pycache__/model.cpython-39.pyc Binary files differ. diff --git a/sesh1/prog/standard-method/model.py b/sesh1/prog/standard-method/model.py @@ -23,8 +23,8 @@ def myplot(name, x_data, y_data, p, dp, sigma): plt.figure(figsize=[10, 7]) plt.title(f'{name} DATA FIT') - plt.errorbar(x_data, y_data, yerr=sigma, fmt='.k', c='black') - plt.plot(x_model, y_model, color='red') + plt.errorbar(x_data, y_data, yerr=sigma, fmt='.k', c='black', label=f'{name}') + plt.plot(x_model, y_model, color='red', label='fit') p, dp = np.round(p, 3), np.round(dp, 3) plt.annotate(r'$M_{\rho} = $' + f'({p[0]}' + r'$\pm$' + f'{dp[0]}) GeV', (0.2, 40)) @@ -34,7 +34,7 @@ def myplot(name, x_data, y_data, p, dp, sigma): plt.title(f't0-Singlefit of {name}') plt.ylabel(r'$|F_{\pi}^V(s)|^2|$') - plt.xlabel(r'$\sqrt(s)$[GeV]') + plt.xlabel(r'$\sqrt{s}$[GeV]') plt.legend(loc='best') plt.savefig(f'./plots/{name}.png') diff --git a/sesh1/prog/standard-method/plots/BABAR.png b/sesh1/prog/standard-method/plots/BABAR.png Binary files differ. diff --git a/sesh1/prog/standard-method/plots/CMD2.png b/sesh1/prog/standard-method/plots/CMD2.png Binary files differ. diff --git a/sesh1/prog/standard-method/plots/KLOE.png b/sesh1/prog/standard-method/plots/KLOE.png Binary files differ. diff --git a/sesh1/prog/standard-method/plots/SND.png b/sesh1/prog/standard-method/plots/SND.png Binary files differ. diff --git a/sesh1/prog/t0-method/__pycache__/method.cpython-39.pyc b/sesh1/prog/t0-method/__pycache__/method.cpython-39.pyc Binary files differ. diff --git a/sesh1/prog/t0-method/__pycache__/model.cpython-39.pyc b/sesh1/prog/t0-method/__pycache__/model.cpython-39.pyc Binary files differ. diff --git a/sesh1/prog/t0-method/method.py b/sesh1/prog/t0-method/method.py @@ -16,7 +16,7 @@ def f2_lambda(model, var): return f2_f def t0_fit(model, var_str, x_data, y_data,\ - p0, cov_stat, cov_relsyst, iterations=100): + p0, cov_stat, cov_relsyst, iterations=100, alpha=0.1): var = sp.Matrix(sp.symbols(var_str)) A_func = design_matrix(model, var) @@ -29,7 +29,7 @@ def t0_fit(model, var_str, x_data, y_data,\ P = np.linalg.inv(cov_relsyst @ np.outer(f2, f2) + cov_stat) delta_p = np.linalg.inv(A.T @ P @ A) @ A.T @ P @ (y_data - f2) - p0 = p0 + 0.1*delta_p + p0 = p0 + alpha*delta_p print(f"{i} Iterations completed") print('Done\n') diff --git a/sesh1/prog/t0-method/model.py b/sesh1/prog/t0-method/model.py @@ -42,7 +42,7 @@ def my_plot(name, x_data, y_data, p, dp, sigma): plt.title(f't0-Singlefit of {name}') plt.legend(loc='best') plt.ylabel(r'$|F_{\pi}^V(s)|^2|$') - plt.xlabel(r'$\sqrt(s)$[GeV]') + plt.xlabel(r'$\sqrt{s}$[GeV]') plt.savefig(f'./plots/{name}.png') plt.close() diff --git a/sesh1/prog/t0-method/multiple_fit.py b/sesh1/prog/t0-method/multiple_fit.py @@ -11,6 +11,7 @@ global p0; p0 = [0.9, 0.2, 0.81, 0.04, 0.02, -1, 0.84, 1.55] # in GeV def main(): + # Preparation SND_data = np.loadtxt('../data/SND-VFF.txt') SND_x = SND_data[:, 0] SND_y = SND_data[:, 1] @@ -50,9 +51,12 @@ def main(): cov_relsyst = block_diag(SND_relsystcov, CMD2_relsystcov, KLOE_relsystcov, BABAR_relsystcov) var_str = "m_q g_q m_w g_w e_w a b c" + # Fit p, dp = t0_fit(model, var_str, x_data, y_data, p0, cov_stat,\ cov_relsyst) + + # Plot x_model = np.linspace(x_data[0], x_data[-1], 500) x = sp.symbols('x') la_mod = model(x, *p) diff --git a/sesh1/prog/t0-method/plots/BABAR-fit.png b/sesh1/prog/t0-method/plots/BABAR-fit.png Binary files differ. diff --git a/sesh1/prog/t0-method/plots/BABAR.png b/sesh1/prog/t0-method/plots/BABAR.png Binary files differ. diff --git a/sesh1/prog/t0-method/plots/CMD2-fit.png b/sesh1/prog/t0-method/plots/CMD2-fit.png Binary files differ. diff --git a/sesh1/prog/t0-method/plots/KLOE-fit.png b/sesh1/prog/t0-method/plots/KLOE-fit.png Binary files differ. diff --git a/sesh1/prog/t0-method/plots/SND-fit.png b/sesh1/prog/t0-method/plots/SND-fit.png Binary files differ. diff --git a/sesh1/prog/t0-method/plots/all-fit.png b/sesh1/prog/t0-method/plots/all-fit.png Binary files differ. diff --git a/sesh1/prog/t0-method/single_fit.py b/sesh1/prog/t0-method/single_fit.py @@ -74,7 +74,7 @@ def BABAR(): cov_relsyst) sigma = np.sqrt(np.diag(cov_stat)) - my_plot('BABAR-fit', x_data, y_data, p, dp, sigma) + my_plot('BABAR', x_data, y_data, p, dp, sigma) def main(): SND()