made it so that we can calculate truthiness

This commit is contained in:
sm
2011-05-27 17:18:44 -06:00
parent b1626060cf
commit 560fd9a0a5
3 changed files with 28 additions and 7 deletions
+19 -4
View File
@@ -2,7 +2,7 @@ import sys
import os
import sqlite3
from interp.tools import rms
from interp.tools import rms, improved
import numpy as np
@@ -19,9 +19,9 @@ if __name__ == '__main__':
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("-T", "--truthy",
action="store_true", dest="truthy", default=False,
help="calculate truthiness plots (default: %default)")
parser.add_option("-r", "--rms",
action="store_true", dest="rms", default=False,
@@ -67,3 +67,18 @@ if __name__ == '__main__':
print "%e " % (cur_time,),
print
if options.truthy:
for ep in extrapoints:
print "%d " % (ep,),
for order in orders:
for res in resolutions:
cur_results = cur.execute('select qlin, err, final, exact from results where res = ? and ep = ? and ord = ?',
(int(res), int(ep),int(order)))
cur_array = np.array(cur.fetchall())
tf = [improved(*i) for i in cur_array]
win_percent = float(tf.count(True)) / len(tf)
print "%e " % (win_percent,),
print