1234567891011121314151617181920212223242526272829303132333435363738394041 |
- import sys
- operations = {}
- with open("calibration/result", 'r') as f:
- for l in f:
- try:
- op, t = l.split(": ")
- t = float(t)
- operations.setdefault(op, []).append(t)
- except:
- pass
- with open("calibration/averages", 'w') as averages:
- with open("calibration/plot", 'w') as plot:
- for op in operations:
- avg = sum(operations[op]) / len(operations[op])
- op_max = avg * 3
- new_list = []
- with open("calibration/distribution_%s" % op, 'w') as f:
- for t in sorted(operations[op]):
- if t < op_max:
- f.write("%.17f\n" % t)
- averages.write("%20s: %.17f\n" % (op, avg))
- plot.write("set terminal postscript enhanced colour portrait size 6,6\n")
- plot.write("set xtics rotate by -45\n")
- plot.write("n = 20\n")
- plot.write("max=%s\n" % op_max)
- plot.write("width=max/n\n")
- plot.write("set boxwidth width absolute\n")
- plot.write("set style fill solid 1.0 noborder\n")
- plot.write("rounded(x)=width*floor(x/width)+width/2\n")
- plot.write("set out 'calibration/plot_%s.eps'\n" % op)
- plot.write("set ylabel 'Frequency (time)'\n")
- plot.write("set xlabel 'Duration (s)'\n")
- plot.write("set title 'Operation %s'\n" % op.replace("_", "\\_"))
- plot.write("plot 'calibration/distribution_%s' u (rounded($1)):(1) smooth freq w boxes title ''\n" % op)
|