import sys import sqlite3 import numpy as np con = sqlite3.connect(sys.argv[1]) cur = con.cursor() orders = np.array(cur.execute('select distinct ord from results').fetchall())[:,0] eps = np.array(cur.execute('select distinct ep from results').fetchall())[:,0] res = np.array(cur.execute('select distinct res from results').fetchall())[:,0] print "#", orders, eps with open('time.out', 'w') as time_file: for ep in eps: time_file.write("%d " % ep) for order in orders: cur_results = cur.execute('select time from results where res = 1 and ep = ? and ord = ?', (int(ep),int(order))) cur_time = np.array(cur_results.fetchall()).mean() time_file.write("%e " % cur_time) time_file.write("\n") print "%e" % np.array(cur.execute('select abs(exact - final) from results').fetchall()).mean()