From 613012b2de22b69ef6a3fbfca1aec6656754564f Mon Sep 17 00:00:00 2001 From: mer0m Date: Thu, 9 Feb 2017 11:29:58 +0100 Subject: [PATCH] . --- RingDown.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/RingDown.py b/RingDown.py index 532eb11..f2a2179 100644 --- a/RingDown.py +++ b/RingDown.py @@ -11,8 +11,8 @@ for f in list_files: data_iter = csv.reader(open(f, 'r'), delimiter = ',', quotechar = '"') for i in range(2): data_iter.next() - temp_data = [value for value in data_iter] #if ends with a number - #temp_data = [value[:-1] for value in data_iter]#if ends with a comma + #temp_data = [value for value in data_iter] #if ends with a number + temp_data = [value[:-1] for value in data_iter]#if ends with a comma data.extend(temp_data) data = np.asarray(data, dtype = float) @@ -30,6 +30,12 @@ def func(t, tau, A, w , a, b): popt, pcov = curve_fit(func, data[data[:,0]>=0,0], data[data[:,0]>=0,1], p0 = [1e-5, 1e-2, 1e5, 1e10, 1e-4], maxfev=10000) yfit = func(data[data[:,0]>=0,0], *popt) +tau = float(popt[0]) +Q = np.pi*299792458*tau/(2.*140e-3) + +#print(np.sqrt(np.diag(pcov))) +print(tau, Q) + plt.plot(data[data[:,0]>=0,0], yfit, label ='fit') plt.xlabel('t') @@ -37,9 +43,3 @@ plt.ylabel('Intensity') plt.grid(which='both') plt.legend() plt.show() - -tau = float(popt[0]) -Q = np.pi*299792458*tau/(2.*140e-3) - -#print(np.sqrt(np.diag(pcov))) -print(tau, Q) -- 2.16.4