tprak

Theoretical Physics Practical Training
git clone git://popovic.xyz/tprak.git
Log | Files | Refs

commit c39b561596629c34b66ddd1bcf7675e589631fff
parent 2ae590c0123a3e613005cd3e586b2fde6170fc2b
Author: miksa <milutin@popovic.xyz>
Date:   Thu,  8 Apr 2021 11:59:25 +0200

plot fix

Diffstat:
Msesh1/prog/Untitled Folder/Untitled.ipynb | 20+++++++++-----------
Dsesh1/prog/automated.png | 0
Msesh1/prog/fit_single.py | 16+++++++++-------
3 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/sesh1/prog/Untitled Folder/Untitled.ipynb b/sesh1/prog/Untitled Folder/Untitled.ipynb @@ -3,7 +3,7 @@ { "cell_type": "code", "execution_count": 6, - "id": "collectible-genius", + "id": "automatic-recommendation", "metadata": {}, "outputs": [], "source": [ @@ -16,14 +16,14 @@ }, { "cell_type": "code", - "execution_count": 20, - "id": "higher-looking", + "execution_count": 22, + "id": "demographic-distributor", "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "d1e1b835069141a68e30bf401c53cdb4", + "model_id": "fdcefe067eeb404086e0067ef6450be9", "version_major": 2, "version_minor": 0 }, @@ -37,10 +37,10 @@ { "data": { "text/plain": [ - "<function __main__.somefunc(m_q=0.7, g_q=0.2, m_w=0.8, g_w=0.2, e_w=0.002, a=-522.9, b=191.4, c=0.5)>" + "<function __main__.somefunc(m_q=0.7, g_q=0.2, m_w=0.8, g_w=0.2, e_w=0.002, a=-500, b=200, c=0.2)>" ] }, - "execution_count": 20, + "execution_count": 22, "metadata": {}, "output_type": "execute_result" } @@ -55,9 +55,7 @@ " part3 = c*(1 + a*s + b*s**2)**2\n", " return part1 * part2 * part3\n", "\n", - "def somefunc(m_q=0.7, g_q=0.2, m_w=0.8, g_w=0.2, e_w=2e-3, a=-522.90, b=191.40, c=0.5):\n", - " data = np.loadtxt('../data/SND-VFF.txt')\n", - " s = data[:,0]\n", + "def somefunc(m_q=0.7, g_q=0.2, m_w=0.8, g_w=0.2, e_w=2e-3, a=-500, b=200, c=0.2): data = np.loadtxt('../data/SND-VFF.txt') s = data[:,0]\n", " F2 = data[:, 1]\n", "\n", " p0 = [m_q, g_q, m_w, g_w, e_w, a, b, c] # in GeV\n", @@ -83,7 +81,7 @@ { "cell_type": "code", "execution_count": null, - "id": "nonprofit-bolivia", + "id": "stock-julian", "metadata": {}, "outputs": [], "source": [] @@ -91,7 +89,7 @@ { "cell_type": "code", "execution_count": null, - "id": "automotive-belgium", + "id": "elect-storm", "metadata": {}, "outputs": [], "source": [] diff --git a/sesh1/prog/automated.png b/sesh1/prog/automated.png Binary files differ. diff --git a/sesh1/prog/fit_single.py b/sesh1/prog/fit_single.py @@ -24,19 +24,21 @@ def main(): popt, pcov = curve_fit(model, s, F2, p0) popt, uncert = np.round(popt, 3), np.round(np.sqrt(np.diagonal(pcov)), 3) + s_model = np.linspace(s[0], s[-1], 500) + plt.figure(figsize=[10, 7]) plt.title('SND DATA FIT') plt.scatter(s, F2, marker='.', c='black') - plt.plot(s, model(s, *popt), color='red') - plt.annotate('Very Bad, A guessing game with the parameters', (0.15, 40)) - plt.annotate(r'No $\omega$ resonance recognized by the fit', (0.15, 35)) + plt.plot(s_model, model(s_model, *popt), color='red') + plt.annotate('A guessing game with the parameters', (0.15, 40)) + plt.annotate(r'$\Gamma_{\omega}$ bad fit', (0.15, 38)) plt.annotate(r'$M_{\rho} = $' + f'({popt[0]}' + r'$\pm$' + f'{uncert[0]}) GeV', (0.7, 40)) - plt.annotate(r'$\Gamma_{\rho} = $' + f'({popt[1]}' + r'$\pm$' + f'{uncert[1]}) GeV', (0.7, 36)) - plt.annotate(r'$M_{\omega} = $' + f'({popt[2]}' + r'$\pm$' + f'{uncert[2]}) GeV', (0.7, 34)) - plt.annotate(r'$\Gamma_{\omega} = $' + f'({popt[3]}' + r'$\pm$' + f'{uncert[3]}) GeV', (0.7, 32)) + plt.annotate(r'$\Gamma_{\rho} = $' + f'({popt[1]}' + r'$\pm$' + f'{uncert[1]}) GeV', (0.7, 38)) + plt.annotate(r'$M_{\omega} = $' + f'({popt[2]}' + r'$\pm$' + f'{uncert[2]}) GeV', (0.7, 36)) + plt.annotate(r'$\Gamma_{\omega} = $' + f'({popt[3]}' + r'$\pm$' + f'{uncert[3]}) GeV', (0.7, 34)) - plt.savefig('automated.png') + plt.savefig('fit_single.png') if __name__ == "__main__":