Commit 27608a2ff3e4db84f1b59d7b91e5098297b16d9a
1 parent
9afb8a614f
Exists in
master
replace 4 spaces by tabs
Showing 1 changed file with 7 additions and 7 deletions Side-by-side Diff
ringdown.py
... | ... | @@ -8,12 +8,12 @@ |
8 | 8 | data = [] |
9 | 9 | |
10 | 10 | for f in list_files: |
11 | - data_iter = csv.reader(open(f, 'r'), delimiter = ',', quotechar = '"') | |
12 | - for i in range(2): | |
13 | - data_iter.next() | |
14 | - #temp_data = [value for value in data_iter] #if ends with a number | |
15 | - temp_data = [value[:-1] for value in data_iter]#if ends with a comma | |
16 | - data.extend(temp_data) | |
11 | + data_iter = csv.reader(open(f, 'r'), delimiter = ',', quotechar = '"') | |
12 | + for i in range(2): | |
13 | + data_iter.next() | |
14 | + #temp_data = [value for value in data_iter] #if ends with a number | |
15 | + temp_data = [value[:-1] for value in data_iter]#if ends with a comma | |
16 | + data.extend(temp_data) | |
17 | 17 | |
18 | 18 | data = np.asarray(data, dtype = float) |
19 | 19 | |
... | ... | @@ -25,7 +25,7 @@ |
25 | 25 | plt.plot(data[data[:,0]>=0,0], data[data[:,0]>=0,1], label ='mes') |
26 | 26 | |
27 | 27 | def func(t, tau, A, w , a, b): |
28 | - return A * np.exp(-t/tau) * np.sin((w+a*t)*t) + b | |
28 | + return A * np.exp(-t/tau) * np.sin((w+a*t)*t) + b | |
29 | 29 | |
30 | 30 | 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) |
31 | 31 | yfit = func(data[data[:,0]>=0,0], *popt) |