From fc102800db58ac77d0e40fc9e8520b36b8542739 Mon Sep 17 00:00:00 2001 From: bma Date: Thu, 22 Feb 2018 14:30:23 +0100 Subject: [PATCH] better method to get x pos from filename --- fit_waist.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fit_waist.py b/fit_waist.py index 50cc8cf..a557376 100755 --- a/fit_waist.py +++ b/fit_waist.py @@ -1,3 +1,5 @@ +#!/usr/bin/python + from scipy.optimize import curve_fit import csv, numpy, glob from scipy.special import erf @@ -24,7 +26,7 @@ for f in files: '''optimization with non-linear least squares method''' Ppopt, Pcov = curve_fit(P, xmes, Pmes, method = 'trf') - data_waist.append([int(f[-7:-4]), Ppopt[3]]) + data_waist.append([int(f.split('-')[-1].split('.')[0]), Ppopt[3]]) '''plot''' p[0].plot(xmes, Pmes, 'o') -- 2.16.4