Skip to content
Snippets Groups Projects
Commit b8901101 authored by Yngve Levinsen's avatar Yngve Levinsen
Browse files

better first line

(calculates averages instead of printing all)
parent 3e006c39
No related branches found
No related tags found
No related merge requests found
......@@ -256,8 +256,16 @@ class remote_data_merger:
If filename is given, writes directly to output file.
'''
data=[]
count=0
import numpy as np
h1=[]
h2=[]
d1=[]
d2=[]
d3=[]
if self._files:
for f in self._files:
string=file(f,'r').read()
......@@ -267,13 +275,36 @@ class remote_data_merger:
thisdata=split[10].strip().split('\n')
if not data:
data=thisdata
else:
data.insert(1+count,thisdata[1])
data.insert(10+2*count,thisdata[10])
data.insert(11+3*count,thisdata[11])
count+=1
if not h1:
h1=[thisdata[0]+" (std in paranthesis)"]
h2=thisdata[2:10]
d1.append(thisdata[1].split())
d2.append(thisdata[10])
d3.append(thisdata[11])
# fix d1:
for i in xrange(len(d1)):
for j in xrange(len(d1[0])):
d1[i][j]=float(d1[i][j])
d1=np.array(d1)
means=d1.mean(axis=0)
stds=d1.std(axis=0)
d1=[]
for i in xrange(len(stds)):
if stds[i]/means[i]<1e-10:
stds[i]=0.0
for i in xrange(len(stds)):
# some small std are removed..
if stds[i]/means[i]>1e-8:
print "FOUND"
d1.append('%f(%f)' % (means[i],stds[i]))
print d1
else: #error is 0
d1.append(str(means[i]))
d1=[' '.join(d1)]
# create data:
data=h1+d1+h2+d2+d3
if filename:
file(filename,'w').write('\n'.join(data))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment