Commit fc102800db58ac77d0e40fc9e8520b36b8542739
1 parent
8b2c182ee1
Exists in
master
better method to get x pos from filename
Showing 1 changed file with 3 additions and 1 deletions Side-by-side Diff
fit_waist.py
1 | +#!/usr/bin/python | |
2 | + | |
1 | 3 | from scipy.optimize import curve_fit |
2 | 4 | import csv, numpy, glob |
3 | 5 | from scipy.special import erf |
... | ... | @@ -24,7 +26,7 @@ |
24 | 26 | |
25 | 27 | '''optimization with non-linear least squares method''' |
26 | 28 | Ppopt, Pcov = curve_fit(P, xmes, Pmes, method = 'trf') |
27 | - data_waist.append([int(f[-7:-4]), Ppopt[3]]) | |
29 | + data_waist.append([int(f.split('-')[-1].split('.')[0]), Ppopt[3]]) | |
28 | 30 | |
29 | 31 | '''plot''' |
30 | 32 | p[0].plot(xmes, Pmes, 'o') |