made the plotter script dump out both timing and rms info.
This commit is contained in:
parent
b38514ff1d
commit
46b6cbb7bb
@ -1,25 +1,69 @@
|
|||||||
import sys
|
import sys
|
||||||
|
import os
|
||||||
import sqlite3
|
import sqlite3
|
||||||
|
|
||||||
|
from interp.tools import rms
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
con = sqlite3.connect(sys.argv[1])
|
from optparse import OptionParser
|
||||||
cur = con.cursor()
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
parser = OptionParser(usage = "usage: %s [options] <db file>")
|
||||||
|
|
||||||
|
parser.add_option("-R", "--resolution",
|
||||||
|
type="int", dest="res", default=1,
|
||||||
|
help="resolution (for constant resolution charts) (default: %default)")
|
||||||
|
|
||||||
|
parser.add_option("-t", "--time",
|
||||||
|
action="store_true", dest="time", default=False,
|
||||||
|
help="write out timing results (default: %default)")
|
||||||
|
|
||||||
|
parser.add_option("-T", "--time-by-res",
|
||||||
|
action="store_true", dest="time", default=False,
|
||||||
|
help="write out timing (default: %default)")
|
||||||
|
|
||||||
|
parser.add_option("-r", "--rms",
|
||||||
|
action="store_true", dest="rms", default=False,
|
||||||
|
help="write out rms output (default: %default)")
|
||||||
|
|
||||||
|
|
||||||
orders = np.array(cur.execute('select distinct ord from results').fetchall())[:,0]
|
(options, args) = parser.parse_args()
|
||||||
eps = np.array(cur.execute('select distinct ep from results').fetchall())[:,0]
|
if len(args) != 1:
|
||||||
res = np.array(cur.execute('select distinct res from results').fetchall())[:,0]
|
parser.print_usage()
|
||||||
print "#", orders, eps
|
sys.exit(1)
|
||||||
|
|
||||||
with open('time.out', 'w') as time_file:
|
con = sqlite3.connect(args[0])
|
||||||
for ep in eps:
|
cur = con.cursor()
|
||||||
time_file.write("%d " % ep)
|
|
||||||
|
|
||||||
|
resolutions = np.array(cur.execute('select distinct res from results').fetchall())[:,0]
|
||||||
|
orders = np.array(cur.execute('select distinct ord from results').fetchall())[:,0]
|
||||||
|
extrapoints = np.array(cur.execute('select distinct ep from results').fetchall())[:,0]
|
||||||
|
print "# i found these resolutions %s, orders: %s, and extra points: %s" % (resolutions, orders, extrapoints)
|
||||||
|
|
||||||
|
if options.time:
|
||||||
|
for ep in extrapoints:
|
||||||
|
print "%d " % (ep,),
|
||||||
for order in orders:
|
for order in orders:
|
||||||
cur_results = cur.execute('select time from results where res = 1 and ep = ? and ord = ?',
|
for res in resolutions:
|
||||||
(int(ep),int(order)))
|
cur_results = cur.execute('select time from results where res = ? and ep = ? and ord = ?',
|
||||||
|
(int(res), int(ep),int(order)))
|
||||||
cur_time = np.array(cur_results.fetchall()).mean()
|
cur_time = np.array(cur_results.fetchall()).mean()
|
||||||
time_file.write("%e " % cur_time)
|
print "%e " % (cur_time,),
|
||||||
time_file.write("\n")
|
|
||||||
|
print
|
||||||
|
|
||||||
|
|
||||||
print "%e" % np.array(cur.execute('select abs(exact - final) from results').fetchall()).mean()
|
# print "%e" % np.array(cur.execute('select abs(exact - final) from results').fetchall()).mean()
|
||||||
|
if options.rms:
|
||||||
|
for ep in extrapoints:
|
||||||
|
print "%d " % (ep,),
|
||||||
|
for order in orders:
|
||||||
|
for res in resolutions:
|
||||||
|
cur_results = cur.execute('select abs(exact - final) from results where res = ? and ep = ? and ord = ?',
|
||||||
|
(int(res), int(ep),int(order)))
|
||||||
|
cur_time = rms(np.array(cur_results.fetchall()))
|
||||||
|
print "%e " % (cur_time,),
|
||||||
|
|
||||||
|
print
|
||||||
|
Loading…
Reference in New Issue
Block a user