15 if not os.path.isfile(filename):
16 raise rdt_error(filename +
'is not a valid file.')
18 with open(filename)
as f:
20 hlist = f.readline().split(
',')
28 vlist = line.split(
',')
30 if first.strip() !=
"#":
33 d[hi][1].append(float(v.strip()))
39 for k, v
in rdt_d.iteritems():
50 s=reduce(
lambda x, y : float(x) + float(y), vlist, 0.0)
56 if size == 1
or size == 0:
57 raise StatsError(
"Cannot calculate variance for a sample of size "+str(size))
58 sum1=reduce(
lambda x,y : float(x)+float(y), vlist, 0.0)
59 sum2=reduce(
lambda x,y : float(x)+(float(y)*float(y)), vlist, 0.0)
60 v = (sum2-(
pow(sum1,2)/float(size)))/float(size-1)
65 raise StatsError(
"Something went wrong while calculating the variance (result < 0.0)")
74 if __name__ ==
"__main__":
77 opts, extra_args = getopt.getopt(sys.argv[1:],
'f:')
86 print '{0:7s} \t {1:7s} \t {2:7s} \t {3:7s}'.format(
'User Time',
'User Error',
'Wall Time',
'Wall Error')
89 elapsed_err =
stdev(elapsed_lst)
91 print '{0:5.2f} \t {1:5.2f} \t {2:5.2f} \t {3:5.2f}'.format(self_avg, self_err, elapsed_avg, elapsed_err)
def get_column_values(rdt_d, field)
TPZFlopCounter pow(const TPZFlopCounter &orig, const TPZFlopCounter &xp)
Returns the power and increments the counter of the power.