2011-05-06 10:02:24 -07:00
|
|
|
import sys
|
2011-05-20 10:14:33 -07:00
|
|
|
import pickle
|
2011-05-06 10:02:24 -07:00
|
|
|
|
2011-05-20 10:14:33 -07:00
|
|
|
import time
|
2011-05-06 10:02:24 -07:00
|
|
|
|
2011-05-20 10:14:33 -07:00
|
|
|
from progressbar import *
|
2011-05-06 10:02:24 -07:00
|
|
|
|
2011-05-20 10:14:33 -07:00
|
|
|
from interp.grid.DD import *
|
2011-06-07 21:37:12 -07:00
|
|
|
from interp.tools import *
|
|
|
|
from interp import bootstrap
|
2011-05-06 10:02:24 -07:00
|
|
|
|
2011-05-20 11:11:04 -07:00
|
|
|
EXTRA_POINTS = 64
|
2011-05-06 10:02:24 -07:00
|
|
|
|
2011-05-20 10:14:33 -07:00
|
|
|
RES_START = 10
|
|
|
|
RES_END = 100
|
|
|
|
RES_DELTA = 10
|
2011-05-06 10:02:24 -07:00
|
|
|
|
2011-05-20 11:11:04 -07:00
|
|
|
ORDER_START = 1
|
2011-05-20 10:14:33 -07:00
|
|
|
ORDER_END = 8
|
|
|
|
|
|
|
|
dest_verts, output_filename = sys.argv[1:]
|
|
|
|
dest_verts = pickle.load(open(dest_verts, 'r'))
|
|
|
|
|
|
|
|
output_file = open(output_filename, 'w')
|
|
|
|
|
|
|
|
count = len(dest_verts) * len(xrange(RES_START,RES_END + 1, RES_DELTA)) * len(xrange(ORDER_START, ORDER_END + 1))
|
2011-05-06 10:02:24 -07:00
|
|
|
|
2011-05-20 10:14:33 -07:00
|
|
|
widgets = ['submit jobs: ', Percentage(), ' ', Bar(), ' ', ETA()]
|
|
|
|
pbar = ProgressBar(widgets = widgets, maxval = count)
|
|
|
|
pbar.start()
|
|
|
|
|
|
|
|
i=0
|
|
|
|
for resolution in xrange(RES_START,RES_END + 1, RES_DELTA):
|
|
|
|
r = rect_grid(resolution, resolution)
|
|
|
|
|
|
|
|
for v in xrange(len(r.verts)):
|
|
|
|
r.q[v] = baker_exact_2D(r.verts[v])
|
2011-05-06 10:02:24 -07:00
|
|
|
|
2011-05-20 10:14:33 -07:00
|
|
|
output_file.write("%f" % (1.0 / resolution))
|
2011-05-06 10:02:24 -07:00
|
|
|
|
2011-05-20 10:14:33 -07:00
|
|
|
for order in xrange(ORDER_START, ORDER_END + 1):
|
|
|
|
errors = []
|
|
|
|
|
|
|
|
start = time.time()
|
|
|
|
for X in dest_verts:
|
|
|
|
a = r.run_baker(X, order, EXTRA_POINTS)
|
|
|
|
cur_exact = baker_exact_2D(X)
|
|
|
|
e = a['final'] - cur_exact
|
|
|
|
errors.append(e)
|
|
|
|
i+=1
|
|
|
|
pbar.update(i)
|
|
|
|
end = time.time()
|
|
|
|
|
|
|
|
rmserror = rms(errors)
|
|
|
|
output_file.write(" %e" % rmserror)
|
|
|
|
output_file.write("\n")
|
|
|
|
output_file.flush()
|
|
|
|
pbar.finish()
|