Ks = []
for i in range(len(Kcuts)+1):
Ks.append([])
- for line in file(datafile, 'r'):
+ for line in open(datafile, 'r'):
if line[0] == '#':
continue # ignore comments
fields = line.strip().split('\t')
avgK = [0]*len(Ks)
stdK = [0]*len(Ks)
numK = [0]*len(Ks)
- kf = file(kfile, 'w')
+ kf = open(kfile, 'w')
for i in range(len(Ks)):
K = numpy.array(Ks[i])
avgK[i] = K.mean()
def write_average_file(FofV, avgK, avgfile=AVGFILE):
Vs = FofV.keys()
Vs.sort()
- af = file(AVGFILE, 'w')
+ af = open(AVGFILE, 'w')
print >> af, '#'+'\t'.join(\
['Pulling speed (nm/s)','Spring constant (pN/nm)',
'Mean force (pN)','Std. force (pN)','Events (#)'])
w = [] # weights
print >> sys.stderr, "Fitting data from", fname
-for line in file(fname, 'r'):
+for line in open(fname, 'r'):
fields = [float(a) for a in line.strip().split()]
if WEIGHTHACK==True:
w = int(fields[3])
for i,K in enumerate(Ks):
if K == None:
continue
- OFILEs[i] = file('loading-rate.d/loading_rate_%.2f.dat' % K, 'w')
+ OFILEs[i] = open('loading-rate.d/loading_rate_%.2f.dat' % K, 'w')
-for line in file(DATA, 'r'):
+for line in open(DATA, 'r'):
if line[0] == '#':
continue
fields = line.strip().split()
data = {}
header = None
-for line in file(data_filename, 'r'):
+for line in open(data_filename, 'r'):
if len(line.strip()) == 0:
continue
if line.startswith('#'):
mod_includes = parse_modules(options.modules)
fn = parse_function(options.function)
- data = read_data(file(datafile, 'r'),
+ data = read_data(open(datafile, 'r'),
options.xcol, options.ycol, options.wcol)
initial_ps = [float(x) for x in options.params.split(',')]