removed the old results script: replaced with the sheep stuff

This commit is contained in:
Stephen McQuay 2011-05-19 15:44:04 -06:00
parent a44098a2bc
commit 8a56078f65

View File

@ -1,79 +0,0 @@
#!/usr/bin/env python
import sys
import time
import pickle
import numpy as np
from optparse import OptionParser
import progressbar
import interp.bootstrap
from interp.grid.gmsh import ggrid
from interp.tools import *
def get_right_exact_func(dimension, baker = False):
f = None
if dimension == 3:
if baker:
f = baker_exact_3D
else:
f =friendly_exact_3D
elif dimension == 2:
if baker:
f = baker_exact_2D
else:
f = friendly_exact_2D
return f
if __name__ == '__main__':
parser = OptionParser(usage = "%prog [options] <input file (gmsh)> <destination file (pickle)>")
parser.add_option("-v", "--verbose",
action="store_true", dest="verbose", default=False,
help="verbose flag")
parser.add_option("-b", "--baker",
action="store_true", dest="baker", default=False,
help="use more impressive baker funcs")
(options, args) = parser.parse_args()
if len(args) != 2:
parser.print_usage()
sys.exit(1)
source, dest = args
dest = pickle.load(open(dest, 'r'))
dimension = int(source.split('.')[1][0])
g = ggrid(source, dimension)
g.q = np.array([get_right_exact_func(dimension, options.baker)(x) for x in g.verts])
exacts = (baker_exact_2D, friendly_exact_2D)
orders = [2,3,4,5]
extras = [4,6,8,12,16,20,32,48,64,96,128,192,256]
for exact_func in exacts:
g.q = np.array([exact_func(x) for x in g.verts])
for order in orders:
for extra in extras:
for d in dest:
results = {True:0, False:0}
errors = []
s = time.time()
for X in d:
a = g.run_baker(X[:2], order = order, extra_points = extra)
exact = exact_func(X[:2])
results[improved_answer(a,exact)] += 1
current_error = exact - a['final']
errors.append(current_error)
e = time.time()
print exact_func.__name__, order, extra, results[True] / float(len(d)), rms(errors), e-s